Skip to content

Commit

Permalink
in_kafka: Rely on only buffer_max_size for preventing greedy consumin…
Browse files Browse the repository at this point in the history
…g topics

Referring Mem_Buf_Limit and relying on pause/resume should cause
performance degredation.
Only relying on buffer_max_size should be better to adjust flow rate.

Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Nov 17, 2023
1 parent 08e0de5 commit 6ff7f73
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions plugins/in_kafka/in_kafka.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,8 @@ static int in_kafka_init(struct flb_input_instance *ins,
goto init_error;
}

if (ctx->ins->mem_buf_limit > 0 || ctx->buffer_max_size > 0) {
if (ctx->ins->mem_buf_limit) {
ctx->polling_threshold = ctx->ins->mem_buf_limit;
}
else if (ctx->buffer_max_size > 0) {
ctx->polling_threshold = ctx->buffer_max_size;
}
if (ctx->buffer_max_size > 0) {
ctx->polling_threshold = ctx->buffer_max_size;

snprintf(conf_val, sizeof(conf_val), "%zu", ctx->polling_threshold - 512);
res = rd_kafka_conf_set(kafka_conf, "fetch.max.bytes", conf_val,
Expand Down

0 comments on commit 6ff7f73

Please sign in to comment.