[ 
https://issues.apache.org/jira/browse/KAFKA-5044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15962709#comment-15962709
 ] 

Rajini Sivaram commented on KAFKA-5044:
---------------------------------------

[~twbecker] {{max.in.flight.requests.per.connection}} is the number of requests 
for which responses may be outstanding. Each connection may have only one send 
in progress at any time. But if {{max.in.flight.requests.per.connection=5}}, 
upto 5 requests may be sent one after the other, before any response is 
received from the server. So the checks in the code verify the two cases (a) 
whether the previous send has completed and (b) whether the number of responses 
still outstanding is within max.in.flight.

> max.in.flight.requests.per.connection > 1 is ineffective
> --------------------------------------------------------
>
>                 Key: KAFKA-5044
>                 URL: https://issues.apache.org/jira/browse/KAFKA-5044
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients
>            Reporter: Tommy Becker
>
> While looking at the NetworkClient code, I became suspicious about the 
> implementation of org.apache.kafka.clients.InFlightRequests#canSendMore, 
> which seems responsible for enforcing max.in.flight.requests.per.connection
> {code}
> public boolean canSendMore(String node) {
>         Deque<NetworkClient.InFlightRequest> queue = requests.get(node);
>         return queue == null || queue.isEmpty() ||
>                (queue.peekFirst().send.completed() && queue.size() < 
> this.maxInFlightRequestsPerConnection);
>     }
> {code}
> If the most recent request has not been completed, then this returns false 
> even if we are under the maxInFlightRequestsPerConnection limit. I wonder if 
> I am misunderstanding how this parameter is supposed to work, as this code 
> has been there quite some time. But I wrote a unit test that tries to send a 
> second request with one outstanding and it does indeed fail, despite 
> maxInFlightRequestsPerConnection being set to Integer.MAX_VALUE. I'll create 
> a PR with my test and possible fix.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to