-
Notifications
You must be signed in to change notification settings - Fork 549
[Feature] metrics support #3534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
CUHKSZzxy
wants to merge
31
commits into
InternLM:main
Choose a base branch
from
CUHKSZzxy:metrics-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Conflicts: lmdeploy/messages.py lmdeploy/pytorch/engine/engine.py lmdeploy/pytorch/engine/engine_instance.py lmdeploy/pytorch/messages.py lmdeploy/pytorch/paging/scheduler.py
Conflicts: lmdeploy/serve/openai/api_server.py
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Align with vLLM v1 metrics system and beyond. Here are several key alignments
-- Uses
time.perf_counter()
for interval calculations (avoids clock drift issues).-- Gauges: Active requests, cache usage, etc
-- Counters: Token totals, request success / failure counts, etc
-- Histograms: TTFT (Time-To-First-Token), TPOT (Inter-Token Latency), end-to-end latency, etc
-- CLI logging
-- Prometheus
We only record critical timestamps and events during the main loop and scheduling without further processing. Heavy-weight metrics calculations or metrics publishing are put inside separate coroutines to reduce the main engine loop overhead.
TODO
time.perf_counter()
generate()
or engine_async_loop_main()
Expert information collections(maybe deferred in another PR)Usage
Start the server with
--enable-metrics
Metrics Publishing - Logging

With
--enable-metrics
, key metrics (e.g., running / waiting requests, cache usage, token throughput) are printed to the terminal every 5 seconds.Metrics Publishing - Prometheus & Grafana (WIP)
Access metrics via http://localhost:23333/metrics/ , or curl the metrics endpoint as follows:
Performance Impacts
Conclusion:
For details, you may check the following figures. Benchmark settings: 1000 prompts, input len 1000, output len 1000.
Qwen-2.5-7B (TP1), without the metrics.

Qwen-2.5-7B (TP1), with the metrics.

Qwen-2.5-0.5B (TP1), without the metrics.

Qwen-2.5-0.5B (TP1), with the metrics.

Related Issues & PR
Issue 2638, Issue 2673, PR1423