Skip to content

Conversation

@rschmitt
Copy link
Contributor

@rschmitt rschmitt commented Oct 7, 2025

Connection TTL can be effected either in bulk by calling connMgr.closeExpired() or at connection reuse time by configuring a timeToLive on the ConnectionConfig. Strangely, idle timeouts can only be effected in bulk via connMgr.closeIdle(), or with an IdleConnectionEvictor; they have no corresponding ConnectionConfig setting. This change resolves this inconsistency. The result is that idle timeouts are much easier to configure and enforce: they don't require spinning up a background thread that periodically locks the entire conn pool and closes idle connections; there is no longer the possibility of reusing a connection after it hits its intended idle timeout; and it doesn't matter whether the connection pool is shared.

@rschmitt rschmitt requested a review from ok2c October 7, 2025 17:29
@ok2c
Copy link
Member

ok2c commented Oct 8, 2025

@rschmitt I suppose we should rewrite IdleConnectionEvictor to make use of the new setting but this can be done in a separate change-set

Connection TTL can be effected either in bulk by calling
`connMgr.closeExpired()` or at connection reuse time by configuring a
`timeToLive` on the `ConnectionConfig`. Strangely, idle timeouts can
only be effected in bulk via `connMgr.closeIdle()`, or with an
`IdleConnectionEvictor`; they have no corresponding `ConnectionConfig`
setting. This change resolves this inconsistency. The result is that
idle timeouts are much easier to configure and enforce: they don't
require spinning up a background thread that periodically locks the
entire conn pool and closes idle connections; there is no longer the
possibility of reusing a connection after it hits its intended idle
timeout; and it doesn't matter whether the connection pool is shared.
@rschmitt rschmitt merged commit 4681610 into apache:master Oct 10, 2025
6 of 9 checks passed
@rschmitt rschmitt deleted the idle-timeout branch October 10, 2025 04:06
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.

2 participants