以下是在Debian系统上提升Kafka吞吐量的关键优化措施:
batch.size
(建议1M~2M)、linger.ms
(50~100ms)以减少网络请求。compression.type
(如lz4),减少传输数据量。num.network.threads
(建议8~16)和num.io.threads
(建议16~32)。log.retention.hours
定期清理数据,避免磁盘占满。buffer.memory
(建议64M以上),增大消息缓存。acks
参数,根据可靠性需求选择1
或all
。fetch.min.bytes
(建议1M)和max.poll.records
(如1000),批量拉取消息。min.insync.replicas
控制同步副本数。sendfile
减少数据拷贝,提升传输效率。kafka-producer-perf-test
和kafka-consumer-perf-test
模拟流量,验证优化效果。