-
Notifications
You must be signed in to change notification settings - Fork 0
Run both self-hosted stacks on Modal, with a load-test harness #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alexkroman
wants to merge
3
commits into
main
Choose a base branch
from
modal-deployment
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| __pycache__/ | ||
| *.py[cod] | ||
|
|
||
| # Local secrets / config (see README) | ||
| .env | ||
| license.jwt | ||
| *.jwt | ||
| .ruff_cache/ |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| # Load-test harness | ||
|
|
||
| Points at a running deployment — local compose or Modal — sends **real audio**, | ||
| verifies a transcript actually comes back, and reports latency and throughput. | ||
| `--ramp` sweeps concurrency to find the level a deployment sustains before it | ||
| degrades. | ||
|
|
||
| ```bash | ||
| python -m venv venv && source venv/bin/activate | ||
| pip install -r requirements.txt | ||
| ``` | ||
|
|
||
| ## Correctness check | ||
|
|
||
| One request, verifying the transcript contains an expected word (so an empty | ||
| `200` is still counted as a failure): | ||
|
|
||
| ```bash | ||
| # sync | ||
| python harness.py sync \ | ||
| --endpoint https://<workspace>--aai-sync-u3pro-sync-api.modal.run \ | ||
| --audio ../sync/example/example_audio_file.wav | ||
|
|
||
| # streaming | ||
| python harness.py streaming \ | ||
| --endpoint wss://<workspace>--aai-streaming-u3pro-streaming-api.modal.run \ | ||
| --audio ../streaming/example/example_audio_file.wav \ | ||
| --speech-model universal-3-5-pro | ||
| ``` | ||
|
|
||
| Against a local compose stack, use `--endpoint http://localhost:8080` and | ||
| `ws://localhost:8080`. | ||
|
|
||
| ## Concurrency sweep | ||
|
|
||
| ```bash | ||
| python harness.py sync --endpoint https://... --audio a.wav --ramp 1,2,4,8,16 | ||
| python harness.py streaming --endpoint wss://... --audio a.wav \ | ||
| --ramp 1,4,16,32 --max-seconds 20 | ||
| ``` | ||
|
|
||
| Each level fires N requests simultaneously and reports: | ||
|
|
||
| | column | meaning | | ||
| | --- | --- | | ||
| | `ok` / `fail` | requests that returned a valid transcript | | ||
| | `p50` / `p95` / `max` | per-request wall-clock latency | | ||
| | `req/s` | completed requests per second | | ||
| | `xRT` | audio seconds transcribed per wall-clock second | | ||
|
|
||
| Throughput plateauing while latency keeps climbing is the saturation point: | ||
| past it, requests queue on the GPU rather than being served in parallel. | ||
|
|
||
| ## Options | ||
|
|
||
| | flag | purpose | | ||
| | --- | --- | | ||
| | `--concurrency N` | single level (default 1) | | ||
| | `--ramp a,b,c` | sweep several levels in order | | ||
| | `--max-seconds N` | truncate the audio; keeps sweeps short | | ||
| | `--expect WORD` | substring the transcript must contain; `''` disables | | ||
| | `--speech-model` | streaming only, e.g. `universal-3-5-pro` | | ||
| | `--speed N` | streaming send rate vs realtime; `2` sends twice as fast | | ||
| | `--show-transcript` | print a sample transcript; off by default (see below) | | ||
| | `--open-timeout N` | WebSocket handshake wait, default 300s for cold starts | | ||
| | `--stop-on-failure` | end a ramp at the first level that fails | | ||
|
|
||
| Exit status is non-zero if any level had a failure, so it works as a CI gate. | ||
|
|
||
| Transcripts are not printed by default. They are produced from whatever audio | ||
| you submit and can contain personal data, which you generally do not want in CI | ||
| logs. Correctness is still enforced without them: `--expect` fails the run if | ||
| the expected substring is missing, and the summary reports word and character | ||
| counts. Pass `--show-transcript` when you want to eyeball the text — it is | ||
| truncated and newline-collapsed so untrusted output cannot forge log lines. | ||
|
|
||
| ## Interpreting Modal results | ||
|
|
||
| - **The first request after idle is a cold start** and is not a latency | ||
| measurement. On sync that was ~168 s wall against ~1.8 s of server time. Warm | ||
| the endpoint first, or discard the first level. | ||
| - **A burst shorter than a cold start does not autoscale.** Modal cannot bring | ||
| up a second GPU container within a short ramp, so a sweep measures *one* | ||
| container's capacity — which is what you want when sizing a replica. | ||
| - **Streaming sessions are realtime-paced by default**, so a level takes at | ||
| least the audio's duration. Use `--max-seconds` to keep sweeps short. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] Only true for sync. In streaming mode the summary carries
first_turn_sand turn count, not words; the character count is what both modes print. (The rest of this README verified clean against the script: the options table matches the argparse definitions exactly, including defaults, and the exit-status claim matchesmain().)