[PR #753] [CLOSED] serve: isolate concurrent request metrics (depends on #559) #2808

Closed
opened 2026-11-04 02:03:15 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/753
Author: @zengyishou
Created: 10/4/2026
Status: ❌ Closed

Base: main ← Head: fix/batch-request-metrics


📝 Commits (10+)

  • 6f21f22 CS-T: the partial pin of the RAM tier opt-in (STRATA_PARTIAL_PIN=1)
  • c4175bd Merge branch 'f-q4-on242' into r131-final
  • f6c18ff docs: Unsloth UD-Q4_K_XL manual import (docs/UNSLOTH_Q4.md); DETAILS: the mapped mode without experts.bin, --resident-budget-gib, the tier counters
  • 652437b Merge branch 'f-q4-on242' into r131-final
  • 9259cad Engine 0.1.31: Unsloth UD-Q4_K_XL runs on a 64 GB PC (experimental: split GGUF, Q4_K/Q5_K/Q5_1/Q8_0 experts, RAM budget + SSD tier with routing prefetch), the low-RAM mode reads GGUF experts in place, Windows GGUF load 2x (#230), server status race (#266) and tokenizer (#268) fixes, truncated tool calls (#211/#231), AMD intrinsics (#262); setup requires it
  • 3fb00c1 HIP (S6): RDNA4 matrix-core prompt attention for int8 KV, opt-in (STRATA_HIP_WMMA=1, gfx12 only)
  • 648ab7f HIP (S6): router_top10 without its serial parts on AMD, bitwise the same (default on HIP; STRATA_HIP_ROUTER_OLD=1: old)
  • 78700ca HIP (S6): router_top10.cu - drop a nested #if that left the HIP block unterminated
  • ad48d5c diagnostics: STRATA_DUMP_FIRST_LOGITS writes the first generated token's logits
  • e095f12 Start: name the GPU and stop at once when the build has no code for it; STRATA_EMULATE_CC for tests

📊 Changes

5 files changed (+975 additions, -116 deletions)

View changed files

➕ docs/REQUEST_METRICS.md (+86 -0)
➕ serve/request_stats.py (+195 -0)
📝 serve/server.py (+262 -108)
➕ serve/test_request_stats.py (+418 -0)
📝 serve/web/app.js (+14 -8)

📄 Description

Dependency and review scope

Draft: blocked on #559. Do not merge before #559. This branch is based on #559 head f65301b3bfc621229c7d5ddb1e268f652be43a59. Because GitHub can only target an existing branch in this repository, the current comparison against main also includes #559's unmerged changes. The contribution from this PR is the final single commit only; after #559 lands this branch must be rebased and the diff rechecked before marking ready.

Review the isolated increment here: incremental diff. The same increment is also proposed directly to #559's author in the focused companion PR. These are alternative review routes for the same change, not patches to apply twice.

Summary

Follow-up to Niko1221/Strata#559, prepared on its multi-sequence-batching branch. Concurrent requests currently share the engine's last protocol result and mutable live status. One completion can overwrite another request's counters or clear its activity.

Bind content-free protocol collectors to each generation iterator operation, distinguish admission DONE from full BDONE, and aggregate continuation segments without double-counting input. Keep request-owned live status, monotonically bucket output rates, and correlate request IDs across HTTP and metric records. Bind delayed slot drains to their original queue and generation; preserve control ownership through cancellation and rejection.

This PR does not introduce the batch engine into main and does not include snapshot, ROCm allocation, or fatal-timeout changes. Existing optional API-monitor behavior is unchanged; the new metric collector retains no prompt or answer content.

Validation

Nineteen deterministic regressions cover seven-way reverse completion, interleaved protocol events, admission errors, cancellation, buffered completion, late drains, iterator context isolation and both API dialects. Tests use synthetic inputs and clocks, not private workloads or GPU-performance estimates.

Full server suite on macOS/Python 3.12: 222 tests run, 215 passed and 7 skipped. All 25 request-accounting and Prometheus tests passed; JavaScript syntax and diff whitespace checks passed. The existing Prometheus running gauge and per-request latency histograms are preserved.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/753 **Author:** [@zengyishou](https://github.com/zengyishou) **Created:** 10/4/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/batch-request-metrics` --- ### 📝 Commits (10+) - [`6f21f22`](https://github.com/Niko1221/Strata/commit/6f21f2243aeea39a4e127d932a0a840a0c22aefb) CS-T: the partial pin of the RAM tier opt-in (STRATA_PARTIAL_PIN=1) - [`c4175bd`](https://github.com/Niko1221/Strata/commit/c4175bdb20b94626dcd3ee4dcfb24c5b1cec7503) Merge branch 'f-q4-on242' into r131-final - [`f6c18ff`](https://github.com/Niko1221/Strata/commit/f6c18ff90caf7b7d9a25ac4cc4abcb76c50e4155) docs: Unsloth UD-Q4_K_XL manual import (docs/UNSLOTH_Q4.md); DETAILS: the mapped mode without experts.bin, --resident-budget-gib, the tier counters - [`652437b`](https://github.com/Niko1221/Strata/commit/652437b792975577a3b9975b3040fb783d6e6a06) Merge branch 'f-q4-on242' into r131-final - [`9259cad`](https://github.com/Niko1221/Strata/commit/9259cad4cfa3543cd3b8decab5962672b968c649) Engine 0.1.31: Unsloth UD-Q4_K_XL runs on a 64 GB PC (experimental: split GGUF, Q4_K/Q5_K/Q5_1/Q8_0 experts, RAM budget + SSD tier with routing prefetch), the low-RAM mode reads GGUF experts in place, Windows GGUF load 2x (#230), server status race (#266) and tokenizer (#268) fixes, truncated tool calls (#211/#231), AMD intrinsics (#262); setup requires it - [`3fb00c1`](https://github.com/Niko1221/Strata/commit/3fb00c10953893b443354dede6431cad7b0e1198) HIP (S6): RDNA4 matrix-core prompt attention for int8 KV, opt-in (STRATA_HIP_WMMA=1, gfx12 only) - [`648ab7f`](https://github.com/Niko1221/Strata/commit/648ab7fae358c8885b659c30ce4a1e1682cbd2c2) HIP (S6): router_top10 without its serial parts on AMD, bitwise the same (default on HIP; STRATA_HIP_ROUTER_OLD=1: old) - [`78700ca`](https://github.com/Niko1221/Strata/commit/78700cae5f0ce43d4dd0c9a2dc95e1fc83008205) HIP (S6): router_top10.cu - drop a nested #if that left the HIP block unterminated - [`ad48d5c`](https://github.com/Niko1221/Strata/commit/ad48d5c5ca61d865b2805acb481eabf0df5e6305) diagnostics: STRATA_DUMP_FIRST_LOGITS writes the first generated token's logits - [`e095f12`](https://github.com/Niko1221/Strata/commit/e095f12424f9817bd258493d6c7b981c30a20d05) Start: name the GPU and stop at once when the build has no code for it; STRATA_EMULATE_CC for tests ### 📊 Changes **5 files changed** (+975 additions, -116 deletions) <details> <summary>View changed files</summary> ➕ `docs/REQUEST_METRICS.md` (+86 -0) ➕ `serve/request_stats.py` (+195 -0) 📝 `serve/server.py` (+262 -108) ➕ `serve/test_request_stats.py` (+418 -0) 📝 `serve/web/app.js` (+14 -8) </details> ### 📄 Description ## Dependency and review scope **Draft: blocked on #559. Do not merge before #559.** This branch is based on #559 head `f65301b3bfc621229c7d5ddb1e268f652be43a59`. Because GitHub can only target an existing branch in this repository, the current comparison against `main` also includes #559's unmerged changes. The contribution from this PR is the final single commit only; after #559 lands this branch must be rebased and the diff rechecked before marking ready. Review the isolated increment here: [incremental diff](https://github.com/zengyishou/Strata/compare/f65301b3bfc621229c7d5ddb1e268f652be43a59...fix/batch-request-metrics). The same increment is also proposed directly to #559's author in [the focused companion PR](https://github.com/blange48/Strata/pull/2). These are alternative review routes for the same change, not patches to apply twice. ## Summary Follow-up to Niko1221/Strata#559, prepared on its `multi-sequence-batching` branch. Concurrent requests currently share the engine's last protocol result and mutable live status. One completion can overwrite another request's counters or clear its activity. Bind content-free protocol collectors to each generation iterator operation, distinguish admission DONE from full BDONE, and aggregate continuation segments without double-counting input. Keep request-owned live status, monotonically bucket output rates, and correlate request IDs across HTTP and metric records. Bind delayed slot drains to their original queue and generation; preserve control ownership through cancellation and rejection. This PR does not introduce the batch engine into main and does not include snapshot, ROCm allocation, or fatal-timeout changes. Existing optional API-monitor behavior is unchanged; the new metric collector retains no prompt or answer content. ## Validation Nineteen deterministic regressions cover seven-way reverse completion, interleaved protocol events, admission errors, cancellation, buffered completion, late drains, iterator context isolation and both API dialects. Tests use synthetic inputs and clocks, not private workloads or GPU-performance estimates. Full server suite on macOS/Python 3.12: 222 tests run, 215 passed and 7 skipped. All 25 request-accounting and Prometheus tests passed; JavaScript syntax and diff whitespace checks passed. The existing Prometheus running gauge and per-request latency histograms are preserved. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:03:15 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2808
No description provided.