pykafa Producer get_producer 5秒发送一次消息,__consumer_offsets生成大量日志问题

本文分享了使用PyKafka发送和消费数据时遇到的两个问题及解决方案。问题一在于生产者每隔5秒发送一次消息,通过调整linger_ms参数为0以提高效率。问题二是在消费者端,`__consumer_offsets`主题生成大量日志导致磁盘空间快速耗尽,通过增大auto_commit_interval_ms到60000ms来减少日志写入频率,从而解决磁盘空间问题。
摘要由CSDN通过智能技术生成

python 通过 pykafka 发送数据和消费数据,遇到两个问题,与大家分享下。

问题1

1. 通过pykafa 发送数据时候,每隔5s才发送一次,几百万数据,效率大大影响。

生产者只有get_producer 方法,当前参数 ack_timeout_ms=1000, linger_ms=5000只有两个。

查询官网 https://pykafka.readthedocs.io/en/latest/api/producer.html

linger_ms 参数 默认为5000,刚好5s,修改为0,来了就发送。

linger_ms (int) – This setting gives the upper bound on the delay for batching: once the producer gets min_queued_messages worth of messages for a broker, it will be sent immediately regardless of this setting. However, if we have fewer than this many messages accumulated for this partition we will ‘linger’ for the specified time waiting for more records to show up. linger_ms=0 indicates no lingering - messages are sent as fast as possible after they are

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值