Skip to content

[Cherry-Pick] [BugFix] Fix inaccurate cache hit rate and TTFT after request preemption#6626

Open
liyonghua0910 wants to merge 3 commits intoPaddlePaddle:release/2.5from
liyonghua0910:release/2.5+fix_preempted_metrics_0303
Open

[Cherry-Pick] [BugFix] Fix inaccurate cache hit rate and TTFT after request preemption#6626
liyonghua0910 wants to merge 3 commits intoPaddlePaddle:release/2.5from
liyonghua0910:release/2.5+fix_preempted_metrics_0303

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!

@codecov-commenter
Copy link

codecov-commenter commented Mar 3, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 19 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/2.5@5c9017b). 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               @@
##             release/2.5    #6626   +/-   ##
==============================================
  Coverage               ?   68.37%           
==============================================
  Files                  ?      391           
  Lines                  ?    52997           
  Branches               ?     8262           
==============================================
  Hits                   ?    36238           
  Misses                 ?    14117           
  Partials               ?     2642           
Flag Coverage Δ
GPU 68.37% <50.00%> (?)

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.

2 participants