[zeromq-dev] Incoming data on multiple sockets and fairness

gonzalo diethelm gdiethelm at dcv.cl
Tue Mar 9 17:54:16 CET 2010


Martin, as usual, thank you for your insightful comments. It is a
pleasure to be able to easily convey context, and receive back guidance
which is very appropriate for that context.

> Yes, right. As the queries and updates are the "same" thing (from the
> business logic point of view) it makes sense to process them using a
> single socket. Doing so would guarantee fair balancing.

Agreed.

> It seems that "Queries" (including updates) and "Notifications" are
> indeed distinct things (from the business logic POV) so there should
be
> two separate sockets. Handling multiple sockets requires using
zmq_poll.

Ok.

> As for fairness guarantee, it depends on your requirements. You may,
for
> instance, want to process notifications before queries etc. With
> zmq_poll you are free do process the messages in whatever order you
like.

I believe that, for my particular case, I will process all Notifications
before processing Queries and Updates.

> >> It's strictly level-triggered.
> >
> > Please refresh my mind... This means the poll is signaled only once
and
> > I must make sure to process everything that is pending before
calling
> > poll again, right?
> 
> No. The other way round. Poll will be signaled every time there's a
> message to read in the socket.

Let me be obtuse and offer an example: I will be calling poll on two
sockets, A and B. Say I call poll and block because there are no pending
messages; then, A receives 100 messages; poll returns, I notice I can
read off A and read 5 messages to process them; then I call poll again
on the same sockets. What you are saying is that this second call to
poll will return right away, even if no new messages have been received
after the initial 100 messages, because there are still 95 pending
messages for A. Is this correct?

-- 
Gonzalo Diethelm



----------------------------------------- 
Declaración de confidencialidad: Este Mensaje esta destinado para
el uso de la o las personas o entidades a quien ha sido dirigido y
puede contener información reservada y confidencial que no puede
ser divulgada, difundida, ni aprovechada en forma alguna. El uso no
autorizado de la información contenida en este correo podrá ser
sancionado de conformidad con la ley chilena. 
Si usted ha recibido este correo electrónico por error, le pedimos
eliminarlo junto con los archivos adjuntos y avisar inmediatamente
al remitente, respondiendo este mensaje. 

"Before printing this e-mail think if is really necesary".
Disclosure: This Message is to be used by the individual,
individuals or entities that it is addressed to and may include
private and confidential information that may not be disclosed,
made public nor used in any way at all. Unauthorized use of the
information in this electronic mail message may be subject to the
penalties set forth by Chilean law. 
If you have received this electronic mail message in error, we ask
you to destroy the message and its attached file(s) and to
immediately notify the sender by answering this message. 




More information about the zeromq-dev mailing list