Benchmark Specification & Metrics: Aegis Packet Engine
1. Benchmarking Objectives
To validate Aegis execution paths, we establish a comparative benchmarking methodology.
Metrics Focus:
- Throughput: Process synthetic traffic loops in memory to measure maximum Packets per second (Mpps) and Gbps, comparing it against the baseline.
- Latency Profile: Measure packet processing latency from ingestion to write queue insertion, tracking p50, p95, and p99 metrics.
- Scalability: Measure scaling efficiency when increasing the number of active worker cores from 1 to 8.
2. Benchmark Environment & Inputs
- Synthetic Ingestion: A high-speed memory-based reader (
MockPcapReader) that loops over a pre-loaded packet array in RAM, removing disk IO bottlenecks from the measurement. - Test Dataset (
benchmark_large.pcap): - Minimum 1,000,000 packets.
- Mixed sizes: 64 bytes (short control TCP/UDP), 1500 bytes (full MTU TLS/HTTP payloads).
- Minimum 10,000 unique flows to test hash map capacity and collisions.
3. High-Resolution Latency Tracking
Aegis tracks packet transit latency using high-resolution hardware counters.
Latency Budget Measurement (Per Worker):
uint64_t start_cycles = rdtsc(); // Read Time-Stamp Counter (x86 assembly)
// ... process packet ...
uint64_t end_cycles = rdtsc();
uint64_t diff = end_cycles - start_cycles;
std::chrono::steady_clock or custom cycle counters.
Latency Histogram:
We track latencies in a flat array of atomic buckets (bins) to prevent lock contention:
* Bins: <1µs, 1-2µs, 2-3µs, 3-5µs, 5-10µs, 10-50µs, 50-100µs, >100µs.
* Average and percentile latencies (p50, p90, p95, p99) are computed at the end of the run.
4. Run Execution Script
A benchmarking tool aegis_benchmark will be included:
# Run benchmark with 4 worker threads, offline replay, and 1,000,000 packets loop
./aegis_benchmark --pcap samples/sample_capture.pcap --threads 4 --loop 10
Expected Output Report:
============================================================
AEGIS BENCHMARK RUN REPORT
============================================================
Total Ingested Packets : [Total count]
Total Processing Time : [Time] seconds
Throughput : [Mpps] Mpps ([Throughput] Gbps)
Packet Pool Drops : [Drops]
Queue Drops : [Drops]
LATENCY PROFILE (Worker core processing):
Min Latency : [Value] microseconds
p50 (Median) : [Value] microseconds
p90 : [Value] microseconds
p95 : [Value] microseconds
p99 : [Value] microseconds
Max Latency : [Value] microseconds
THREAD UTILIZATION:
Ingestion Thread : [Percentage]% (core [ID])
LB Thread : [Percentage]% (core [ID])
Worker Core 0 : [Percentage]% (core [ID])
Worker Core 1 : [Percentage]% (core [ID])
Writer Thread : [Percentage]% (core [ID])
============================================================