[PR #1933] [CLOSED] serve: aggregate batch request timings #3763

Closed
opened 2026-11-07 15:30:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1933
Author: @constantindjonkam
Created: 10/11/2026
Status: ❌ Closed

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


📝 Commits (1)

  • a2c1599 serve: aggregate batch request timings

📊 Changes

2 files changed (+143 additions, -34 deletions)

View changed files

📝 serve/server.py (+121 -33)
📝 serve/test_server.py (+22 -1)

📄 Description

What this fixes

A request that moves through solo generation, batch admission, batch windows, and possibly back to solo was reporting only the final native segment. This produced inflated prompt rates and single-step decode rates for concurrent requests.

This change:

  • accumulates prompt/decode clocks and native counters across all DONE/BDONE phases of one API request;
  • avoids double-counting the batch admission token when BDONE's generated count includes it;
  • accounts for a queued BDONE when a stop token/string closes the generator;
  • derives timings.prompt_n and Prometheus prompt totals from the engine's prompt_read field when available;
  • adds regression coverage for cumulative batch stats and slot-reused prompt timing.

Fixes the behavior described in issues #1869 and #1870.

Validation

  • python -m py_compile serve/server.py
  • python -m unittest serve.test_server.BatchRequestStats serve.test_request_accounting -v
  • python -m unittest serve.test_parallel -v
  • python -m unittest discover -s serve -p 'test_*.py' -q (692 tests; one existing order-sensitive sampler-thread test was flaky in the full run and passed in isolation)

🔄 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/1933 **Author:** [@constantindjonkam](https://github.com/constantindjonkam) **Created:** 10/11/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/batch-request-timings` --- ### 📝 Commits (1) - [`a2c1599`](https://github.com/Niko1221/Strata/commit/a2c1599f6684cde4135ebef8fa81d5ebbd0fa8b5) serve: aggregate batch request timings ### 📊 Changes **2 files changed** (+143 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `serve/server.py` (+121 -33) 📝 `serve/test_server.py` (+22 -1) </details> ### 📄 Description ## What this fixes A request that moves through solo generation, batch admission, batch windows, and possibly back to solo was reporting only the final native segment. This produced inflated prompt rates and single-step decode rates for concurrent requests. This change: - accumulates prompt/decode clocks and native counters across all DONE/BDONE phases of one API request; - avoids double-counting the batch admission token when BDONE's generated count includes it; - accounts for a queued BDONE when a stop token/string closes the generator; - derives `timings.prompt_n` and Prometheus prompt totals from the engine's `prompt_read` field when available; - adds regression coverage for cumulative batch stats and slot-reused prompt timing. Fixes the behavior described in issues #1869 and #1870. ## Validation - `python -m py_compile serve/server.py` - `python -m unittest serve.test_server.BatchRequestStats serve.test_request_accounting -v` - `python -m unittest serve.test_parallel -v` - `python -m unittest discover -s serve -p 'test_*.py' -q` (692 tests; one existing order-sensitive sampler-thread test was flaky in the full run and passed in isolation) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:30:35 +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#3763
No description provided.