mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2109] [CLOSED] --batch: request priority (a free slot and the next prompt read go to the highest priority waiting) #3864
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3864
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2109
Author: @brocktice
Created: 10/12/2026
Status: ❌ Closed
Base:
main← Head:request-priority📝 Commits (1)
90492a1--batch: a request's "priority" orders the waiting (a free slot and the next prompt read go to the highest; a long read gives way to a higher one)📊 Changes
3 files changed (+132 additions, -22 deletions)
View changed files
📝
docs/BATCHING.md(+5 -0)📝
serve/server.py(+45 -16)📝
serve/test_parallel.py(+82 -6)📄 Description
Why
We serve Qwen3.8-Flash-Next IQ3_S on two RTX PRO 6000 (one engine per card,
parallel: 4,--batch-mtp, all experts in VRAM) to several clients at once: an interactive coding agent, a log-alert summarizer that must answer within seconds, and an evaluation battery that sends thousands of requests a day.With first-come-first-served waiting, a burst of battery requests filled all 8 slots and the alert summarizer queued behind it, so its calls timed out and our monitoring paged us. More slots don't fix it, because a burst can always fill them. Under SGLang we used
--enable-priority-scheduling(a per-requestpriority), and we lost that when we moved to Strata.We've been running the same idea in a router in front of Strata for several days. The alert summarizer's slowest call over a full day was 4.6 s (1,210 calls) while the battery kept 8 requests in flight. This PR moves it into the server, where it can see the slots and the #656 give-way path.
What it does
"priority"in the request body is an integer, higher goes first. It's the same field SGLang and vLLM read, so gateways like LiteLLM already pass it through. If the field is absent or not an integer, it counts as 0.With
--batch:YIELDS_MAXstill caps how often a read gives way.With every request at 0, all checks reduce to the existing code paths.
Deadlock note: requests waiting for a slot never hold back the control lines. A read that gave way holds a slot and needs the lines to continue and free that slot, whatever its priority; otherwise long/long/short with mixed priorities would deadlock (the ENGINE_REVIEW finding 1 shape). A request that gave way and is letting others go first (
after_epoch) also doesn't outrank anyone until its epoch passes.Not covered: the single-request path without
--batch(the server'sfifolock). That lock is shared with the vision encoder and settings changes, so changing it seemed like a separate discussion.Tests
New tests in
serve/test_parallel.py, using the existing fake engine:test_a_free_slot_goes_to_the_highest_priority_waiting: both slots busy, a priority-0 request waits, then a priority-5 one arrives; the first free slot goes to the priority-5 request.test_a_long_read_gives_way_to_a_higher_priority: two prompts of the same length; the later, higher-priority one makes the first read give way.test_no_way_given_to_a_lower_priority: a short priority-0 prompt does not make a priority-5 read give way.Priority.test_request_priorityandtest_outranked_skips_a_request_letting_others_go_first(unit).All three service tests fail on
main(checked three times each) and pass with the change.serve/test_parallel.pypassed 5 runs in a row. The fullserve/suite passes excepttest_responses.NoLeakedSampler.test_server_close_ends_the_sampler, which also fails on unmodifiedmainin 2 of 3 runs here (a sampler thread from an earlier test is still shutting down).Real engine: v0.1.43 on one RTX PRO 6000 (Blackwell), Qwen3.8-Flash-Next IQ3_S,
parallel: 4,--batch-mtp. The same request mix was run with and without the field:No errors; every request finished.
docs/BATCHING.mdhas a short paragraph describing the behavior.Happy to change the shape: a config default per API key,
/metricswaiting counts per priority, or the non-batch path.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.