From 6ff7f735fef7ac1a8d28fc313db066a335cbc978 Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Fri, 17 Nov 2023 20:23:20 +0900 Subject: [PATCH] in_kafka: Rely on only buffer_max_size for preventing greedy consuming 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 --- plugins/in_kafka/in_kafka.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/plugins/in_kafka/in_kafka.c b/plugins/in_kafka/in_kafka.c index 68c80e3e302..fcbf21ba508 100644 --- a/plugins/in_kafka/in_kafka.c +++ b/plugins/in_kafka/in_kafka.c @@ -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,