fix(gateway): sustain qualified media traversal
Verify Data Plane / gateway (push) Successful in 5m4s
Verify Data Plane / gateway (push) Successful in 5m4s
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
||||
"regexp"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
runtimemetrics "runtime/metrics"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -38,14 +39,15 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
qualificationToolVersion = "versevdi-gateway-qualification/v5"
|
||||
qualificationImpairmentQueuePackets = 64
|
||||
qualificationToolVersion = "versevdi-gateway-qualification/v6"
|
||||
qualificationImpairmentQueuePackets = 256
|
||||
qualificationImpairmentMaxPackets = 100_000
|
||||
qualificationImpairmentPacketCount = 10_000
|
||||
qualificationProcessingLimit = 5 * time.Millisecond
|
||||
qualificationImpairmentSeed uint64 = 0x3c6a11ce
|
||||
qualificationClockOverheadMethod = "median of 1000 batches of 100 monotonic time reads"
|
||||
qualificationGatewayCPUScope = "isolated gateway subprocess; bounded recorder/control included, fixture and client driver excluded"
|
||||
qualificationResourceMethod = "RUSAGE_SELF user+system CPU; runtime/metrics heap objects, allocated objects/bytes, and live goroutines sampled once per second"
|
||||
)
|
||||
|
||||
type qualificationMediaProfile struct {
|
||||
@@ -122,9 +124,10 @@ type qualificationProcessingSummary struct {
|
||||
ResourceSamples int `json:"resource_samples"`
|
||||
CPUSeconds float64 `json:"cpu_seconds"`
|
||||
CPUScope string `json:"cpu_scope"`
|
||||
ResourceMethod string `json:"resource_method"`
|
||||
PeakHeapBytes uint64 `json:"peak_heap_bytes"`
|
||||
PeakGoroutines int `json:"peak_goroutines"`
|
||||
Mallocs uint64 `json:"mallocs"`
|
||||
AllocatedObjects uint64 `json:"allocated_objects"`
|
||||
AllocatedBytes uint64 `json:"allocated_bytes"`
|
||||
RawResources string `json:"raw_resources"`
|
||||
RawResourcesSHA256 string `json:"raw_resources_sha256"`
|
||||
@@ -183,12 +186,12 @@ type qualificationCapacityStep struct {
|
||||
}
|
||||
|
||||
type qualificationResourceSample struct {
|
||||
Elapsed time.Duration
|
||||
CPUSeconds float64
|
||||
HeapBytes uint64
|
||||
Goroutines int
|
||||
Mallocs uint64
|
||||
Allocated uint64
|
||||
Elapsed time.Duration
|
||||
CPUSeconds float64
|
||||
HeapBytes uint64
|
||||
Goroutines int
|
||||
AllocatedObjects uint64
|
||||
AllocatedBytes uint64
|
||||
}
|
||||
|
||||
type qualificationDeliverySample struct {
|
||||
@@ -1720,10 +1723,11 @@ func runQualificationProcessing(t *testing.T, profile qualificationMediaProfile,
|
||||
summary.RawResourcesBytes = resourceSize
|
||||
summary.ResourceSamples = record.ResourceSamples
|
||||
summary.CPUScope = qualificationGatewayCPUScope
|
||||
summary.ResourceMethod = qualificationResourceMethod
|
||||
summary.CPUSeconds = record.CPUSeconds
|
||||
summary.PeakHeapBytes = record.PeakHeapBytes
|
||||
summary.PeakGoroutines = record.PeakGoroutines
|
||||
summary.Mallocs = record.Mallocs
|
||||
summary.AllocatedObjects = record.AllocatedObjects
|
||||
summary.AllocatedBytes = record.AllocatedBytes
|
||||
if summary.CPUSeconds < 0 || summary.ClockOverhead <= 0 || summary.ClockMethod == "" {
|
||||
return qualificationProcessingSummary{}, errors.New("process CPU usage unavailable")
|
||||
@@ -1813,12 +1817,17 @@ func qualificationRuntimeSample(started time.Time) qualificationResourceSample {
|
||||
cpuSeconds = float64(usage.Utime.Sec+usage.Stime.Sec) +
|
||||
float64(usage.Utime.Usec+usage.Stime.Usec)/1_000_000
|
||||
}
|
||||
var memory runtime.MemStats
|
||||
runtime.ReadMemStats(&memory)
|
||||
samples := []runtimemetrics.Sample{
|
||||
{Name: "/memory/classes/heap/objects:bytes"},
|
||||
{Name: "/sched/goroutines:goroutines"},
|
||||
{Name: "/gc/heap/allocs:objects"},
|
||||
{Name: "/gc/heap/allocs:bytes"},
|
||||
}
|
||||
runtimemetrics.Read(samples)
|
||||
return qualificationResourceSample{
|
||||
Elapsed: time.Since(started), CPUSeconds: cpuSeconds,
|
||||
HeapBytes: memory.HeapAlloc, Goroutines: runtime.NumGoroutine(),
|
||||
Mallocs: memory.Mallocs, Allocated: memory.TotalAlloc,
|
||||
HeapBytes: samples[0].Value.Uint64(), Goroutines: int(samples[1].Value.Uint64()),
|
||||
AllocatedObjects: samples[2].Value.Uint64(), AllocatedBytes: samples[3].Value.Uint64(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1829,10 +1838,10 @@ func writeQualificationResourceSamples(path string, samples []qualificationResou
|
||||
}
|
||||
compressed := gzip.NewWriter(file)
|
||||
buffered := bufio.NewWriter(compressed)
|
||||
if _, err = buffered.WriteString("elapsed_ns,cpu_seconds,heap_bytes,goroutines,mallocs,allocated_bytes\n"); err == nil {
|
||||
if _, err = buffered.WriteString("elapsed_ns,cpu_seconds,heap_object_bytes,goroutines,allocated_objects,allocated_bytes\n"); err == nil {
|
||||
for _, sample := range samples {
|
||||
if _, err = fmt.Fprintf(buffered, "%d,%.9f,%d,%d,%d,%d\n", sample.Elapsed.Nanoseconds(),
|
||||
sample.CPUSeconds, sample.HeapBytes, sample.Goroutines, sample.Mallocs, sample.Allocated); err != nil {
|
||||
sample.CPUSeconds, sample.HeapBytes, sample.Goroutines, sample.AllocatedObjects, sample.AllocatedBytes); err != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -2201,7 +2210,7 @@ func TestSection7Qualification(t *testing.T) {
|
||||
OS: runtime.GOOS, Architecture: runtime.GOARCH,
|
||||
Topology: "parent source-shaped encrypted Apollo fixture -> isolated gateway subprocess for processing/resource evidence -> public Verse client decoder; impairment uses the same native recovery/FEC, bounded queue, production pacer, framing, and QUIC path",
|
||||
Direction: "provider_to_client",
|
||||
QueueDiscipline: "ordered fixed-seed source delay queue with one-serialization-interval catch-up, bounded 64-packet native video queue, production equal-tier fair pacer",
|
||||
QueueDiscipline: "ordered fixed-seed source delay queue with one-serialization-interval catch-up, bounded 256-packet native video queue, production equal-tier fair pacer",
|
||||
Evidence: []string{"deterministic source-shaped Apollo recovery", "isolated gateway-process resources", "local real-time production path", "mTLS/QUIC fixture transport", "attributed path impairment", "production fair pacer"},
|
||||
Deferred: []string{"live Apollo", "macOS client", "physical firewall and packet route", "real encoder fidelity", "multi-host scale"},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user