Skip to content

System design

How the system is built today, one section per component. For why it's built this way see Design decisions, and for its known gaps see Limitations and open questions.

Overview

flowchart LR
    subgraph ws["Your workstation"]
        launcher["Launcher<br/>snap-asr-bench --on-host"]
        analysis["Analysis scripts"]
        reports[("PKL, CSV, Excel")]
    end
    subgraph runner["Runner host (one per target)"]
        subgraph harness["Benchmark harness: Docker container"]
            cli["CLI and sweep runner"]
            workers["Load workers<br/>one process per CPU"]
            collectors["Telemetry collectors"]
            log[("events.jsonl")]
        end
    end
    subgraph server["vLLM host (one per target)"]
        vllm["vllm serve :8000<br/>Docker container"]
        sidecar["Log sidecar :8001<br/>systemd service"]
    end

    %% Layout: the longer links put the hosts side by side. Every link between
    %% the workstation and the runner host starts at the launcher (it pulls
    %% events.jsonl, as the collectors pull /metrics), so the workstation sits
    %% beside the runner host instead of in a row of its own.
    launcher -- "SSH over SSM: code, target, start" ----> cli
    launcher -- "copies back over SSH" --> log
    launcher --> analysis --> reports
    cli --> workers
    workers -- "transcription requests" ---> vllm
    cli -- "network probes" ---> vllm & sidecar
    collectors -- "/metrics" ---> vllm
    collectors -- "journal, telemetry" ---> sidecar
    cli & workers & collectors --> log
Hold "Alt" / "Option" to enable pan & zoom
Component Where Runs on
vLLM inference servers deploy/nvidia/, deploy/trn2/, deploy/systemd/, sidecar/ The vLLM hosts (trn2, g4dn, g7e): vLLM in a Docker container, the sidecar as a systemd service
API client src/snap_asr_bench/transcribe.py, network.py Wherever the harness runs
Benchmark harness src/snap_asr_bench/ (the rest), deploy/client/ Each target's runner host, in a Docker container, started from your workstation; or an alternate host
Analysis scripts src/snap_benchmark_analysis/ An analyst's workstation

Code goes from your workstation to each runner host over SSH (make push-hosts), and each run's events.jsonl comes back the same way. Inputs are read from the S3 bucket's inputs/ (or another input bucket). Runs through SSM move the code and the results through the bucket instead: src/ and results/<run-id>/events.jsonl.

1. vLLM inference servers

Each inference host runs one OpenAI-compatible vLLM server for Qwen/Qwen3-ASR-1.7B, plus a log sidecar. Together they're the system under test: they take audio chunks and stream transcript tokens back.

Host Region Set up and configured in
trn2 ap-southeast-4 Trainium host
g4dn us-east-1 NVIDIA hosts
g7e us-east-2 NVIDIA hosts
g6 us-east-1 NVIDIA hosts

The installation pages have each host's instance type, accelerator, image, dtype and how its vLLM is configured.

Each host has its own VPC, peered with the bench VPC. Security groups only allow inbound traffic from the bench subnet. trn2 and g7e launch into capacity reservations.

How a server runs

Every host uses the same pattern, so the client and sidecar don't need to know which platform they're talking to:

  • One systemd unit, vllm.service, runs a per-platform start-vllm.sh as ec2-user.
  • Settings come from /etc/snap-asr-bench/vllm.env, a copy of the host's env file in deploy/. It holds the image, model and vLLM arguments.
  • The start script runs the vLLM container in the foreground with host networking. The server's output goes to the unit's journal, which the sidecar streams to the client.
  • Caches live on the host under /opt/snap-asr-bench, so restarts don't download weights or rebuild compiled output again.
  • Each start is recorded in the journal, and so in each run's JSONL: the image ID and digest on all hosts, plus the fork commits on trn2.

The unit removes any container left over from an unclean stop, restarts on failure after 10 s, waits as long as start-up takes (TimeoutStartSec=infinity), and turns off journald's rate limit so no lines are dropped. What each platform's script passes to Docker is on the installation pages.

Interface used by the client

Endpoint Used for
POST /v1/audio/transcriptions One chunk per request, streamed back as SSE
GET /v1/models Model ID, when the target doesn't set one
GET /health, GET /version Logged at target start; /health is also a network probe
GET /metrics Prometheus metrics, scraped about once a second

Log sidecar

sidecar/asr_log_sidecar.py runs next to vLLM on port 8001. It streams the vLLM journal and a fixed list of telemetry commands to the client as NDJSON, and answers the network probes. Clients choose a command by name and can't send their own. Its endpoints, configuration and telemetry commands are on Log sidecar.

Setup

Use make install-nvidia NVIDIA_HOST=g4dn|g7e|g6 or make install-trn2, or follow the steps on the installation pages.

2. API client

The layer of the benchmark client that talks HTTP to an inference server: transcribe.py sends one chunk and reads the streamed reply, and network.py measures the network. It does no scheduling of its own; the harness decides what to send and when. The request fields, SSE parsing, timings and failure handling are in Benchmark client.

Two behaviours matter for the design:

  • Connections are reused. After data: [DONE] the client still reads the body to the end. Stopping early made httpx close the connection, so every chunk paid a new TCP handshake (230 ms to trn2 from bench). With vLLM's keep-alive raised to 60 s, a stream keeps one connection, as a live client would (decision 15).
  • Failures don't raise. A non-200 reply, an HTTP error or bad JSON is logged and returned as a failed chunk, so the stream carries on. Network probe failures are logged as network_error and don't stop the target.

3. Benchmark harness

The rest of snap-asr-bench: it stages and decodes each input (one file, or every clip in a manifest), runs every stream configuration against each target, scores transcripts against any reference transcripts, and writes everything to one JSONL file. The lifecycle, sweep, chunk planning, encoding and pacing are in Benchmark client.

Across components, it adds:

  • Telemetry collectors. While a target runs, the harness scrapes vLLM's /metrics about once a second. With a sidecar it also follows the vLLM journal, resuming from the last __CURSOR after a dropped connection, and one stream per telemetry command. Server-side output lands in the same timeline as the requests. The collectors start after the start network baseline, so their traffic doesn't skew it, and stop 2 s after the last stream so the final lines land.
  • One event log per run. EventLog (events.py) appends one JSON object per line. Every record has ts, mono_ns, a run-wide seq and the event name. bind() adds context such as target, stream_id and the stream settings, and every later record from that log carries it (decision 5).
  • Failure isolation. A target that raises is logged as target_error, and the next target runs. The exit code is 1 if any target failed.
  • Load workers. A load's streams are spread over worker processes, one per CPU by default, each with its own asyncio loop, and their events go through the main process into the run's one log (Concurrent load).
  • Where it runs:
  • On a runner host per target, the standard way. From your workstation, snap-asr-bench --on-host starts the harness in a Docker container on each target's runner host, beside its vLLM host in the same VPC, so no cross-region network is in the figures and the harness doesn't share CPUs with vLLM (Run a benchmark).
  • Alternates: on the vLLM host itself, through SSM with run-on-hosts.sh, or from the bench host against every target over VPC peering, network included (Alternate run methods).

4. Analysis scripts

A pandas pipeline, snap-benchmark-analysis in src/snap_benchmark_analysis/, that turns runs' events.jsonl files into KPI tables, a workbook and charts. It runs on an analyst's workstation, keeps the runs it has read, and rebuilds every output from the full set each time. Its own section of these docs covers it: Analysis scripts (modules and pipeline), Run the analysis, Outputs and Metrics and rules.