Module 15 · Reproducible benchmark

Benchmark & Comparative Analysis

Thiết kế benchmark reproducible và đọc đúng latency/throughput/resource metrics.


1. Principles

  • Cùng hardware/container limits.
  • Cùng JVM.
  • Cùng DB/dataset.
  • Cùng downstream mock latency/error.
  • Warm-up.
  • Không chỉ nhìn requests/sec.

2. Metrics

NhómMetrics
Latencyp50, p95, p99, max
Capacitythroughput, error rate
RuntimeCPU, memory, GC, thread count
Reactiveevent-loop delay, worker/scheduler saturation
DataDB pool utilization, query latency

3. Workloads

W1: 90% GET /orders, 10% POST
W2: 50% GET, 50% POST
W3: 10k SSE idle clients
W4: Slow payment p95=1200ms
W5: Slow DB p95=500ms
W6: Blocking injection 100ms
W7: CPU-heavy validation 50ms

4. Concurrency

100 → 500 → 1.000 → 5.000 clients, chỉ tăng khi level trước ổn định. Concurrency không phải throughput.

5. Blocking experiment

Inject Thread.sleep(100) vào một tỷ lệ request path và so p95/p99. Event-loop systems thường nhạy hơn với blocking handler.

6. Report template

ScenarioWebFluxVert.xGiải thích
Baseline p99.........
Slow payment.........
Blocking injection.........

7. Interpretation

Không kết luận “framework X nhanh hơn” từ một workload. Kết luận phải gắn version, hardware, config và bottleneck.