mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3492] [Engine] serve: a slot's live view keeps the request's own clocks after it moves from the solo path (elapsed_s, tok_s) #4653
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#4653
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/3492
Author: @andyhrc
Created: 10/20/2026
Status: 🔄 Open
Base:
main← Head:pr/slot-live-clocks📝 Commits (1)
650bfb9serve: a slot's live view keeps the request's own clocks across legs (elapsed_s, tok_s)📊 Changes
2 files changed (+32 additions, -4 deletions)
View changed files
📝
serve/server.py(+11 -4)📝
serve/test_parallel_yield.py(+21 -0)📄 Description
Problem and result
With
--batch, a request that starts alone on the solo path continues in a batch slot when another request arrives.The slot admission then carries the reply so far. Each admission restarted the slot row's clocks in
/metricslive.slots, butgeneratedkept counting the whole reply. As a result:elapsed_sstarted again at 0.tok_swas the whole reply divided by the time in the current leg only. It started thousands of times too high andfell as the leg went on.
The test below, with a fake engine that writes one token per 20 ms (50 tok/s), shows it on current
main. The row ofthe request that moved read:
We first noticed it on our own monitor: right after a move, a request decoding at about 40 tok/s showed 200+ tok/s.
After the change, the row uses the request's own start time and first token, as the server's per-request status
already does.
elapsed_scounts from the request's start, andtok_sis its rate since its first token, whichever legit is in.
Related discussion
#2857 (closed in the 0.2.0-beta reset) asks for one Monitor widget per batch slot, showing that slot's own tok/s and time
in the slot from
live.slots. These are the fields that were wrong after a move. Nothing inapps/reads the per-slottok_s/elapsed_stoday;/metricsconsumers that readlive.slots(ours does) get the wrong numbers.Approach
generate_batchedkeeps two clocks per request: when it began, and its first token, set by the token callback ofwhichever leg delivers it. The slot's live row takes
startedfrom the first andfirst_tokenfrom the second insteadof
time.time()at each admission. There is no other behaviour change:slots_viewcomputes the same formula fromthese fields.
Validation
Passed:
650bfb97onmain5e8a4cca(v0.2.7); the tests below were run on this head, the hardware run on the v0.2.1.3 head1625b9aa(the change is the same; v0.2.7 only adds awant_lpargument to the two_controlcalls it touches), Ubuntu 24.04, Python 3.12 (.venv), AMD EPYC 7543.python -m unittest serve.test_parallel_yield.ParallelServiceYield.test_a_continued_leg_shows_the_requests_own_clockspasses. With v0.2.7's
serve/server.pyit still fails:0.0 not greater than or equal to 0.3, with the rows above.python -m unittest discover -s serve -t .: 1218 tests OK (38 skipped).requirements.txt, thentools/minimal_server_smoke.pyandpython -m unittest discover -s serve -p 'test_*.py'): smoke OK, 1218 tests OK (38 skipped).--batch 6in 3 groups;there it sits on top of our slot PRs #2527/#2528/#2843). A 700-token request ran alone for 3 s, then moved into slot 0
when a second request arrived. Its row read
elapsed_s3.4 -> 4.4 andtok_s57.2 -> 50.9 while the second onedecoded (2026-10-21, on 0.2.1.3). The request's own rate was 700 tokens in 12.5 s.
Failed: None observed.
Not run: a GPU run of
mainwithout the change. The "before" numbers are from the test above and our earlierobservation.
Limits
The clocks are per request. A slot row shows the request's rate since its first token over all of its legs, not the
slot's rate in the current window.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.