Skip to content
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

Enhance cache service metrics #13

Merged
merged 11 commits into from
Dec 23, 2024

Conversation

happyandslow
Copy link
Collaborator

No description provided.

Copy link

👋 Hi! Thank you for contributing to the vLLM project.
Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can do one of these:

  • Add ready label to the PR
  • Enable auto-merge.

🚀

change cache metrics to maintain fixed-sized queue

Adding metrics to llm engine stats and exposed through prometheus gauge

Adding metrics to llm engine stats and exposed through prometheus gauge

clear metrics counters upon update
@happyandslow happyandslow force-pushed the lexu/measurement-flags branch from f93fa67 to bc4f074 Compare November 28, 2024 01:09
@Jeffwan
Copy link

Jeffwan commented Dec 2, 2024

@happyandslow please help address comments as well. We need to ack reviewer's comments.

@@ -190,6 +190,89 @@ def __init__(self, labelnames: List[str], max_model_len: int):
labelnames=labelnames,
multiprocess_mode="sum",
)

self.gauge_cache_service_tokens_hit_rate = self._gauge_cls(
name="vllm:gauge_cache_service_tokens_hit_rate",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the naming is kind of inconsistent here. Other metric string doesn't include the metric type. for example, "vllm:gauge_cache_service_tokens_hit_rate" -> "vllm:cache_service_tokens_hit_rate"

can you update the name to be consistent?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check existing metrics names -- all metrics start with the metrics types they use (e.g., line vllm-project#81 self.gauge_gpu_prefix_cache_hit_rate = self._gauge_cls(...)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@Jeffwan
Copy link

Jeffwan commented Dec 16, 2024

@happyandslow Could you look at the review comments? Seems the new commit didn't address them.

Copy link

@Jeffwan Jeffwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks good to me. Let's merge it and run some testing

self.cache_service_metrics.time_load.clear()
self.cache_service_metrics.time_reshape.clear()
self.cache_service_metrics.time_unload.clear()
self.cache_service_metrics.time_update.clear()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simply swap the corresponding lists, e.g., cache_service_time_query (initially empty) with self.cache_service_metrics.time_query, instead of of copying the whole list of elements?

duration = copy_start.elapsed_time(copy_end) / 1000.0
self.metrics.add_time_unload(duration)

torch.cuda.synchronize()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this torch.cuda.synchronize() being used to measure execution time accurately, or is it intended as a synchronization barrier between the copy_ and reshape_and_cache_flash?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of feel this is redundant.

@Jeffwan Jeffwan merged commit 8d34fa4 into feat/distributed-kv-cache Dec 23, 2024
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.

4 participants