reactor-netty: how to configure pooled connection idle timeout
I am using reactor-netty http client (0.7.X series) with connection pooling and would like to configure pooled connection’s idle timeout but don’t know where.
More precisely, I need to configure reactor-netty’s connection pool in such a way that it will automatically close connections that did not see any activity within configurable timeout. These connections are open but no bytes were transferred in or out for some (configurable) amount of time.
As an example, Jetty’s http client has a configuration option with the above semantics branded as connectionIdleTimeout.
Is there an analogous setting in reactor-netty that allows me to set a connection’s idle timeout? How can I configure reactory-netty http client to close idle connections preemptively?
We are getting Connection prematurely closed
errors described in #413 and #498 because of this.
Expected behavior
Pool automatically closes a connection which was idle for a given time interval
Actual behavior
Don’t know how to force the pool to close the inactive connection
Steps to reproduce
N/A
Reactor Netty version
0.7.13
JVM version (e.g. java -version
)
N/A
OS version (e.g. uname -a
)
N/A
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 20 (7 by maintainers)
Commits related to this issue
- fix #612 API for configuring pooled connection idle time — committed to reactor/reactor-netty by violetagg 5 years ago
- fix #612 API for configuring pooled connection idle time — committed to reactor/reactor-netty by violetagg 5 years ago
- fix #612 API for configuring pooled connection idle time — committed to reactor/reactor-netty by violetagg 5 years ago
@kimec Yep it is a typo, you have to pass that to
HttpClient.create
@hragarwalee Programatically you should do it like this https://speakerdeck.com/violetagg/how-to-avoid-common-mistakes-when-using-reactor-netty?slide=92
For anything else specific to Spring Boot: use the corresponding support channels for Spring Boot.
#792
With this the connections with idle time > from the configuration will be removed from the pool on acquire i.e. if the acquired connection is with idle time above the configuration the connection will be closed and another one will be acquired.