[zeromq-dev] PGM, Memory, and HWM.

Olivier olivier.chamoux at fr.thalesgroup.com
Tue Jun 1 12:00:53 CEST 2010

Hi all,

(yet an other topic on HWM :) )

I have some questions about pub-sub model, OpenPGM and watermarks.

(Resume of a little discussion with Martin : )

> Olivier wrote:
> I've understand 2 use-cases :
> => With one publisher and one (or more) consumer(s) : 
> If a subscriber is too slow to process messages from the sender, the
> sender "bufferize" it. => RAM increase on the sender side. ok.
> =>  With only one publisher, no consumer :
> Radio-like transmission, then the messages should be drop silently.
> And memory shouldn't increase in this case, right ?
> If right, why using a simple publisher (like in attachment), 
> i observe my RAM increasing more and more ?

Martin's answer :

> Martin Sustrik wrote:
> The problem is that there are two buffers involved. There are OpenPGM's 
> tx and rx windows as well as 0MQ queues both sender and receiver.
> In ideal case these should be conflated into a single entity but that's 
> technically pretty difficult to achieve.
> Anyway, size of OpenPGM buffers is computed from ZMQ_RATE and 
> Maximal size of 0MQ buffer (on both sender and receiver size) is set 
> using ZMQ_HWM socket option. The default is "no buffer limits" which is 
> what you are experiencing afaict.
> Martin

So, if there are "slow consumers" it's the openPGM buffer which increase (but it's size is fixed).
And in my case (one publisher, no consumer), it's 0mq queue which increase more and more.

Then, to avoid "infinite buffer", i set a HWM.
Now, i observe my throughput decreasing.

Does it mean that my value of HWM is too small considering how fast i create my messages,
and because zmq doesn't free buffer fast enough, some of them would be not buffered ?

In this case, how to calculate the optimal value of HWM in order to use the minimum amount of memory, 
without impact on the throughput, considering the speed of deallocation in zmq queue ?


More information about the zeromq-dev mailing list