Skip to content

[BugFix] Fix inaccurate cache hit rate and TTFT after request preemption#6620

Open
liyonghua0910 wants to merge 2 commits intoPaddlePaddle:developfrom
liyonghua0910:develop+rescheduled_flag_0302
Open

[BugFix] Fix inaccurate cache hit rate and TTFT after request preemption#6620
liyonghua0910 wants to merge 2 commits intoPaddlePaddle:developfrom
liyonghua0910:develop+rescheduled_flag_0302

Conversation

@liyonghua0910
Copy link
Collaborator

@liyonghua0910 liyonghua0910 commented Mar 3, 2026

Motivation

修复请求被抢占后缓存命中率和 TTFT(Time to First Token)日志打印不准确的问题。

Modifications

  • Request 类新增 has_been_preempted_before 标志,表示请求是否有被抢占过(发生重调度)
  • RequestMetrics 类新增 preempted_count 计数,表示请求被抢占的次数
  • 仅对首次被调度的请求记录 INFERENCE_START 事件,重调度的请求记为 RESCHEDULE_INFERENCE_START 事件
  • 只对首次被调度的请求记录缓存命中率指标,重调度的请求的缓存命中情况不作为请求最终指标

Usage or Command

Accuracy Tests

Checklist

  • Add at least a tag in the PR title.
    • Tag list: [[FDConfig],[APIServer],[Engine], [Scheduler], [PD Disaggregation], [Executor], [Graph Optimization], [Speculative Decoding], [RL], [Models], [Quantization], [Loader], [OP], [KVCache], [DataProcessor], [BugFix], [Docs], [CI], [Optimization], [Feature], [Benchmark], [Others], [XPU], [HPU], [GCU], [DCU], [Iluvatar], [Metax]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Please write the reason in this PR if no unit tests.
  • Provide accuracy results.
  • If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

@paddle-bot
Copy link

paddle-bot bot commented Mar 3, 2026

Thanks for your contribution!

@liyonghua0910 liyonghua0910 changed the title [Others] add has_been_rescheduled flag for requests [BugFix] Fix inaccurate cache hit rate and TTFT after request preemption Mar 3, 2026
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 48.64865% with 19 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@fa21fd9). Learn more about missing BASE report.

Files with missing lines Patch % Lines
fastdeploy/engine/common_engine.py 0.00% 18 Missing ⚠️
fastdeploy/engine/sched/resource_manager_v1.py 93.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #6620   +/-   ##
==========================================
  Coverage           ?   71.61%           
==========================================
  Files              ?      394           
  Lines              ?    53963           
  Branches           ?     8469           
==========================================
  Hits               ?    38647           
  Misses             ?    12532           
  Partials           ?     2784           
Flag Coverage Δ
GPU 71.61% <48.64%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

3 participants