[zeromq-dev] Order by which PUB/SUB requests are sent/processed

Joegen Baclor jbaclor at ezuce.com
Wed Jan 25 02:41:23 CET 2012


Just in case someone finds time to look into my issue, I am attaching 
the publisher code.  Perhaps there is something I am doing wrong or 
options i need to set to achieve a fairly-queued sending of events.

On 01/24/2012 06:27 PM, Joegen Baclor wrote:
> Hi,
>
> We have an application the uses PUP/SUB sockets.  One requirement that 
> ZeroMQ gracefully meets is being able to reliably send events to all 
> subscribers.  However, there is a requirement in our application that 
> relies on which client gets the event first.  We were under the 
> assumption that ZeroMQ randomizes the sending of events to the mutiple 
> subscribers so that no one subscriber always gets a first hit.  
> Unfortunately, this seems to be not the case.  ZeroMq seems to follow 
> a specific fix order.  We have created 3 clients each incrementing a 
> counter if it was the first one to get the publication.  Take the 
> output below (each iteration is 1500 events):
>
> Iteration 0
> Client 1 processed 1496 events.
> Client 2 processed 0 events.
> Client 3 processed 4 events.
>
> Iteration 1
> Client 1 processed 2309 events.
> Client 2 processed 647 events.
> Client 3 processed 44 events.
>
> Iteration 2
> Client 1 processed 2992 events.
> Client 2 processed 1385 events.
> Client 3 processed 123 events.
>
> Iteration 3
> Client 1 processed 3623 events.
> Client 2 processed 1951 events.
> Client 3 processed 426 events.
>
> Iteration 4
> Client 1 processed 4207 events.
> Client 2 processed 2697 events.
> Client 3 processed 723 events.
> TestDriver::TestMultiplePop ...    Ok
>
> Clearly, the order is predictable.  client 1 gets the highest hit and 
> client 3 gets the lowest hit.  Is there a way so that we can spread 
> this evenly across the subscribers?
>
> Joegen
>
>
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: StateQueuePublisher.cpp
Type: text/x-c++src
Size: 2846 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120125/57032833/attachment.cpp>


More information about the zeromq-dev mailing list