# Telegraf is very slow reading data from Kafka

**URL:** https://community.influxdata.com/t/telegraf-is-very-slow-reading-data-from-kafka/12522
**Category:** Telegraf
**Created:** [January 6, 2020, 12:50pm UTC](https://community.influxdata.com/t/telegraf-is-very-slow-reading-data-from-kafka/12522 "2020-01-06T12:50:47Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![saravana\_alagar](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/saravana_alagar/32/4180_2.png) [@saravana\_alagar](https://community.influxdata.com/u/saravana_alagar)
#### Post date: [January 6, 2020, 12:50pm UTC](https://community.influxdata.com/t/telegraf-is-very-slow-reading-data-from-kafka/12522/1 "2020-01-06T12:50:47Z")

</div>

I am using telegraf for high volume data transmission(atleast 25k records/sec) from kafka to influxdb in real-time. But with the best agent configuration I telegraf could read only 500 records/sec. On the other hand a simple python program could read about 3000 rec/s from the same kafka consumer. Is it advisable to use telegraf to such high volume data? or Is anything wrong with my telegraf configuration?

Telegraf.config

[[outputs.discard]] # Made to discard output to check speed of input.

[agent]  
metric\_batch\_size = 10000  
flush\_interval = “1s”  
interval = “1s”

[[inputs.kafka\_consumer]]  
name\_override = “data\_ingestion”  
brokers = [“msgbus:9093”]  
topics = [“a\_di\_es\_5”]  
max\_undelivered\_messages = 5000  
#metric\_buffer\_limit = 10000  
consumer\_group = “test4”  
offset = “oldest”  
max\_message\_len = 1000000  
json\_string\_fields = [“Column\_1”, “Column\_2”,…]  
data\_format = “json”

---

<div class="post-metadata">

### Author: ![daniel](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/daniel/32/142_2.png) [@daniel](https://community.influxdata.com/u/daniel)
#### Post date: [January 7, 2020, 12:09am UTC](https://community.influxdata.com/t/telegraf-is-very-slow-reading-data-from-kafka/12522/2 "2020-01-07T00:09:05Z")

</div>

Set `max_undelivered_messages` to about 1.5 times the `metric_batch_size`, you probably want to reduce both of these to about `1000` as well as they make up the number of “in flight” metrics.
