-
Notifications
You must be signed in to change notification settings - Fork 108
[controller] Account for max read capacity in quota change #2235
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
base: main
Are you sure you want to change the base?
Changes from 6 commits
2fa8503
c01300a
df9ee0a
54d6f81
af2a50a
4d4c28e
a73e5e1
6e24e2f
7f508fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5709,12 +5709,16 @@ private void internalUpdateStore(String clusterName, String storeName, UpdateSto | |
|
|
||
| if (readQuotaInCU.isPresent()) { | ||
| HelixVeniceClusterResources resources = getHelixVeniceClusterResources(clusterName); | ||
|
|
||
| ZkRoutersClusterManager routersClusterManager = resources.getRoutersClusterManager(); | ||
| int routerCount = routersClusterManager.getLiveRoutersCount(); | ||
|
|
||
| VeniceControllerClusterConfig clusterConfig = getHelixVeniceClusterResources(clusterName).getConfig(); | ||
| int defaultReadQuotaPerRouter = clusterConfig.getDefaultReadQuotaPerRouter(); | ||
|
|
||
| if (Math.max(defaultReadQuotaPerRouter, routerCount * defaultReadQuotaPerRouter) < readQuotaInCU.get()) { | ||
| long maxRouterReadCapacityCu = clusterConfig.getMaxRouterReadCapacityCu(); | ||
| long maxPerRouterCapacity = Math.max(defaultReadQuotaPerRouter, maxRouterReadCapacityCu); | ||
| long totalClusterCapacity = maxPerRouterCapacity * routerCount; | ||
| if (Math.max(totalClusterCapacity, maxPerRouterCapacity) < readQuotaInCU.get()) { | ||
|
||
| throw new VeniceException( | ||
| "Cannot update read quota for store " + storeName + " in cluster " + clusterName + ". Read quota " | ||
| + readQuotaInCU.get() + " requested is more than the cluster quota."); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This config needs to be done on both the router and controller from now on?
Also, from router code, I see
MAX_READ_CAPACITYwith default of 100k andROUTER_MAX_READ_CAPACITYwith default of 6000. how are those different? can we also use the same static variable in router code as well to be consistent?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it needs to be on both the controller and router from now on so that they share the same value.
ROUTER_MAX_READ_CAPACITYis used as an early throttler before any requests are processed and it will reject the request if the current number of requests for all stores is larger than the configured limit. I believe it's to prevent the router from being overwhelmed from too many requests at once.MAX_READ_CAPACITYis used to distribute the router quota fairly per store and it will decrease each store's quota by a factor if the total store quota is larger than theMAX_READ_CAPACITYvalue