feat(performance): Add minimum legitimate throughput parameter and up… #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Performance Harness | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 3 * * *" | |
| push: | |
| branches: [main] | |
| paths: | |
| - "src/**" | |
| - "tests/**" | |
| - "Cargo.toml" | |
| - ".github/workflows/performance-harness.yml" | |
| concurrency: | |
| group: performance-harness-${{ github.ref }} | |
| cancel-in-progress: true | |
| # Deny-all token default. This workflow only reads repository contents and | |
| # uploads benchmark artifacts produced in-run. | |
| permissions: {} | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| performance: | |
| name: Extreme-load performance harness | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 35 | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Rust toolchain | |
| run: rustup show | |
| # Restore-only cache policy: this workflow reuses warm integration cache | |
| # entries for speed but never writes back, so high-variance performance | |
| # builds cannot perturb trusted cache contents. | |
| - name: Cache Rust build | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: integration | |
| save-if: "false" | |
| - name: Run performance harness | |
| run: cargo test --release --features integration --test performance_harness -- --ignored --nocapture | |
| env: | |
| SERVAL_SKIP_FRONTEND_BUILD: "1" | |
| PERF_RESULTS_PATH: target/performance-harness-report.json | |
| PERF_LATENCY_SAMPLE_STRIDE: "24" | |
| PERF_LATENCY_SAMPLE_CAPACITY: "250000" | |
| PERF_PEAK_INITIAL_CONCURRENCY: "256" | |
| PERF_PEAK_MAX_CONCURRENCY: "16384" | |
| PERF_PEAK_STAGE_DURATION_SECS: "8" | |
| PERF_PEAK_MULTIPLIER_PCT: "160" | |
| PERF_PEAK_CONTINUE_MAX_ERROR_PCT: "4" | |
| PERF_PEAK_CONTINUE_MAX_P95_MS: "1200" | |
| PERF_PEAK_MAX_UNHEALTHY_STAGES: "2" | |
| PERF_ADVERSARIAL_LEGIT_CONCURRENCY: "64" | |
| PERF_ADVERSARIAL_FORGED_INITIAL_CONCURRENCY: "512" | |
| PERF_ADVERSARIAL_FORGED_MAX_CONCURRENCY: "32768" | |
| PERF_ADVERSARIAL_FORGED_MULTIPLIER_PCT: "175" | |
| PERF_ADVERSARIAL_STAGE_DURATION_SECS: "8" | |
| PERF_ADVERSARIAL_WRITER_INTERVAL_MS: "120" | |
| PERF_ADVERSARIAL_CONTINUE_MIN_LEGIT_RPS: "150" | |
| PERF_ADVERSARIAL_CONTINUE_MAX_ERROR_PCT: "8" | |
| PERF_ADVERSARIAL_CONTINUE_MAX_P95_MS: "1600" | |
| PERF_ADVERSARIAL_CONTINUE_MIN_FORGED_REJECTION_PCT: "98" | |
| PERF_ADVERSARIAL_CONTINUE_MIN_CONTROL_WRITE_SUCCESS_PCT: "85" | |
| PERF_ADVERSARIAL_MAX_UNHEALTHY_STAGES: "2" | |
| PERF_ASSERT_PEAK_MIN_TESTED_CONCURRENCY: "2048" | |
| PERF_ASSERT_PEAK_MIN_BEST_RPS: "900" | |
| PERF_ASSERT_PEAK_MAX_BEST_ERROR_PCT: "8" | |
| PERF_ASSERT_ADVERSARIAL_MIN_TESTED_FORGED_CONCURRENCY: "4096" | |
| PERF_ASSERT_ADVERSARIAL_MIN_LEGIT_RPS: "150" | |
| PERF_ASSERT_ADVERSARIAL_MAX_LEGIT_ERROR_PCT: "15" | |
| PERF_ASSERT_FORGED_REJECTION_PCT: "99" | |
| PERF_ASSERT_CONTROL_WRITE_SUCCESS_PCT: "80" | |
| - name: Generate step summary | |
| if: always() | |
| run: | | |
| REPORT=target/performance-harness-report.json | |
| if [ ! -f "$REPORT" ]; then | |
| echo '> No performance report produced (harness did not complete).' >> "$GITHUB_STEP_SUMMARY" | |
| exit 0 | |
| fi | |
| jq -r ' | |
| "## Peak Traffic Profile\n", | |
| "| Concurrency | RPS | p50 ms | p95 ms | p99 ms | Errors | Status |", | |
| "|---:|---:|---:|---:|---:|---:|:---:|", | |
| (.peak_stages[] | | |
| "| " + (.concurrency|tostring) | |
| + " | " + (.snapshot.throughput_rps * 10 | round / 10 | tostring) | |
| + " | " + (.snapshot.p50_ms|tostring) | |
| + " | " + (.snapshot.p95_ms|tostring) | |
| + " | " + (.snapshot.p99_ms|tostring) | |
| + " | " + (.snapshot.error_rate * 10000 | round / 100 | tostring) + "%" | |
| + " | " + (if .healthy then "✅" else "❌" end) + " |" | |
| ), | |
| "\n**Best:** `" + (.peak_best.concurrency|tostring) + "` concurrency → **" | |
| + (.peak_best.snapshot.throughput_rps * 10 | round / 10 | tostring) | |
| + " rps** · p95 " + (.peak_best.snapshot.p95_ms|tostring) + " ms\n", | |
| "---\n", | |
| "## Adversarial Profile\n", | |
| "| Forged conc. | Legit RPS | Legit p95 ms | Legit errors | Forged rejection | CP writes ok | Status |", | |
| "|---:|---:|---:|---:|---:|---:|:---:|", | |
| (.adversarial_stages[] | | |
| "| " + (.forged_concurrency|tostring) | |
| + " | " + (.legit.throughput_rps * 10 | round / 10 | tostring) | |
| + " | " + (.legit.p95_ms|tostring) | |
| + " | " + (.legit.error_rate * 10000 | round / 100 | tostring) + "%" | |
| + " | " + (.forged_rejection_rate * 10000 | round / 100 | tostring) + "%" | |
| + " | " + (.control_write_success_rate * 100 | round | tostring) + "%" | |
| + " | " + (if .healthy then "✅" else "❌" end) + " |" | |
| ), | |
| "\n**Best:** `" + (.adversarial_best.forged_concurrency|tostring) | |
| + "` forged concurrency → legit **" | |
| + (.adversarial_best.legit.throughput_rps * 10 | round / 10 | tostring) | |
| + " rps** · forged rejection **" | |
| + (.adversarial_best.forged_rejection_rate * 10000 | round / 100 | tostring) + "%**" | |
| ' "$REPORT" >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload performance report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: performance-harness-report | |
| path: target/performance-harness-report.json | |
| if-no-files-found: warn |