Skip to content

Connection pool config #1771

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

Merged
merged 5 commits into from
Aug 15, 2024
Merged

Connection pool config #1771

merged 5 commits into from
Aug 15, 2024

Conversation

chernser
Copy link
Contributor

Summary

Added new options:

  • com.clickhouse.client.config.ClickHouseClientOption#CONNECTION_TTL - sets maximum connection time to leave. Overrides keep-alive from a server
  • com.clickhouse.client.http.config.ClickHouseHttpOption#KEEP_ALIVE_TIMEOUT - sets keep alive for connections. Overrides keep-alive from a server
  • com.clickhouse.client.http.config.ClickHouseHttpOption#CONNECTION_REUSE_STRATEGY - sets strategy of connection reuse. By default LIFO is used so most fresh connections are used. Another value is "FIFO" that will make connection pool to use connections in fair way.

Closes #1770

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG
  • For significant changes, documentation in https://github.com/ClickHouse/clickhouse-docs was updated with further explanations or tutorials

int maxConnection = config.getIntOption(ClickHouseHttpOption.MAX_OPEN_CONNECTIONS);

connManager.setMaxTotal(maxConnection);
connManager.setMaxTotal(Integer.MAX_VALUE); // unlimited on global level
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why setting into MAX_VALUE

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we have different routes then it will override max connection per route
previous version would work with only one route well

Copy link

@chernser chernser merged commit 2a41352 into main Aug 15, 2024
66 checks passed
@chernser chernser deleted the connection_pool_config branch August 15, 2024 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[clickhouse-http-client] Extend Apache HTTP Client Connection Pool Config
3 participants