v.24.8Improvement

ClickHouse Introduces max_keep_alive_requests Setting for HTTP Connections

ClickHouse server now supports new setting max_keep_alive_requests. For keep-alive HTTP connections to the server it works in tandem with keep_alive_timeout - if idle timeout not expired but there already more than max_keep_alive_requests requests done through the given connection - it will be closed by the server. #61793 (Nikita Taranov).
ClickHouse server introduces the max_keep_alive_requests setting to limit the number of requests handled over a single HTTP keep-alive connection.

Why it matters

This feature enhances connection management by allowing the server to close HTTP keep-alive connections after a specified number of requests have been served. It works alongside keep_alive_timeout to ensure efficient resource usage and prevent excessively long-lived connections, which can improve stability and performance under heavy load.

How to use it

Set the max_keep_alive_requests parameter in the server configuration or via the SETTINGS clause to specify the maximum requests allowed per HTTP keep-alive connection. The connection will be closed once this number is reached, even if the keep_alive_timeout has not expired.