diff --git a/kafka/monitoring-kafka-performance-metrics.md b/kafka/monitoring-kafka-performance-metrics.md index 1acaef4..11a187e 100644 --- a/kafka/monitoring-kafka-performance-metrics.md +++ b/kafka/monitoring-kafka-performance-metrics.md @@ -202,8 +202,7 @@ If you are seeing low response rates, a number of factors could be at play. A go #### Metric to watch: Request rate The request rate is the rate at which producers send data to brokers. Of course, what constitutes a healthy request rate will vary drastically depending on the use case. Keeping an eye on peaks and drops is essential to ensure continuous service availability. If [rate-limiting](https://kafka.apache.org/documentation/#design_quotas) is not enabled, in the event of a traffic spike, brokers could slow to a crawl as they struggle to process a rapid influx of data. #### Metric to watch: Request latency average -The average request latency is a measure of the amount of time between when `KafkaProducer.send()` was called until the producer receives a response from the broker. "Received" in this context can mean a number of things, as explained in the paragraph on [response rate](#metric-to-watch-response-rate). - +The average request latency measures the timespan of a producer request in the purgatory. That is, between the request being created and its response being received. "Received" in this context can mean a number of things, as explained in the paragraph on [response rate](#metric-to-watch-response-rate). A producer doesn't necessarily send each message as soon as it's created. The producer's [`linger.ms`](https://kafka.apache.org/documentation/#producerconfigs) value determines the maximum amount of time it will wait before sending a message batch, potentially allowing it to accumulate a larger batch of messages before sending them in a single request. The default value of `linger.ms` is 0 ms; setting this to a higher value can increase latency, but can also help improve throughput since the producer will be able to send multiple messages without incurring network overhead for each one. If you increase `linger.ms` to improve your Kafka deployment's throughput, you should monitor request latency to ensure it doesn't rise beyond an acceptable limit. Since latency has a strong correlation with throughput, it is worth mentioning that modifying `batch.size` in your producer configuration can lead to significant gains in throughput. Determining an optimal batch size is largely use case dependent, but a general rule of thumb is that if you have available memory, you should increase batch size. Keep in mind that the batch size you configure is an upper limit. Note that small batches involve more network round trips, which can reduce throughput.