[MP]: Support delay start heartbeat thread to avoid unhealthy while start vllm for a huge module warmup.#2798
Conversation
…tart vllm for a huge module warmup. Signed-off-by: baoloongmao <baoloongmao@tencent.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the initialization of the heartbeat thread within the LMCache vLLM integration adapters. By delaying the start of the heartbeat mechanism until vLLM is fully initialized and ready to serve requests, it addresses issues where the system might be marked as unhealthy prematurely during long model warmup phases. This change improves the robustness and reliability of the LMCache server's health monitoring, especially when dealing with large language models. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request aims to delay the start of the heartbeat thread to prevent the system from being marked as unhealthy during long vLLM warmups. The approach of lazily starting the thread is sound. However, I've identified a couple of race conditions in the implementation of the lazy initialization logic for the heartbeat threads in both LMCacheMPSchedulerAdapter and LMCacheMPWorkerAdapter. These could lead to multiple heartbeat threads being started if the initialization methods are called concurrently. I've provided suggestions to make these methods thread-safe using a lock. Additionally, I've pointed out a minor style regression where a modern f-string was replaced with older %-style formatting.
Signed-off-by: baoloongmao <baoloongmao@tencent.com>
…tart vllm for a huge module warmup. (LMCache#2798) * [MP]: Support delay start heartbeat thread to avoid unhealthy while start vllm for a huge module warmup. Signed-off-by: baoloongmao <baoloongmao@tencent.com>
…tart vllm for a huge module warmup. (LMCache#2798) * [MP]: Support delay start heartbeat thread to avoid unhealthy while start vllm for a huge module warmup. Signed-off-by: baoloongmao <baoloongmao@tencent.com> Signed-off-by: Aaron Wu <aaron.wu@dell.com>
…tart vllm for a huge module warmup. (LMCache#2798) * [MP]: Support delay start heartbeat thread to avoid unhealthy while start vllm for a huge module warmup. Signed-off-by: baoloongmao <baoloongmao@tencent.com>
…tart vllm for a huge module warmup. (LMCache#2798) * [MP]: Support delay start heartbeat thread to avoid unhealthy while start vllm for a huge module warmup. Signed-off-by: baoloongmao <baoloongmao@tencent.com>
…tart vllm for a huge module warmup. (LMCache#2798) * [MP]: Support delay start heartbeat thread to avoid unhealthy while start vllm for a huge module warmup. Signed-off-by: baoloongmao <baoloongmao@tencent.com>
…tart vllm for a huge module warmup. (LMCache#2798) * [MP]: Support delay start heartbeat thread to avoid unhealthy while start vllm for a huge module warmup. Signed-off-by: baoloongmao <baoloongmao@tencent.com>
…tart vllm for a huge module warmup. (LMCache#2798) * [MP]: Support delay start heartbeat thread to avoid unhealthy while start vllm for a huge module warmup. Signed-off-by: baoloongmao <baoloongmao@tencent.com>
What this PR does / why we need it:
sequenceDiagram participant V as vLLM Engine participant W as WorkerAdapter participant H as HeartbeatThread participant S as LMCache Server Note over V: Model loading + DeepGEMM warmup (~5min) V->>W: __init__() Note over W: Heartbeat NOT started yet.<br/>No PING, no false alarms. V->>W: register_kv_caches() W->>S: REGISTER_KV_CACHE S-->>W: OK W->>H: _start_heartbeat() Note over H: Heartbeat begins (double-checked locking) loop Every 10s H->>S: PING S-->>H: PONG → healthy ✅ end Note over S: 💥 Server crashes H->>S: PING (timeout) Note over H: unhealthy → entering degraded mode Note over S: 🔄 Server recovers H->>S: PING S-->>H: PONG Note over H: healthy again → resuming normal operation ✅Special notes for your reviewers:
If applicable: