Re:Nginx 0mq transport layer for communicating with upstream...
by technoweenie on Friday January 06, 2012 @08:38PM
(#3435871)
Mongrel2's ZMQ protocol was designed for lightweight messages against async handlers. Instead of a synchronous ZMQ REQ/REP pair that this nginx module uses, Mongrel2 used a combination PUSH/PULL sockets to send the request, and PUB/SUB to get a response.
Say you want to map /chat to a handler. Mongrel2 opens a PUSH socket, and a SUB socket connecting to one or more chat handlers. The handlers open a PULL and PUB socket. Mongrel2 will spread requests to /chat across the available handlers, and receive all published responses. It's a pretty smart way to handle multiple handlers receiving requests at the same time. It's been a while since I looked at Mongrel2, so it's very possible I have some of the details wrong...
Say you want to map /chat to a handler. Mongrel2 opens a PUSH socket, and a SUB socket connecting to one or more chat handlers. The handlers open a PULL and PUB socket. Mongrel2 will spread requests to /chat across the available handlers, and receive all published responses. It's a pretty smart way to handle multiple handlers receiving requests at the same time. It's been a while since I looked at Mongrel2, so it's very possible I have some of the details wrong...