Benchmark Results
All benchmarks from real production testing on Debian Bookworm (6 CPU cores, 8GB RAM).
ML Detector Performance
From Day 52 testing:Firewall ACL Agent Performance
From Day 52 stress testing (36,000 events):
Key Metrics (36K events total):
- Crypto pipeline is production-ready (0 errors @ 36K events)
- IPSet capacity planning is critical (hit 1000 IP limit)
- System exhibits graceful degradation (no crashes)
- CPU efficiency excellent (54% max under extreme load)
- Memory efficient (127MB even with 16K queue)
eBPF Sniffer Performance
Component-Specific Tuning
eBPF Sniffer Tuning
Ring Buffer Size
The eBPF ring buffer must be large enough to avoid packet loss:
Monitor ring buffer usage:
Batch Processing
Batch size affects throughput and latency tradeoff:Compression
LZ4 compression provides 4.2x ratio with minimal CPU:ML Detector Tuning
Model Thresholds
Adjust detection thresholds to balance false positives vs false negatives:
Calibration Process:
1
Baseline
Run with default thresholds (0.85) for 24 hours
2
Analyze
3
Adjust
- If too many false positives: Increase threshold
- If missing threats: Decrease threshold
- Adjust per-model (DDoS vs Ransomware may need different values)
4
Validate
Test with known attack traffic (MAWI dataset, synthetic)
Batch Size
ML Detector processes packets in batches for efficiency:Model Selection
Enable only models needed for your use case:Firewall ACL Agent Tuning
IPSet Capacity
Critical for production: IPSet has finite capacity.
Monitor capacity:
Batch Processing
Crypto Pipeline
Day 52 testing proved crypto pipeline is production-ready:- Decryption: 15.2 μs avg
- Decompression: 11.8 μs avg
- Total overhead: ~27 μs per message
- Zero errors @ 36K events
Crypto overhead is negligible. Always keep encryption enabled in production.
CPU and Memory Optimization
CPU Affinity
Pin processes to specific CPU cores:- Reduces cache thrashing
- Improves CPU cache locality
- Prevents process migration overhead
Memory Limits
Set memory limits to prevent runaway processes:NUMA Considerations
On NUMA systems, ensure memory locality:Network Tuning
NIC Settings
Disable Offloading
eBPF/XDP requires raw packets:Promiscuous Mode
Required for gateway mode:Ring Buffer Size
Increase NIC ring buffer for high traffic:eBPF/XDP Mode
XDP provides kernel-bypass for maximum performance:IP Forwarding and NAT
Optimize for gateway mode:Stress Test Methodology
8-Hour Stress Test
ML Defender includes a comprehensive stress test:source/stress_test_8h.sh
- Traffic Generator (
stress_test_traffic.sh): Generates synthetic traffic - Resource Monitor (
stress_test_monitor.sh): Tracks CPU, memory, performance - Main Test Loop: Monitors component health, generates report
1
Start test
2
Monitor progress
3
Review report
After test completes, review
stress_test_*/REPORT.md:Progressive Stress Tests
Day 52 methodology (4 progressive tests):Synthetic Traffic Generation
For controlled testing:Performance Monitoring During Tuning
Real-Time Performance
Bottleneck Identification
Memory Leak Detection
Optimization Checklist
Sniffer Optimization Checklist
Sniffer Optimization Checklist
- Ring buffer sized appropriately (check for drops)
- Batch size tuned for latency vs throughput
- Compression enabled (LZ4 level 1)
- NIC offloading disabled (gro, tso, gso)
- Promiscuous mode enabled
- CPU affinity set
- XDP mode appropriate for NIC (DRV recommended)
Detector Optimization Checklist
Detector Optimization Checklist
- Thresholds calibrated for false positive rate
- Batch size tuned for traffic rate
- Unused models disabled
- CPU affinity set
- Memory limits configured
- Crypto pipeline validated (0 errors)
Firewall Optimization Checklist
Firewall Optimization Checklist
- IPSet capacity planned for environment
- Timeout configured for threat duration
- Batch processing tuned for attack pattern
- Crypto pipeline enabled
- CPU affinity set
- Capacity monitoring enabled
- Eviction strategy planned (for future)
System Optimization Checklist
System Optimization Checklist
- IP forwarding enabled (gateway mode)
- rp_filter disabled (gateway mode)
- Conntrack tuned for connection volume
- NUMA locality configured (if applicable)
- Resource limits set (systemd)
- Monitoring in place
Next Steps
Troubleshooting
Diagnose performance issues
Monitoring
Monitor performance metrics
Configuration
Review configuration options
Architecture
Understand data flow