[zeromq-dev] Thread Safe sockets

Marko Dieckmann Marko.Dieckmann at gmx.de
Tue Feb 7 11:07:12 CET 2012


I agree that this would be undesirable, but it doesn't have to be blocking. The simplest solution would be using ZMQ_NOBLOCK, the better solution using a non-blocking polling at a reasonable rate per second.
 We are using 0MQ for a game server, where low latency is the one thing that counts the most.


----- Ursprüngliche Nachricht -----
Von: Nadav Samet
Gesendet: 07.02.12 10:41 Uhr
An: Martin Sustrik
Betreff: Re: [zeromq-dev] Thread Safe sockets

 How readable is that? And what about the global variables? etc.

 I absolutely agree that recv() is more readable than using callbacks, but it has the undesirable characteristic that it blocks the calling thread until the response arrives... Imagine an RPC server A with a few worker threads that in order to process a request from a client it needs to make a request to another server B. Having a worker thread on server A blocking on recv() from a socket that is connected to server B will hurt performance. The waiting thread could have been serving other requests while it has been waiting inside recv().
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120207/cd9ebbeb/attachment.htm>


More information about the zeromq-dev mailing list