Run a benchmark¶
From your workstation, snap-asr-bench --on-host runs each target's
benchmark on its runner host: a CPU instance beside the target's vLLM
host, in the same VPC. The client runs there in a Docker container built from
your code, so the results have no long network path in them, and the client
doesn't share CPUs with vLLM. Each run's events.jsonl comes back to your
workstation.
| Machine | Runs |
|---|---|
| Your workstation | snap-asr-bench --on-host, make push-hosts, the analysis |
| A runner host per target | The benchmark client, in a Docker container |
| A vLLM host per target | vLLM, in a Docker container, and the log sidecar |
Other ways to run are in Alternate run methods.
How it works¶
For each target, snap-asr-bench --on-host:
- Connects with
ssh <runner_host>, the target'srunner_hostfrom the targets file. - Checks that the runner's copy of the client code, and of the plan, matches yours (by sha256), and stops that target if it doesn't.
- Sends your targets file, without the SSH host names, so the runner
benchmarks the URLs you gave and checks a plan's job
onlynames against the same targets you did.run-local.shpicks this target with--only. - Mounts the runner's instance store at
/mnt/nvmeif it isn't mounted (a runner without one gets/mnt/nvmeon its root volume), then startsdeploy/client/run-local.shin~/snap-asr-benchas the systemd unitsnap-asr-bench-<run-id>-<target>.run-local.shbuilds the client image fromdeploy/client/Dockerfile(Python 3.12 and uv base images pinned by digest, Debian's ffmpeg, the locked dependencies and your pushed code), and runs it with host networking. Each load's streams are spread over client processes, one per runner CPU by default. - Prints the unit's journal, each line prefixed with the target's name, until the run ends. If the connection drops, it reconnects.
- Copies back the run's
events.jsonl, gzipped on the way, into<work-dir>/runs/<run-id>-<target>/. That's the only file an analysis needs: the staged inputs and the extracted audio stay on the runner.
Set up¶
Once for your workstation, and once for each runner host (again if Terraform replaces it).
Your workstation¶
- The repository, with its dependencies installed (
make sync), souv run snap-asr-benchworks. Run every command on this page from the repository root. - AWS CLI v2 with the Session Manager plugin, and credentials for the
account (export
AWS_PROFILE): see Workstation prerequisites.
Each runner host¶
-
Create it with Terraform. List each target's VPC (
trn,g7e,g4dnorg6) with an instance type inlocal_bench_instance_types, in your tfvars, then apply:local_bench_instance_types = { trn = "i7i.2xlarge" g7e = "m8id.2xlarge" }terraform -chdir=terraform applyEach runner is an Ubuntu 24.04 instance in its target's private subnet, with the shared instance role (SSM and the S3 inputs), and a security group of its own. The target's security group gets a rule that lets the runner reach vLLM and the sidecar. Pick a type the target's AZ offers, with an instance store and fast cores: the client's processes are CPU-bound.
terraform -chdir=terraform output instance_idslists the runner as<vpc>_bench. -
Give yourself SSH access. The login user is
ubuntu. Add your public key to its~/.ssh/authorized_keysthrough Session Manager, and give the runner an entry in~/.ssh/configwithUser ubuntu, its instance ID and its region (SSH over Session Manager). That entry's name is the target'srunner_host. -
Copy the code to it:
make push-hosts HOSTS=<runner-ssh-host> -
Install Docker from Docker's apt repository, and let
ubuntuuse it:ssh <runner-ssh-host> 'curl -fsSL https://get.docker.com | sudo sh && sudo usermod -aG docker ubuntu'
Nothing else is installed by hand: each run mounts the instance store and builds the client image itself.
The bench host can also be a runner for the targets in its own region (g4dn and g6), which it reaches over VPC peering. Run those targets one after the other: in parallel they'd share its CPUs.
The targets file¶
Each target in the plan's targets file (targets in its [run]) needs its
vLLM host's private URLs, from terraform -chdir=terraform output private_ips,
and its runner's SSH name:
[[targets]]
name = "trn2"
base_url = "http://<trn2-private-ip>:8000"
sidecar_url = "http://<trn2-private-ip>:8001"
runner_host = "<trn2-runner-ssh-host>"
The run sends the whole file, without the SSH host names, to each runner, so nothing on the runner lists the targets.
Check¶
Each runner should answer without asking for anything, and reach its target's vLLM, which should list the model:
ssh -o BatchMode=yes <runner-ssh-host> 'curl -s http://<private-ip>:8000/v1/models'
Run a plan¶
1. Push the code¶
Each runner builds the client from its own copy of the code, and a run refuses a runner whose copy of the code or the plan differs from yours. Push whenever you change either:
make push-hosts
push-hosts copies the code to ~/snap-asr-bench on each target's
runner_host in targets.toml (TARGETS=<file> for another targets file,
HOSTS="<ssh-host> ..." for other hosts):
- What it sends: in a Git checkout, Git's tracked files as they are in
your working tree, uncommitted edits included. It lists untracked files it
didn't send:
git adda new file to include it. In a copy without Git, it sends the directory withoutscratch/,.venv/,terraform/and the other paths the S3 copy leaves out. - What it leaves alone: nothing on a host is deleted. A file you removed locally stays on the host until you remove it there.
- What it records: each host gets
~/snap-asr-bench/.pushed, with the commit it got and when. To see what a host has:ssh <ssh-host> cat snap-asr-bench/.pushed.
2. Turn on on-host in the plan¶
Set on-host in the plan's [run], with a local work-dir for the results:
[run]
targets = "targets.toml" # every target with its runner_host
parallel-targets = true # all runners at once
on-host = true # run on each target's runner host, over SSH
work-dir = "scratch" # local directory each events.jsonl comes back to
client-processes (default auto, one per runner CPU) sets how many
processes share each load's streams.
Plan a warm-up: the first requests with a new chunk length can be slow on
trn2. Set a warm-up input that isn't one of the measured clips
(warmup-input and warmup-seconds = 60 in [run]), and use only
phase == "measure" events for results (Warm-up).
A job can run on some of the targets only, with only in its [[job]]
(Targets per job). --only on the
command line picks some of the targets, and each job then runs on the ones
in its own only.
3. Preview¶
uv run snap-asr-bench --plan resources/plans/<name>.toml --dry-run
The output ends with the runners it will start, for example
on host, over SSH: trn2 (ssh <trn2-runner-ssh-host>), ..., and each job with
an only shows the targets it runs on. Nothing is sent to the runners.
4. Run¶
uv run snap-asr-bench --plan resources/plans/<name>.toml
Or with make: make bench PLAN=resources/plans/<name>.toml.
Each runner's output arrives as it runs, each line prefixed with the target's
name, such as [trn2]. With parallel-targets the runners run at once;
otherwise one after another. A target that fails doesn't stop the others.
The command line goes to each runner as given, followed by --no-on-host and
the runner's run ID; run-local.sh then adds --targets (the targets file
this side sent), --only (the runner's target) and --work-dir. Paths on the command line and in the
plan must be relative to the repository root, or s3:// URIs.
BUCKET_REGION, if set, is passed on.
A realtime stream lasts as long as the audio, so estimate the duration as
strategies × boundaries × formats × chunk sizes × repeats × audio length
(summed over the clips of a manifest) for the realtime streams, plus the
shorter afap streams.
The exit status is non-zero if any target failed: its code or plan
differed, the run couldn't start, the connection kept failing,
events.jsonl couldn't be copied, or the run's run_end lists failed
targets or skipped inputs.
5. Follow or stop a run¶
Ctrl-C stops following, not the runs. To follow or stop one:
ssh <runner-ssh-host> journalctl -u snap-asr-bench-<run-id>-<target> -f
ssh <runner-ssh-host> sudo systemctl stop snap-asr-bench-<run-id>-<target>
Stopping the unit stops that run's client container and every process in
it, and leaves any other run on the runner going. The run's events.jsonl
ends with run_end, stopped_by SIGTERM (Failure handling).
If you're still following it, the launcher copies the file back and prints
stopped by SIGTERM.
6. Results¶
Each runner's run ID is <run-id>-<target>, and its events.jsonl is copied
to your workstation. From a plan, <run-id> ends with the plan's file name
without .toml, for example 20261123T141124Z-a5d6c8-concurrency-ladder-nvda
(--run-id):
<work-dir>/runs/<run-id>-trn2/events.jsonl
<work-dir>/runs/<run-id>-g4dn/events.jsonl
<work-dir>/runs/<run-id>-g7e/events.jsonl
The runner keeps its own copy, with the staged inputs and the extracted
audio, under /mnt/nvme/snap-asr-bench/. To analyse the runs
(Run the analysis):
uv run --extra analysis snap-benchmark-analysis <work-dir>/runs/<run-id>-trn2 <work-dir>/runs/<run-id>-g4dn <work-dir>/runs/<run-id>-g7e --out-dir <analysis-dir>
Before reading a load's numbers, check that the client kept up: its
load_end.client_process_cpu_max_fraction near 1 means the busiest client
process, not the server, limited it
(Concurrent load). Then check the runs
as in Validate the results.