Commit 108ad6e
authored
KAFKA-19767 - Send Share-Fetch one-node at a time for record_limit mode (#20855)
*What*
- After KIP-1206, when `record_limit` mode was introduced, we ideally
want no more than the #records in the `maxRecords` field in
`ShareFetchRequest`.
- Currently, the client broadcasts the share fetch requests to all nodes
which host the leaders of the partitions that it is subscribed to.
- The application thread would be woken up after the first response
arrives, but meanwhile the responses from other nodes could bring in
those many #records next and would wait in the buffer, that would mean
we are wasting the acquisition locks for these records which are
waiting.
- Instead we would want to only send the next request when we poll
again.
- PR aims to send the request to only 1 node at a time in record_limit
mode.
- We are using partition-rotation on each poll so that no partition is
starved.
There were NCSS checkstyle errors in `ShareConsumeRequestManagerTest`,
so added a few refactors there to reduce the length.
Performance
- When we have more consumers than the #partitions(i.e when real sharing
of data happens in a partition), then we are seeing the performance is
almost the same as the current approach. But when we have lesser
consumers than the #partitions, then we see a performance regression as
client is waiting for a node to return a response before it can send the
next request.
- Hence we have introduced this only for `record_limit` mode for now,
future work will be done to improve this area.
Reviewers: Andrew Schofield <[email protected]>1 parent 0491e11 commit 108ad6e
File tree
3 files changed
+185
-131
lines changed- clients/src
- main/java/org/apache/kafka/clients/consumer/internals
- test/java/org/apache/kafka/clients/consumer/internals
3 files changed
+185
-131
lines changedLines changed: 44 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| 93 | + | |
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
| |||
196 | 198 | | |
197 | 199 | | |
198 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
199 | 208 | | |
200 | 209 | | |
201 | 210 | | |
| |||
245 | 254 | | |
246 | 255 | | |
247 | 256 | | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
248 | 272 | | |
249 | 273 | | |
250 | 274 | | |
| |||
255 | 279 | | |
256 | 280 | | |
257 | 281 | | |
258 | | - | |
| 282 | + | |
259 | 283 | | |
260 | 284 | | |
261 | 285 | | |
262 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
263 | 291 | | |
264 | 292 | | |
265 | 293 | | |
| |||
738 | 766 | | |
739 | 767 | | |
740 | 768 | | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
741 | 778 | | |
742 | 779 | | |
743 | 780 | | |
| |||
858 | 895 | | |
859 | 896 | | |
860 | 897 | | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
861 | 901 | | |
862 | 902 | | |
863 | 903 | | |
| |||
896 | 936 | | |
897 | 937 | | |
898 | 938 | | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
899 | 942 | | |
900 | 943 | | |
901 | 944 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
315 | 316 | | |
316 | 317 | | |
317 | 318 | | |
318 | | - | |
| 319 | + | |
319 | 320 | | |
320 | 321 | | |
321 | 322 | | |
| |||
0 commit comments