[rabbitmq-discuss] Puka client and publisher confirms performance

Marek Majkowski majek04 at gmail.com
Wed Mar 14 14:41:52 GMT 2012

>> Right, to the point:
>>  - first part of code adds messages to the write buffer - no network
>> activity
>>  - second part of the code - wait for replies from rabbit
>>    (there may be some cpu cost for managing a big number of promises,
>>     within Puka library, this is TBD)
>> Marek
> What is the limit for this buffer ? If understand correct he messages are
> actually sent only when you wait for the promises
> or you close the connection. This means that if my connection to a server
> closes before start waiting for promises, I must resent all messages ?

No, all things in puka are initially written to the write buffer.
(this is true for almost any networking library)

But, as opposed to other libs, Puka does flush (write to the socket)
the buffer only when you ask it to. This usually happens when
you call puka.wait() or you can do it when you're having an async
loop implemented by yourself.

You can force the buffer flush by calling puka.on_write()

But this is not usually necessary to call it outside of the event loop.

> Maybe periodically flushing the buffer could speed up things ?

You can call on_write every 100 messages or so and see if your
code gets faster (I doubt it, but maybe).

I don't know if the bottleneck in the code you posted is Puka,
networking layer in python or Rabbit.


More information about the rabbitmq-discuss mailing list