We also set the maximum number of probes before the connection dropping to 8. So, we've enabled keep-alive checks to probe after 5 minutes of being idle, at 60 seconds intervals. option(EpollChannelOption.TCP_KEEPCNT, 8) option(EpollChannelOption.TCP_KEEPINTVL, 60) option(EpollChannelOption.TCP_KEEPIDLE, 300) option(ChannelOption.SO_KEEPALIVE, true) Moreover, we can configure the keep-alive option, which will send TCP check probes when the connection is idle: HttpClient client = HttpClient.create() Netty sets that value to 30 seconds by default. The value provided is in milliseconds, so we configured the timeout for 10 seconds. option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10000) We can use different channel options keys and the option() method to perform the configuration: HttpClient client = HttpClient.create() The connection timeout is a period within which a connection between a client and a server must be established.
0 Comments
Leave a Reply. |