Skip to content

feat(server): split the time before the queue in the timings report - #932

Draft
RaunakGengiti2725 wants to merge 1 commit into
FlashML-org:mainfrom
RaunakGengiti2725:pr/timings-split
Draft

RaunakGengiti2725 wants to merge 1 commit into
FlashML-org:mainfrom
RaunakGengiti2725:pr/timings-split

Conversation

@RaunakGengiti2725

@RaunakGengiti2725 RaunakGengiti2725 commented Nov 20, 2026 •

Copy link
Copy Markdown

Closes #939.

The timings block (--enable-timings-report) starts at admission, so time before the waiting queue went unreported. Chat completions now carry consecutive spans: parse_ms (arrival to the handler), render_ms (the handler up to submit; on a stream it holds the chat template pre-check), to_worker_ms, tokenize_ms (the worker's template render and encode), to_scheduler_ms and admit_ms. A stream adds reply_ms, from the first sampled token to its first piece of text. Report only; without the flag nothing is stamped.

A/B against main 2fb371e. RTX 5090 (575 W), AMD EPYC 9354, driver 615.71.09, nvidia/Qwen3.6-35B-A3B-NVFP4. One interleaved run, 2 rounds, order reversed. Both arms: ft serve --model nvidia/Qwen3.6-35B-A3B-NVFP4 --enable-timings-report --moe-strategy fused --max-running-requests 1 --speculative-algorithm mtp --speculative-num-steps 3. Unique streamed chat prompts of 128 to 32,768 tokens, greedy, 128-token replies; client first token, median of 6 (4 at 32,768).

prompt tokens main ms this PR ms
128 64.0 64.6
1,024 68.0 68.1
8,192 328.4 324.8
32,768 1,632.8 1,633.2

No change beyond noise; replies 32/32 equal main's. 8,192-token spans, median ms: parse 0.89, render 0.88, to_worker 0.53, tokenize 36.42, to_scheduler 0.61, admit 0.02; reply 2.11. Non-streamed requests: not measured on main yet.

Tests (no GPU). tests/server/test_generation_accounting.py::test_timings_split_the_time_before_the_queue_across_the_processes fails if the tokenizer worker drops its two stamps, timings_block stops copying the spans, or a span is renamed. tests/server/test_openai_api.py::test_chat_completion_stamps_the_message_only_under_the_flag fails if the handler stops stamping or stamps without the flag; tests/scheduler/test_scheduler_chunked_prefill.py::test_chunked_reqs_share_one_stats_stamped_at_the_first_chunk fails if the waiting queue drops the stamps; tests/scheduler/test_cost_accounting_core.py::test_scheduler_stamps_the_receipt_on_an_admitted_user_msg fails without the scheduler's receipt stamp. The arrival middleware and reply_ms: A/B only.

Tested on real hardware by me.

Under --enable-timings-report a chat completion's timings gain parse_ms,
render_ms, to_worker_ms, tokenize_ms, to_scheduler_ms and admit_ms, the
spans from the request's arrival to the waiting queue, stamped in the API
server, the tokenizer worker and the scheduler. A stream also reports
reply_ms, from the first sampled token to its first piece of text.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Report the time a request spends before the waiting queue in the timings block

1 participant