Conversation
Summary of ChangesHello @sufubao, 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 primarily focuses on enhancing the observability and reducing log verbosity within the LightLLM system. By demoting detailed per-request logs to a debug level and introducing a comprehensive 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 significantly improves the logging and system monitoring capabilities. It introduces a SystemStatusReporter that provides a clean, consolidated, and informative view of the system's state, replacing scattered debug logs. The change of many INFO level logs to DEBUG and setting the default log level to INFO is a good practice for production environments. Additionally, the introduction of a progress bar for CUDA graph capturing is a nice user experience enhancement.
My review includes a suggestion to fix a bug in metric reporting where a value was being overwritten in a loop, and another suggestion to improve the design of the new SystemStatusReporter by simplifying its method signatures for better maintainability. Overall, this is a high-quality refactoring.
lightllm/server/router/manager.py
Outdated
| for dp_index in range(self.dp_size_in_node): | ||
| token_ratio1 = self.get_used_tokens(dp_index) / self.max_total_token_num | ||
| token_ratio2 = ( | ||
| self.max_total_token_num | ||
| - self.read_only_statics_mem_manager.get_unrefed_token_num(dp_index) | ||
| ) / self.max_total_token_num | ||
| d_i = dp_index | ||
| frozen_token_num = self.shared_token_load.get_frozened_token_count(d_i) | ||
| estimated_peak_token_count = self.shared_token_load.get_estimated_peak_token_count(d_i) | ||
| paused_req_num = self._get_paused_req_num_in_dp_index(dp_index=d_i) | ||
| logger.debug( | ||
| f"dp_i {d_i} current batch size: {len(self.running_batch.reqs)} \n" | ||
| f"dp_i {d_i} paused req num: {paused_req_num} \n" | ||
| f"dp_i {d_i} frozen token num: {frozen_token_num} \n" | ||
| f"dp_i {d_i} estimated_peak_token_count: {estimated_peak_token_count} \n" | ||
| f"dp_i {d_i} token used ratio: {token_ratio1} not contain prompt cache tree unrefed token\n" | ||
| f"dp_i {d_i} token used ratio: {token_ratio2} contain prompt cache tree unrefed token" | ||
| ) | ||
| paused_req_num = self._get_paused_req_num_in_dp_index(dp_index=dp_index) | ||
| self.metric_client.gauge_set("lightllm_batch_pause_size", paused_req_num) |
There was a problem hiding this comment.
The loop over dp_index repeatedly overwrites the lightllm_batch_pause_size metric. This means only the value for the last dp_index is actually reported, which is likely not the intended behavior.
If the goal is to report the total number of paused requests across all data-parallel ranks, you should calculate the total and set the metric once. You can reuse the existing _get_paused_req_num() method for this, which already calculates the total.
paused_req_num = self._get_paused_req_num()
self.metric_client.gauge_set("lightllm_batch_pause_size", paused_req_num)| def maybe_print( | ||
| self, | ||
| running_batch, | ||
| req_queue, | ||
| read_only_statics_mem_manager, | ||
| paused_req_num=0, | ||
| radix_cache_client=None, | ||
| disable_dynamic_prompt_cache=False, | ||
| ): |
There was a problem hiding this comment.
The maybe_print method has a large number of parameters. Many of these, such as req_queue, read_only_statics_mem_manager, radix_cache_client, and disable_dynamic_prompt_cache, are available when SystemStatusReporter is initialized and seem to be constant throughout its lifetime.
To improve code clarity and maintainability, consider moving these stable dependencies to the __init__ method. This simplifies the maybe_print signature and makes the dependencies of SystemStatusReporter more explicit.
For example, you could modify __init__ to accept these objects and store them as instance attributes. Then maybe_print would only need the parameters that change on each call, like running_batch and paused_req_num.
- Fix typo 'recive' -> 'receive' in router manager - Uppercase 'mtp' -> 'MTP' in status line for consistency - Only show MTP metric when MTP is actually active - Remove dead code: log_time_ready and unused time import - Add file handler to status logger when LIGHTLLM_LOG_DIR is set - Warn when log_stats_interval is below 5s minimum
The loop over dp_index was repeatedly overwriting the same lightllm_batch_pause_size metric, so only the last dp_index value was reported. Use _get_paused_req_num() which sums across all dp indices.
No description provided.