[zeromq-dev] Pub/Sub LWM Limit
j.kreuzberger at procitec.de
Fri Aug 8 08:48:29 CEST 2014
> im trying zeromq pub/sub pattern the first time an do some first basic
> examples with it.
> i have tested the hwm/lwm feature on pub/sub an run into following problem:
> if i set a hwm on the pub socket (e.g. 5000) the lwm is automatically
> calculated to 2500.
> In my sub i then can receive 2500 messages, and then get EAGAIN
> (non-blocking mode). So it seems the pub seems not to send the messages,
> until i add new ones again, so i get over the lwm limit.
> Must i tell the publisher that no more message will come to "flush" the queue?
> Or must i close the socket to get the messages flushed?
> Or must i set the hwm to 0 to get the messages flushed?
> Thanks for supporting a newbie
ok, found out what my problem was by using test_hwm.cpp and replacing it
I set a hwm limit to 2000 and send messages to it. After 2000 all other
messages are dropped. thats ok.
sub gets 2000 messages in read loop, until no more are left. Thats ok also
internal pub (pipe_t) is in this state: pipe member peers_msgs_read = 1000.
peers->msgs_read = 2000.
If i send now messages to pub, after 1000 the messages are dropped. (1000
new + 1000 that are detected as not send = 2000 == hwm).
on the sub side, i get the next 1000 messages.
my assumption was that after getting the 2000 messages on sub side, i could
send 2000 into pub before they are dropped. But seems that after the first
"fill" of the publisher, i could only send messages in hwm-lwm (lwm = hwm/2)
More information about the zeromq-dev