Does anyone have any real-world scenarios that load-tested ZMQ sockets for maximum no. of \'concurrent users\' (not throughput) they can handle? Looks like ZeroMQ has some serio
What exactly do you mean when you say "each connection is opened and closed immediately"? You bind on a stream
socket, which accepts incoming requests in the while
loop, which runs perpetually and never closes anything. The call to zmq_close(socket);
after the loop is never reached.
Even the last part of the message explicitly uses ZMQ_SNDMORE
, which should keep the connection open waiting for more text. Presumably to allow a small number of clients a lower overhead for repeated connections, I guess. It should probably be:
zmq_send(socket, 0, 0, 0);
I don't know which of these issues would release the resources to allow a larger number of clients, if either, but probably it's an abuse of ZMQ (or at least misguided) to try and write an HTTP server in it or try to make it scale to millions of concurrent peers/clients.
node.js and nginx are event based concurrent I/O systems, they are significantly different architecturally from ZMQ, and they are made to solve different problems. Trying to make ZMQ into them is going about things the wrong way. What you probably want is to use node.js with socket.io, or if you're using it for HTTP then just use it's native http
module.