Control javax.ws.rs.client.Client idle connection TTL #24433
Unanswered
jimbogithub
asked this question in
Q&A
Replies: 1 comment
-
FWIW I've switched to directly using a Best of all the Netty connection pool cleanly detects when the other end drops an idle connection instead of leaving a zombie the way the Apache pool does. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way to control the
quarkus-rest-client
idle connection TTL?The following code will set a hard TTL:
((ResteasyClientBuilder) ClientBuilder.newBuilder()).connectionTTL(55, TimeUnit.SECONDS);
This differs from the
quarkus-rest-client-reactive
which does do an idle connection TTL in line with the documentation: https://quarkus.io/guides/all-config#quarkus-rest-client-config_quarkus.rest-client.-config-key-.connection-ttlUnfortunately I can't use the
quarkus-rest-client-reactive
because I need theResponse
to be present onWebApplicationException
but it is not populated.The underlying Apache HttpClient can be configured with a
ConnectionKeepAliveStrategy
. This defaults toDefaultConnectionKeepAliveStrategy
which honours theKeep-Alive: timeout=x
in the response. However the servers that I'm talking to don't populate a sensible value and adding it via aClientResponseFilter
does not help as it appears the connection pool examines the headers before the filters are applied. There does not appear to be anyway to inject a customConnectionKeepAliveStrategy
other than to build your own HttpClient from scratch.The intention of the idle TTL is to discard a connection before it gets dropped by any intermediary that kills idle connections. The problem with the hard TTL is the latency introduced in establishing a new connection and having to do so unnecessarily as we are dropping perfectly valid connections.
Beta Was this translation helpful? Give feedback.
All reactions