sabrix-bench ⚡
The "wrk / hyperfine for AI proxies and LLM gateways" — A fast, vendor-neutral benchmarking harness and Model Context Protocol (MCP) traffic inspector in pure safe Rust.
🎯 What is sabrix-bench?
sabrix-bench is an open-source, vendor-neutral benchmarking tool designed to measure pure client-visible HTTP & Server-Sent Events (SSE) streaming metrics against any AI proxy, firewall, or LLM gateway (LiteLLM, Cloudflare AI Gateway, Portkey, vLLM, or Sabrix).
Traditional web benchmark tools (wrk, vegeta) only measure total request duration ($t_{\text{total}}$), which is dominated by upstream LLM token generation. sabrix-bench inspects what users actually experience:
- Time-to-First-Token (TTFT / Chunk 0 latency) under high concurrency ($1$ to $500$ parallel connections).
- Inter-Token Latency (ITL) & Streaming Jitter ($\sigma$) to expose proxy chunk buffering and stream degradation.
- HDR Latency Percentiles ($p50$, $p90$, $p95$, $p99$, $p99.9$).
- Standalone Self-Contained HTML Reports (
--export-html report.html) with embedded interactive SVG percentile curves.
🚀 Quickstart & Installation
Install via Cargo (Crates.io)
Or Install via Git
🛠️ CLI Usage
1. sabrix-bench run — Live HTTP/SSE Gateway Benchmark
Benchmark any external endpoint with concurrent workers and streaming SSE chunk evaluation:
# Benchmark local gateway with 50 parallel connections
# Benchmark with embedded Enterprise RAG test corpus (50 prompts)
# Benchmark with OWASP LLM Top-10 & safety test suite
# Export standalone zero-dependency dark-mode HTML report & JSON telemetry
# Pass custom authentication or routing headers
2. sabrix-bench trace — Real-Time MCP Tool-Call Security Inspector
Inspect JSON-RPC 2.0 requests (tools/call, resources/read) in sub-microsecond ($< 1\ \mu\text{s}$) latency and detect security violations (destructive shell commands, SQL mutations, credential leaks, path traversal):
# Run built-in demo scenarios
# Inspect inline JSON payload
# Pipe from stdin
|
3. sabrix-bench compare — Multi-Turn Agent Latency Simulator
Calculate compounding latency penalties across multi-turn autonomous agent loops ($20$–$50$ turns) comparing In-Process safe-Rust evaluation vs. remote SaaS network roundtrips:
# Compare a 30-turn agent loop against a 120ms SaaS network baseline
# Show architectural comparison matrix
📊 Public Test Corpora Included
sabrix-bench embeds standard test datasets directly inside the compiled binary:
--suite simple: 10 low-overhead baseline health and connectivity prompts.--suite rag: 50 enterprise RAG prompts of varying lengths ($1\text{KB}$ to $32\text{KB}$) for saturation and throughput benchmarking.--suite owasp: 50 standardized security probes (prompt injection, sensitive path reads, secret leakage, SQL drops) and benign control prompts.--payload <file.json>: Custom user JSON request payloads.
🛡️ License
Dual licensed under MIT or Apache 2.0.