[zeromq-dev] Preliminary results of voting

Martin Sustrik sustrik at fastmq.com
Tue Sep 2 19:16:36 CEST 2008


Pieter,

>> No. Bundling two messages into single packet will make the second one have
>> the same latency as if it was sent alone it its own packet. The first one
>> will have a slightly higher latency because it has to wait for the second
>> message to be submitted.
> 
> This is true if there is a wait.  But if I understand correctly, 0MQ
> is using internal queues so the writing thread is reading from a queue
> and writing to a socket; surely the queue will in some cases fill up
> faster than the output can be sent.  In such cases it costs nothing to
> take multiple messages off the queue and send as a single network
> package.  This means one stack traversal, with no extra wait time
> except the marginal cost of taking more data off the queue.  Have I
> misunderstood something?

Ah, you've meant it that way. So yes, if messages are queued, they are 
retrieved form the queue using single atomic operation (up to 300 
nanoseconds). Then they are passed to the network in batches. Size of 
the batch is configurable in config.hpp (currently 8192 bytes).

However, it this scenario latency is kind of irrelevant. Messages are 
*queued* rather than streamlined - meaning that they are delayed anyway.

Martin



More information about the zeromq-dev mailing list