Skip to content

Conversation

@arturobernalg
Copy link
Member

Wire PoolingHttpClientConnectionManager to use RouteSegmentedConnPool when OFFLOCK is selected.

Wire PoolingHttpClientConnectionManager to use RouteSegmentedConnPool when OFFLOCK is selected.
@arturobernalg arturobernalg requested a review from ok2c December 11, 2025 14:48
@garydgregory
Copy link
Member

What "OFFLOCK" mean?

@arturobernalg
Copy link
Member Author

What "OFFLOCK" mean?
HI @garydgregory. OFFLOCK is selected, PoolingHttpClientConnectionManager switches to RouteSegmentedConnPool, which keeps per-route state in independent segments, avoids a single global lock and offloads slow graceful closes to a bounded executor. The goal is to reduce contention in highly concurrent workloads while still honouring the same per-route / total caps as today.
The name was meant as “off-lock / low-lock” policy, but if you prefer a more explicit name like SEGMENTED (or similar),

@garydgregory
Copy link
Member

What "OFFLOCK" mean?
HI @garydgregory. OFFLOCK is selected, PoolingHttpClientConnectionManager switches to RouteSegmentedConnPool, which keeps per-route state in independent segments, avoids a single global lock and offloads slow graceful closes to a bounded executor. The goal is to reduce contention in highly concurrent workloads while still honouring the same per-route / total caps as today.
The name was meant as “off-lock / low-lock” policy, but if you prefer a more explicit name like SEGMENTED (or similar),

Thank you for the explanation @arturobernalg

So the bottom line is that this is not a "lock
-free" implementation ("offlock" is very odd phrasing IMO.) This makes me feel that "off" in the name is inappropriate.

Any other name would be better IMO.

@arturobernalg
Copy link
Member Author

What "OFFLOCK" mean?
HI @garydgregory. OFFLOCK is selected, PoolingHttpClientConnectionManager switches to RouteSegmentedConnPool, which keeps per-route state in independent segments, avoids a single global lock and offloads slow graceful closes to a bounded executor. The goal is to reduce contention in highly concurrent workloads while still honouring the same per-route / total caps as today.
The name was meant as “off-lock / low-lock” policy, but if you prefer a more explicit name like SEGMENTED (or similar),

Thank you for the explanation @arturobernalg

So the bottom line is that this is not a "lock -free" implementation ("offlock" is very odd phrasing IMO.) This makes me feel that "off" in the name is inappropriate.

Any other name would be better IMO.

OFFLOCK selects the segmented pool implementation and routes slow graceful closes off the hot pool locks to reduce lock contention. The name reflects that intent;

@ok2c
Copy link
Member

ok2c commented Dec 11, 2025

@arturobernalg Please consider writing up a short connection management guide for the website

@rschmitt
Copy link
Contributor

OFFLOCK is selected, PoolingHttpClientConnectionManager switches to RouteSegmentedConnPool, which keeps per-route state in independent segments, avoids a single global lock and offloads slow graceful closes to a bounded executor.

I believe this technique is commonly known as lock striping.

@arturobernalg
Copy link
Member Author

@arturobernalg Please consider writing up a short connection management guide for the website

@ok2c done

@arturobernalg arturobernalg merged commit a14264d into apache:master Dec 12, 2025
10 checks passed
@ok2c
Copy link
Member

ok2c commented Dec 12, 2025

@arturobernalg You may want to cherry-pick this change-set to 5.6.x

ok2c pushed a commit that referenced this pull request Dec 14, 2025
…765)

Wire PoolingHttpClientConnectionManager to use RouteSegmentedConnPool when OFFLOCK is selected.
@rschmitt
Copy link
Contributor

OFFLOCK selects the segmented pool implementation and routes slow graceful closes off the hot pool locks to reduce lock contention.

Wasn't this feature previously implemented for the STRICT and LAX concurrency policies? If this is a feature we could eventually implement in strict and/or lax pools then I think we should be hesitant to expose OFFLOCK as part of the public API. There are other ways to expose an opt-in experimental feature that we plan to eventually make the default behavior.

@ok2c
Copy link
Member

ok2c commented Dec 18, 2025

@rschmitt We will not know how well OFFLOCK performs and whether it is ready to become the default pool implementation unless it gets tested in read-world settings. But let's be realistic. People are not going to use or even experiment with it unless it has been made available in GA release and exposed as a part of public APIs.

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.

4 participants