pulsar-client-python icon indicating copy to clipboard operation
pulsar-client-python copied to clipboard

Performance regression by 3.5.0 when batching is enabled

Open BewareMyPower opened this issue 1 year ago • 0 comments
trafficstars

Output of that with pulsar-client v.2.10.2:

Sent 1000 messages in 2.70 seconds
Sent 2000 messages in 5.40 seconds
Sent 3000 messages in 8.16 seconds
Sent 4000 messages in 10.83 seconds
Sent 5000 messages in 13.55 seconds
Sent 6000 messages in 16.14 seconds
Sent 7000 messages in 19.64 seconds
Sent 8000 messages in 22.45 seconds
Sent 9000 messages in 25.22 seconds
Sent 10000 messages in 28.01 seconds
Sent 11000 messages in 30.82 seconds 

Output with version v.3.5.0:

Sent 1000 messages in 102.92 seconds
Sent 2000 messages in 206.03 seconds
Sent 3000 messages in 308.82 seconds
Sent 4000 messages in 411.65 seconds
Sent 5000 messages in 514.40 seconds 
    def create_producer(self, topic,
        batching_enabled = True, batching_max_messages = 5000,
        max_pending_messages = 5000, batching_max_publish_delay_ms = 100,
        compression_type = CompressionType.LZ4):

        self.producer = self.client.create_producer( topic,
            batching_enabled = batching_enabled, batching_max_messages = batching_max_messages,
            max_pending_messages = max_pending_messages, batching_max_publish_delay_ms = batching_max_publish_delay_ms,
            compression_type = compression_type )

        return self.producer
    try:
        cnt = 0
        start_time = time.time()
        while True:
            message = ( "test123" )
            producer.send( ( message ).encode( 'utf-8' ) )
            cnt += 1
            if cnt % 1000 == 0:
                elapsed_time = time.time() - start_time
                print(f"Sent {cnt} messages in {elapsed_time:.2f} seconds")

BewareMyPower avatar Sep 11 '24 02:09 BewareMyPower