Add maximumPendingConnections property for load-shedding#2387
Open
vlsi wants to merge 1 commit intobrettwooldridge:devfrom
Open
Add maximumPendingConnections property for load-shedding#2387vlsi wants to merge 1 commit intobrettwooldridge:devfrom
vlsi wants to merge 1 commit intobrettwooldridge:devfrom
Conversation
Under traffic spikes or database outages, threads can accumulate unboundedly waiting for pool connections, then fail in a thundering herd after connectionTimeout. This adds an opt-in admission control that rejects getConnection() calls immediately when too many threads are already waiting, preventing waiter buildup and reducing the blast radius of pool exhaustion. The property defaults to 0 (unlimited) for full backward compatibility. Refs: brettwooldridge#580 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
36f74d9 to
553029a
Compare
vlsi
commented
Feb 14, 2026
| super(config); | ||
|
|
||
| this.connectionBag = new ConcurrentBag<>(this); | ||
| this.connectionBag = new ConcurrentBag<>(this, config.getMaximumPendingConnections()); |
Author
There was a problem hiding this comment.
The drawback of passing getMaximumPendingConnections is that ConcurrentBag won't react to the changes of maximumPendingConnections.
An alternative options could be:
a) Pass HikariConfig to ConcurrentBag
b) Add interface ConcurrentBagConfig { int getMaximumWaiters(); int getMaximumObjects();} so the bag could query the required limits
Any thoughts?
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.
Under traffic spikes or database outages, threads can accumulate unboundedly waiting for pool connections, then fail in a thundering herd after
connectionTimeout. This adds an opt-in admission control that rejectsgetConnection()calls immediately when too many threads are already waiting, preventing waiter buildup and reducing the blast radius of pool exhaustion.The property defaults to 0 (unlimited) for full backward compatibility.
Fixes #580