Commit 051a8cb
GH-3764: Replace LinkedList with ArrayList in listener container for records
Fixes: #3764
Issue link: #3764
Acknowledging an index in a batch has quadratic time `N(N+1)/2` ~ `N^2`
Batch consumers operate on a `LinkedList` of records.
If the consumer uses `MANUAL_IMMEDIATE` ack mode, and the listener invokes `acknowledgement.acknowledge(index)` where index is relatively big (e.g. when processing batches of `100k`), performance takes hit because of the linear lookup `records.get(i)` in a loop
Signed-off-by: Janek Lasocki-Biczysko <janek.lb@gmail.com>
[artem.bilan@broadcom.com: improve commit message]
Signed-off-by: Artem Bilan <artem.bilan@broadcom.com>
(cherry picked from commit 53149d4)1 parent a07a55d commit 051a8cb
File tree
1 file changed
+4
-6
lines changed- spring-kafka/src/main/java/org/springframework/kafka/listener
1 file changed
+4
-6
lines changedLines changed: 4 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
| |||
2237 | 2238 | | |
2238 | 2239 | | |
2239 | 2240 | | |
2240 | | - | |
2241 | | - | |
2242 | | - | |
2243 | | - | |
2244 | | - | |
2245 | | - | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
2246 | 2244 | | |
2247 | 2245 | | |
2248 | 2246 | | |
| |||
0 commit comments