Skip to content
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

in_kafka: boost throughput #9800

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

in_kafka: boost throughput #9800

wants to merge 4 commits into from

Conversation

coreidcc
Copy link

@coreidcc coreidcc commented Jan 6, 2025

We have a Kafka cluster that ingests about 40k messages (about 60MB) of data per seconds. Fluent-bit in its current state stands no change to keep up with this load. Even Logstash is faster and vector is just consuming all these messages with ease.

Causes:
a) commits each message individually
b) a poll-timeout of just one 1ms (this completely overrides fetch.wait.max.ms from kafka)

probably related to "Batch processing is required in in_kafka. #8030"

Testing: To activate the changes one need to

[INPUT]
Name kafka
threaded true -> sets timeout fetch.wait.max.ms + 50ms (align our and kafkas timeout, ensures kafka triggers timeout)
enable_auto_commit true -> disable explicit commit call

-> The change doesn't do any dynamic allocations at all and therefore cant introduce any mem-leaks
-> The change has no impact on packaging

Throughput increased by more then a magnitude.

*/
ctx->poll_timeount_ms = 1;
if (ins->is_threaded) {
ctx->poll_timeount_ms = 550; // ensure kafa triggers timeout
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use /* */ style of comment here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not resolved this comment.

plugins/in_kafka/in_kafka.c Outdated Show resolved Hide resolved
plugins/in_kafka/in_kafka.c Outdated Show resolved Hide resolved
plugins/in_kafka/in_kafka.c Outdated Show resolved Hide resolved
plugins/in_kafka/in_kafka.c Outdated Show resolved Hide resolved
Polling every 1ms and committing each message individually
results in rather pure performance in high volume Kafka
clusters.

Commiting in batches (relay on auto-commit of kafka)
drastically improves performance.

Signed-off-by: CoreidCC <[email protected]>
having 1ms timeout might make sense if the input plugin is
running in the main thread (not introducing delay for others).
but if we run in our very own thread then we should not over-
ride the fetch.wait.max.ms configuration value from the
kafka-consumer.

this in conjuntion with using autocommit again boosts the
throuhput significantly.

Signed-off-by: CoreidCC <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-required ok-package-test Run PR packaging tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants