Make the response ReadTimeout start on send #547
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently the broker sets the ReadTimeout from the moment when it starts
listening for the response. However, due to the serial blocking nature of kafka
network connections, this can be substantially later than the time we actually
sent the request, and can lead to long useless waits when the connection has
timed out but there are requests in the queue.
Instead, set the ReadTimeout from the moment we have successfully sent the
request.
@wvanbergen @4578395263256 this is one possible improvement to #546. I'm pretty sure it's wrong (for example if three requests are made simultaneously to one broker, and the first two take 15 seconds each then this change would cause the third request to time out immediately without waiting for a response) but perhaps some variation on it might be better.
Thoughts?