[MP][Debuggability] Introduce status report subsystem for MP-mode#2699
[MP][Debuggability] Introduce status report subsystem for MP-mode#2699ApostaC merged 6 commits intoLMCache:devfrom
Conversation
Signed-off-by: ApostaC <yihua98@uchicago.edu>
Signed-off-by: ApostaC <yihua98@uchicago.edu>
Signed-off-by: ApostaC <yihua98@uchicago.edu>
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 introduces a comprehensive status reporting subsystem for MP-mode components, enhancing debuggability and introspection. It provides a structured way to monitor the health and performance of various components through a new HTTP endpoint and a CLI tool, facilitating easier diagnosis of issues in the multi-tier storage pipeline. 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 introduces a comprehensive status reporting subsystem, a valuable addition for debuggability and introspection of the multi-process cache components. The implementation is well-designed, utilizing a composable report_status() interface and shadow counters, and the changes are well-tested. However, a critical security concern has been identified: the new /api/status endpoint exposes sensitive internal state without any authentication or authorization, which could lead to information exposure or potential denial of service if the service is exposed to untrusted networks. Additionally, there is a minor suggestion to improve the robustness of the mp_status_viewer CLI tool.
|
TODO:
|
|
@maobaolong Please feel free to take a look at this and leave your thoughts. It's the health check functionality for multi-process mode. |
| status["cb_registered_gpu_ids"] = list(self._cb_gpu_contexts.keys()) | ||
| status["cb_gpu_context_meta"] = { | ||
| str(gpu_id): {"model_name": meta[0], "world_size": meta[1]} | ||
| for gpu_id, meta in self._cb_gpu_context_meta.items() |
There was a problem hiding this comment.
if you modify the gpu context here you probably need to lock it up?
| "registered_gpu_ids": list(self.gpu_contexts.keys()), | ||
| "gpu_context_meta": { | ||
| str(gpu_id): {"model_name": meta[0], "world_size": meta[1]} | ||
| for gpu_id, meta in self.gpu_context_meta.items() |
There was a problem hiding this comment.
same comment here, gpu_context needs protection?
There was a problem hiding this comment.
@ApostaC is this lock not needed? like a CacheContext lock
sammshen
left a comment
There was a problem hiding this comment.
lgtm, just a small lock comment
maobaolong
left a comment
There was a problem hiding this comment.
@ApostaC This looks great!
Just suggest to rename and set http server as default behavior, otherwise, LGTM.
Never mind to merge this PR first. A bundle of features base on this will come soon.
…Cache#2699) * [Add] status report * [Add] tool to report status Signed-off-by: ApostaC <yihua98@uchicago.edu> Signed-off-by: shaoxiawjc <wjc2800@163.com>
…Cache#2699) * [Add] status report * [Add] tool to report status Signed-off-by: ApostaC <yihua98@uchicago.edu> Signed-off-by: Aaron Wu <aaron.wu@dell.com>
…Cache#2699) * [Add] status report * [Add] tool to report status Signed-off-by: ApostaC <yihua98@uchicago.edu>
…Cache#2699) * [Add] status report * [Add] tool to report status Signed-off-by: ApostaC <yihua98@uchicago.edu>
What this PR does / why we need it:
Adds a composable
report_status() -> dictinterface across all MP-mode components for production debugging and introspection. Currently the only introspection tools arememcheck()(returns bool) anddebug()(returns "OK"), which are insufficient for diagnosing issues in the multi-tier storage pipeline.Each component implements
report_status()returning a dict withis_healthy: boolplus component-specific metrics. Parents aggregate children's reports as nested dicts, with health propagating upward (any unhealthy child → parent unhealthy).Components instrumented (bottom-up):
New HTTP endpoint:
GET /api/statusreturns the full JSON status tree.New CLI tool:
python -m lmcache.tools.mp_status_viewer [--url URL] [--json]fetches and pretty-prints the status.Leaf helpers:
TokenHasher.hash_algorithm_name,SessionManager.active_count()Usage example:
Screenshot

Special notes for your reviewers:
report_status()uses the existing@l1_mgr_synchronizeddecorator and iterates_objectscheckingTTLLock.is_locked()per entry. This is O(n) but the endpoint is called infrequently (debug use).urllib.request,json) — norequestsorrichdependency.If applicable: