-
-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Fetch v8 protocol (including client-side throttling) #776
Conversation
If we start supporting v8, then we should also start honoring the throttle time by not sending any more fetch requests during that time, if I'm reading the KIP right. To make things more complicated, we should only introduce this backoff if the throttle time in the response came from a Fetch response v8, since for v7 the broker will have already throttled the client by delaying the response. |
Fair enough. My ultimate goal is to get to KIP-392 as quickly as possible, so I would be looking into a minimum implementation for client-side throttling here. :) I see that KIP-219 changes a lot of requests/responses so that each of these can indicate client-side throttling, but from what I understand this still means we can only support it for some requests. IOW: It looks like supporting it for Fetch v8 is fine, as long as there is a reasonable path forward to add similar behavior to other APIs. What the java client does looks quite reasonable:
The Java client does use a version callback, looking at JavaScript and the KafkaJS approach to requests it seems easier to have a flag for "should client-side throttle" and a value for the "how long aspect". One could even put these into the same value ( For the delaying then the WDYT, would such an approach be acceptable for merging? |
I think that sounds very reasonable. And as you say, we can opt into this API-per-API as we upgrade versions. |
For the test failures: These now come from the various places that check responses against a pre-defined "expected" response. Depending on the Kafka version though we will now get a different response. I'm going to fix these in the next commit:
|
#786 fixes two issues with tests that lead to errors now. I rather not mix up the commits though, so for this branch it's somewhat expected that the tests mentioned in that PR fail here. |
I rebased and shuffled the changes a bit around:
|
When a decoded response contains a `clientSideThrottleTime` property, then we understand this to mean "do not send further requests for this number of ms on this connection". For compatibility this is an _additional_ property, and responses in APIs that support the client-side throttling should still continue to include a `throttleTime` field with a value of 0 to indicate that the server did not do any throttling. See https://cwiki.apache.org/confluence/display/KAFKA/KIP-219+-+Improve+quota+communication
Fetch API v8 is identical to v7, but using v8 means that the client understands how to use client-side throttling. See https://cwiki.apache.org/confluence/display/KAFKA/KIP-219+-+Improve+quota+communication
This is a pre-condition for #713 (we need Fetch v11 for KIP-392).
v8 is exactly the same as v7, the difference is purely in how quota throttling is to be understood. See https://cwiki.apache.org/confluence/display/KAFKA/KIP-219+-+Improve+quota+communication
This provides the last puzzle piece to resolve #161.