Skip to content

Producer drops messages under heavy workload with batch_send=True #170

Closed
@yongkun

Description

@yongkun

The SimpleProducer dropped about 2/3 messages in my test when using producer sent to broker on another machine with Kafka 0.8.1.
I set batch size to 100, each message in my test is about 800 bytes.
buffer.size is default (100KB).

Test code:

from kafka.client import KafkaClient
from kafka.producer import SimpleProducer

kafka = KafkaClient("host:9092")

producer = SimpleProducer(kafka,
            async=False,
            #req_acks=Producer.ACK_AFTER_LOCAL_WRITE,
            #ack_timeout=Producer.DEFAULT_ACK_TIMEOUT, # 1000ms
            batch_send=True,
            batch_send_every_n=100,
            batch_send_every_t=1000)

data_file = "mylog.log"

count = 0
with open(data_file) as f:
    for line in f:
        producer.send_messages("my-topic", str(count) + line)
        count += 1

There is no problem when the batch_send is disabled.
I also tested the Java client, no messages dropped.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions