[ https://issues.apache.org/jira/browse/KAFKA-1282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14097971#comment-14097971 ]
Neha Narkhede commented on KAFKA-1282: -------------------------------------- My suggestion was not just to address the performance concern which is somewhat of an issue nevertheless. The motivation was that there is an upper bound on the number of open connections you can support on the broker. That number is the # of open file handles configured on the box. Since that number is known anyway, you probably would want to configure your server so that the connections never exceed a certain percentage of that upper limit. Currently, if the server runs out of open file handles, it effectively stays alive, but is unable to serve any data and becomes a 'zombie'. But a downside of the expiration based on the connection count is that it doesn't necessarily achieve the goal of expiring really old connections. Instead it tries to solve the problem of preventing the broker from running out of available file handles, in which case we probably need a fairer strategy for expiring connections. Thinking more, I think it might be sufficient to override removeEldestEntry and check if the oldest entry is older than the threshold and let the map remove it. If the oldest entry is not above the threshold, traversing the map doesn't buy you anything. The downside is that if no new activity takes place on any of the connections all of a sudden, the server wouldn't proactively drop all connections, which is less of a concern. The advantage is that you will still get the same benefit of expiring older connections and it removes the need to traverse. > Disconnect idle socket connection in Selector > --------------------------------------------- > > Key: KAFKA-1282 > URL: https://issues.apache.org/jira/browse/KAFKA-1282 > Project: Kafka > Issue Type: Bug > Components: producer > Affects Versions: 0.8.2 > Reporter: Jun Rao > Assignee: Neha Narkhede > Labels: newbie++ > Fix For: 0.9.0 > > Attachments: > kafka-1282__Disconnect_idle_socket_connection_in_Selector.patch > > > To reduce # socket connections, it would be useful for the new producer to > close socket connections that are idle. We can introduce a new producer > config for the idle time. -- This message was sent by Atlassian JIRA (v6.2#6252)