-
Notifications
You must be signed in to change notification settings - Fork 63
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
BlazeClient's idleTimeout works differently than BlazeServer's idleTimeout #635
Comments
By way of comparison, there is a |
http4s/http4s#3700 seems to be related. Maybe the can be solved together. |
#675 also seems related |
For reference akka-http has a similar problem, and there's a PR adding a second kind of timeout to http client: akka/akka-http#3816 |
So if we added a |
I'm not convinced what we should do with the blaze-server What I am currently convinced to is that the changes in akka-http-client go in the right direction and we should do the same in blaze-client. It should have two timeouts:
While this doesn't solve the user experience problem I stated in the title of this issue "BlazeClient's idleTimeout works differently than BlazeServer's idleTimeout". I think it solves the the more serious technical problems of:
P.S. I feel a need to on more client-side timeout, sort of a maximumLifespan, that would be useful in forcing a rebalancing of connections though a load-balancer. But that's a story for another ticket. |
We had an issue at $WORK with a server that used round-robin DNS interacting badly with the JVM's DNS caching. We filled the pool against one cached instance. It was proposed a max lifespan would help that, but I think it would expire those connections at once and then overload another instance as it replenished the connections within a new cache window. A maximum lifespan with jitter could have helped us here after the first wave. But that's probably solving the wrong problem: we needed a different load balancing strategy. I like your ideas here. |
is there a plan to make this timeout available and exposed? we were getting |
No, there's not yet anything like the |
/** Time a connection can be idle and still be borrowed. Helps deal
* with connections that are closed while idling in the pool for an
* extended period. `Duration.Inf` means no timeout.
*/
def withMaxIdleDuration(maxIdleDuration: Duration = maxIdleDuration): BlazeClientBuilder[F] =
copy(maxIdleDuration = maxIdleDuration) Is this the new and correct timeout, which should remove connections from pool? |
Both
BlazeClient
andBlazeServer
offer anidleTimeout
configuration option. The option has the same name in both, and shares implementation (IdleTimeoutStage
) but from user's perspective it behaves differently.In
BlazeClient
theidleTimeout
is active only when a request is in-flight. It may kick in if the server takes too long to respond (unless other timeout does it first) or when the server starts sending a response and then pauses for too long. An idle (not borrowed from the pool) connection will remain open indefinitly as theidleTimeout
is deactivated when a connection is returned to the pool. This may contradict users assumptions about the meaning of the word "idle" in the context of an HTTP client.In
BlazeServer
theidleTimeout
is always active, and it may terminate connections that have an in-flight request but nothing happened for too long, as well as connections which are kept open but unused.I see this inconsistency as a bad developer experience. In addition to that I see the lack of mechanism for evicting unused connections from the client's connection pool, as a missing feature and potential resource leak.
The text was updated successfully, but these errors were encountered: