Add query limiter caching layer - #3776
Open
lbschanno wants to merge 6 commits into
Open
Conversation
Add a caching layer to the query limiter feature. The caching layer is primarily encapsulated within two classes, QueryLogicCache.java, and QueryCountsCache.java. These classes leverage CuratorCaches to listen for node creation/deletions, and upon receiving them, update local collections maintained in memory. These caches also register listeners to listen for changes to the connection state of the backing Zookeeper client. If the client ever reaches a SUSPENDED, LOST, or READ_ONLY state, the caches will automatically be marked unhealthy, and query limit enforcement will be suspended. If the client later reaches a state of RECONNECTED, the caches will be rebuilt to be put back into a healthy state, and query limit enforcement will resume. Closes #3643
apmoriarty
requested changes
Jul 28, 2026
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
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.
Overview
Add a caching layer to the query limiter feature. The caching layer is primarily encapsulated within two classes, QueryLogicCache.java, and QueryCountsCache.java. These classes leverage CuratorCaches to listen for node creation/deletions, and upon receiving them, update local collections maintained in memory.
These caches also register listeners to listen for changes to the connection state of the backing Zookeeper client. If the client ever reaches a SUSPENDED, LOST, or READ_ONLY state, the caches will automatically be marked unhealthy, and query limit enforcement will be suspended. If the client later reaches a state of RECONNECTED, the caches will be rebuilt to be put back into a healthy state, and query limit enforcement will resume.
Closes #3643
Testing
Via datawave quickstart, I deployed branches
integrationandtask/queryLimiterCachingto measure and compare the speed ofQueryLimiter.checkForLimits(). The QueryLimiter was configured such to ensure worst case of needing a full traversal of all active query nodes in Zookeeper to obtain a current count. I also manually generated and added non-ephemeral versions of active query nodes in Zookeeper to simulate high numbers of active concurrent queries.All times measured below represent averages from batches of 25 randomized queries.
Branch
integration:Branch
task/queryLimiterCaching:On average, the caching layer made checking for limits around 20x faster on a quickstart deployment.