This page is meant as a template for writing a KIP. To create a KIP choose Tools->Copy on this page and modify with your content and replace the heading with the next KIP number and a description of your issue. Replace anything in italics with your own description.
Status
Current state: Draft
Discussion thread:
JIRA:
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
Motivation
Currently, the initial socket connection timeout is depending on kernel setting tcp_syn_retries. In some scenarios, we want to control the timeout directly using configuration files.
Public Interfaces
We propose a new common client config
connect.timeout.ms: The configuration controls the maximum amount of time the client will wait for the initial socket connection to be built. If the connection is not built before the timeout elapses the selector will drop the socket channel.
Proposed Changes
Currently, we have an idleExpiryManager that uses the LRU algorithm evicting the oldest idle connected socket channels. Similarly, we can instantiate a new LinkedHashMap to keep those socket channels initiating the connection and evict the timeout channels.
Currently, all the channels will be kept in the same LRU map. We will split the connected socket channels and connecting socket channels into different LRU map (we will call them "connecting LRU map" and "connected LRU map" later).
Here's the state transition:
When the socket channel is initiating the connection, we will put the socket channel to the connecting LRU map.
When the connection is successfully built, we will move the channel from connecting LRU map into connected LRU map.
In each selector poll, we will remove the oldest timeout socket channel in both connecting LRU map and connected LRU map, if possible.
To Discuss
- We can think about if we want to have different connect.timeout.ms for different clients.
- What would be the default value for connect.timeout.ms