You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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[One of "Under Discussion", "Accepted", "Rejected"]

Discussion thread: here [Change the link from the KIP proposal email archive to your own email thread]

JIRA: here [Change the link from KAFKA-1 to your own ticket]

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation

Currently the kafka client will non-blocking connect to the broker, but if the broker’s OS system  shuts down or crashes, and the client is connecting to that node, it will waste a long time for the client to be aware of the connection can’t be reached. If the client is connecting the node to update metadata it will not connect to another node unless the previous connection is closed, then the client can’t send or receive message until it is aware of the connection is broken and try other node. This time is determined by the TCP connection parameters in the environment, sometime maybe several minutes.

 

So we want to add a connecting timeout to the client in this situation, it will timeout in a specified time and try to connect to other node to update metadata to avoid this issue.

Public Interfaces

This KIP will add a configuration in the client’s configuration file:

connect.timeout.ms: the connecting time out of one connection, default is 5000.

Proposed Changes

The change is as follow:

(1)     Add a connecting time to the network client.

(2)     Whenever a connection is trying to connect, we save the connecting channel in a hash map.

(3)     At the end of every poll in the selector, we check if there are any connecting channels timeout, if so we will close these the connecting channels, then the client will try to select other node to connect.

(4)     If a channel is connected or closed, we will remove it from the connecting channel hash map.

.

Compatibility, Deprecation, and Migration Plan

The proposed change is backward compatible.


Rejected Alternatives

NA

  • No labels