[Feat][Router] Add Priority routing#852
Conversation
- Implemented PriorityRouter to route requests to the endpoint with the lowest QPS (least loaded). - Updated routing logic options to include 'priority', 'kvaware', 'prefixaware', and 'disaggregated_prefill'. - Enhanced README files to reflect new routing options and their descriptions. - Added unit tests for the PriorityRouter to ensure correct functionality. This change enhances the routing capabilities of the system, allowing for more efficient load balancing based on endpoint performance. Signed-off-by: Ifta Khairul Alam Adil <ikaadil007@gmail.com>
Signed-off-by: Ifta Khairul Alam Adil <ikaadil007@gmail.com>
Summary of ChangesHello @ikaadil, 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 significant enhancement to the router's load balancing capabilities by implementing a new 'priority' routing logic. This logic intelligently distributes requests to the least-loaded backend servers based on their current Queries Per Second (QPS), aiming to optimize resource utilization and improve overall system responsiveness. The change includes the core implementation of the new router, its integration into the existing routing framework, and comprehensive updates to documentation and configuration options to make it accessible and understandable. 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
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 new priority-based routing logic that directs requests to the least loaded endpoint based on its QPS. The changes are well-structured, including the core routing logic, corresponding tests, and updates to documentation. I've identified a potential issue where an empty list of endpoints could cause a runtime error, and I've also suggested a couple of minor improvements for the new test file to enhance its robustness and readability.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: Ifta khairul Alam Adil <25082512+ikaadil@users.noreply.github.com>
Updated the PriorityRouter to raise a ValueError when no available endpoints are found after attempting to route based on QPS. This change improves error handling and ensures that routing failures are explicitly communicated. Signed-off-by: Ifta Khairul Alam Adil <ikaadil007@gmail.com>
Modified the test case to assert that the routed URL is specifically http://a instead of checking for multiple valid URLs. This change ensures that the routing logic is tested for a precise outcome, improving the accuracy of the test. Signed-off-by: Ifta Khairul Alam Adil <ikaadil007@gmail.com>
ruizhang0101
left a comment
There was a problem hiding this comment.
Hi, thanks for the PR. I think the qps routing is semantically different from the priority routing. In terms of the priority routing, could you elaborate the use case of this routing given that vllm itself has priority mechanism.
Thanks for the review. Here’s a short clarification on semantics and use case. 1. QPS vs “priority” (semantics) 2. Use case vs vLLM’s priority
So they’re complementary: the router decides which instance gets the request (this PR: least-loaded by QPS); vLLM then decides order and priority of requests on that instance. The use case is multi-backend deployments where you want to avoid sending more traffic to already-busy instances (e.g. reduce queue depth and latency) instead of blindly round-robinning. I can add this distinction and use case to the PR description and docs, and rename the option to |
|
Hello, I think there is redundancy in the logic between this code and the session handling. During the session invocation process, even if no session ID is specified, it still goes through the _qps_routing method and routes based on QPS. |
|
I believe there is a lack of a routing strategy based on request count. If an abnormal request occurs, it can easily cause the pod to become blocked. |
|
I think there's value in having something like this (essentially just an explicit QPS routing without session keys), simply because this is already the behavior of session-based routing when no session headers are used. I didn't actually know session routing falls back to this. But maybe there's a smarter way to ensure pods don't get blocked, not sure.
@codesun8 this is already the case for session-based routing when going with the QPS fallback, no? |
Adds a new priority routing option that routes requests to the backend with the lowest QPS (least loaded).
Addresses the Q3 roadmap #640
Changes
_qps_routing()to select the least-loaded endpoint.--routing-logic priorityandpriorityin dynamic config and Helm.ValueErrorwhen given no endpoints.Usage
--routing-logic priorityBEFORE SUBMITTING, PLEASE READ THE CHECKLIST BELOW AND FILL IN THE DESCRIPTION ABOVE
-swhen doinggit commit[Bugfix],[Feat], and[CI].Detailed Checklist (Click to Expand)
Thank you for your contribution to production-stack! Before submitting the pull request, please ensure the PR meets the following criteria. This helps us maintain the code quality and improve the efficiency of the review process.
PR Title and Classification
Please try to classify PRs for easy understanding of the type of changes. The PR title is prefixed appropriately to indicate the type of change. Please use one of the following:
[Bugfix]for bug fixes.[CI/Build]for build or continuous integration improvements.[Doc]for documentation fixes and improvements.[Feat]for new features in the cluster (e.g., autoscaling, disaggregated prefill, etc.).[Router]for changes to thevllm_router(e.g., routing algorithm, router observability, etc.).[Misc]for PRs that do not fit the above categories. Please use this sparingly.Note: If the PR spans more than one category, please include all relevant prefixes.
Code Quality
The PR need to meet the following code quality standards:
pre-committo format your code. SeeREADME.mdfor installation.DCO and Signed-off-by
When contributing changes to this project, you must agree to the DCO. Commits must include a
Signed-off-by:header which certifies agreement with the terms of the DCO.Using
-swithgit commitwill automatically add this header.What to Expect for the Reviews
We aim to address all PRs in a timely manner. If no one reviews your PR within 5 days, please @-mention one of YuhanLiu11
, Shaoting-Feng or ApostaC.