views:

60

answers:

1

Hi,

I'm designing a distributed system in which a single-threaded server processes perform a CPU intensive operation. These operations are triggered by ZeroMQ network messages.

If the single-threaded process is performing the CPU intensive work, will the I/O (ZeroMQ sockets) block?

Thanks!

+1  A: 

You'll block on reading messages if there's no messages to read.

You'll block on sending if the number of outstanding messages exceeds ZMQ_HWM (default it has no limit, but there's a practical limit as to how much memory you have), It seems to depend on the socket type if messages are simply dropped(you won't block in that case) when that limit is reached.

You can specify the flag ZMQ_NOBLOCK if you don't want to block in any of the cases - zmq_send/zmq_recv will fail instead of block in those cases.

nos