Closed zhizlu-sh closed 3 years ago
Since Kafka only maintains a committed offset, performing async operations (such as using Reactor) causes a great deal of difficulties.
It is not recommended at all because offsets can be committed out of order.
The best way to achieve higher throughput is to use multiple partitions.
That said, he upcoming 2.8.0 release of spring-kafka supports out-of-order commits, by deferring commits until all the gaps are filled.
@zhizlu-sh See the advice from @garyrussell above. Try to remove the usage of the reactor library on top of the message-channel-based Kafka binder that is non-reactive. That seems to be the root of the issues that you are running into. Closing this issue now. Feel free to re-open if you find more issues.
Configuration I use:
Sample Code(I change it a little for below testing) of consumer with concurrency 2
Here is the first test I did for offset override:
Here is the second test I did for concurrency:
delay(5000)
.According to the document of manual ACK below, looks like it polls bunch of message, and feed to reactive consumer? But from above testing, looks like it will pull much more than the currency I set? Also I tried set
configuration.max.poll.records: 2
, but the situation is still same as second test.My question is that if I only have one partition, and I want better throughput, but I don't want offset override, how can I do? Two solutions as far as I can think of:
For one, I have to configure multiple configurations to implement it in reactive way For two, I need to understand the logic behind scene, so maybe I could re-use the logic of "Manual Ack"
Sorry for such a long question, but I want to know more so I could know what's the best way to satisfy my requirement