add hard limit for http client connection#91016
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds hard limit configurations for HTTP client connections across three connection groups (disk, storage, and http). When the hard limit is reached, an exception is thrown instead of allowing further connection creation.
- Added
hard_limitfield to connection pool limits configuration - Implemented hard limit checking before connection creation with appropriate error handling
- Added test coverage for the new hard limit functionality
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Core/ServerSettings.cpp | Added three new server settings for hard limits (disk_connections_hard_limit, storage_connections_hard_limit, http_connections_hard_limit) with default values and reduced disk_connections_store_limit |
| src/Common/HTTPConnectionPool.h | Added hard_limit field to the Limits struct with default value of 25000 |
| src/Common/HTTPConnectionPool.cpp | Implemented hard limit check in prepareNewConnection method and added new error code HTTP_CONNECTION_LIMIT_REACHED |
| src/Common/ErrorCodes.cpp | Registered new error code HTTP_CONNECTION_LIMIT_REACHED (762) |
| programs/server/Server.cpp | Wired up the new hard limit settings to HTTPConnectionPools initialization |
| src/Common/tests/gtest_connection_pool.cpp | Renamed existing HardLimit test to StoreLimit and added new HardLimit test to verify exception throwing behavior |
Contributor
|
Workflow [PR], commit [5f719f0] Summary: ❌
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
tavplubix
approved these changes
Nov 28, 2025
Member
tavplubix
left a comment
There was a problem hiding this comment.
Please write the changelog entry
src/Core/ServerSettings.cpp
Outdated
| DECLARE(UInt64, disk_connections_warn_limit, 10000, R"(Warning massages are written to the logs if number of in-use connections are higher than this limit. The limit applies to the disks connections.)", 0) \ | ||
| DECLARE(UInt64, disk_connections_store_limit, 30000, R"(Connections above this limit reset after use. Set to 0 to turn connection cache off. The limit applies to the disks connections.)", 0) \ | ||
| DECLARE(UInt64, disk_connections_store_limit, 15000, R"(Connections above this limit reset after use. Set to 0 to turn connection cache off. The limit applies to the disks connections.)", 0) \ | ||
| DECLARE(UInt64, disk_connections_hard_limit, 25000, R"(Exception is thrown at a creation attempt when this limit is reached. Set to 0 to turn off hard limitation. The limit applies to the disks connections.)", 0) \ |
This was referenced Dec 1, 2025
robot-clickhouse-ci-1
added a commit
that referenced
this pull request
Dec 1, 2025
Cherry pick #91016 to 25.11: add hard limit for http client connection
robot-clickhouse
added a commit
that referenced
this pull request
Dec 1, 2025
clickhouse-gh bot
added a commit
that referenced
this pull request
Dec 1, 2025
Backport #91016 to 25.11: add hard limit for http client connection
1 task
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.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Now
HTTP_CONNECTION_LIMIT_REACHEDexception would be thrown whenhard_limitfor the http clients connection is reached. It is set as20000for the disk connections.Documentation entry for user-facing changes