-
Notifications
You must be signed in to change notification settings - Fork 100
Implement Cross-Cluster Rate Limiting in Gateway #692
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
Comments
Great addition to the project! A few comments:
|
This will help abstract the underlying logic and help modularize the code.
LMK your thoughts |
Hey, A few questions:
Also was wondering, which rate limiting algorithm are you considering for this? From my previous research, the token bucket algorithm seems like it suites good for this use case |
@andythsu
I don't seem to understand how this would work. Wouldn't the "state" need to be the same for everyone? How will you make this customisable? Also, does this approach expand towards a system similar to the routing rule system where limitations can use cached items as parameters? Perhaps after @vishalya will add some sort of flow / pseudocode it will be clearer |
I don't think the "state" needs to be the same for everyone.... eventually you could come up with your own routing rule that decides what to do by looking at the cache. Also, it is impossible to satisfy everyone's requirements in Redis. Some may want a specific format of the key, some may want a different eviction strategy... etc. So I think enforcing the same state for everyone is a bit hard |
how do you plan to make the state customisable then? where will a user configure his cache properties? |
I'm still thinking about it. Do you have any ideas on that? |
Not really :( , we can maybe hold a dedicated Google-meet to further discuss this and the other points above |
Yep. I think as starting point we can start a thread in trino-gateway channel, and then discuss the points during bi-weekly sync meetings. Here's the thread https://trinodb.slack.com/archives/C059KUNPTSP/p1749154145837889 |
|
Thanks for all the feedback, I'll bring these points up in this week's dev sync, and we can dive deeper into our scope and ideas there. |
Here's the architectural diagram for the rate limiting module. We will follow similar structure as Trino's resource groups |
Motivation
The gateway distributes queries across multiple Trino clusters, making it the ideal place to enforce query limits per user or user group. This ensures fair usage and prevents overloading any single cluster.
Enhancement Proposal
1. Central State for Gateway
2. Rate Limiting Configuration
3. Rate Limiting Logic
The text was updated successfully, but these errors were encountered: