mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4724] [Engine] batch mode: per-request hit_rate/pcie_share are always null — BDONE carries no hits/lookups #2162
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#2162
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?
Originally created by @xiguan99 on GitHub (Oct 30, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4724
Environment
--serve --batch 2 --mtp --max-context 262144 --kv-resident 16384/v1(stream and non-stream)What I see
With
--batch, every request record thatserve/server.pykeeps inhistory(and therefore everythingGET /metricsreturns underrequests[]) hashit_rate: nullandpcie_share: null, while the rest of the row is correct:14 out of 14 requests in one session were like this — not an occasional miss.
The engine does have the numbers: it prints them at the end of every request, e.g.
(these counters are cumulative since engine start, which is why the percentages look right while the per-request figures are missing).
Why (static, then confirmed at runtime)
DONEline carries them —f[9]/f[10]arehits/lookups,f[15]isoffloaded— and_parse_done()reads exactly those.BDONE <slot> <produced> <finish> <ms>(format string in the 0.1.52 binary:BDONE %d %lld %s %.1f). There is no hits/lookups field in it.serve/server.py_apply_bdone()merges onlyfinish,decode_msandgeneratedinto the request's figures, andrequest_stats()sumshits/lookupsonly when some segment actually carries them. So for a batched requestlastnever haslookups, and the history row'shit_rate = round(last["hits"] / last["lookups"], 3) if last.get("lookups") else Noneis
Noneby construction. Same forpcie_share(offloaded).So this is not the GUI merge problem from #4289 — even after that is fixed there is nothing for a batched request to display. #1933 aggregated clocks and counters across
DONE/BDONE, but the expert-cache counters were not part of it.What I suggest
Extend
BDONEwith the same three counters and total them like the clocks:_apply_bdone(), add them to the request'slastthe waygenerated/decode_msare added (sum over the request'sBDONEsegments, asrequest_stats()already does for the clock keys);nonfinitevariant (BDONE %d %lld nonfinite %.1f) still parse;pcie_shareneedsoffloaded(present since engine 0.1.39 inDONE), so it can ride along as the last field.Per-request decode hit rate is the number people actually use to decide
--kv-residentand expert-cache size, and right now--batchusers can only get it from the log line, by differencing a global counter.Workaround in the meantime
We parse the per-request log summary above and difference consecutive lines to get a single request's hit rate. That works, but it is a log-format dependency, it is ambiguous when two requests share a window (no slot attribution), and it breaks when the engine restarts and the counters reset — so a real field in the API would be much better.
Related: #4289, #1933, #588.