Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mongrel2 vs. NGINX+ZeroMQ?

I see this new NGINX+ZeroMQ project on github and am now confused.

What are the feature and scalability differences between Mongrel2 and NGINX+ZeroMQ.

(The reason why I ask is because I'm under the impression Mongrel2 was solely created since NGINX didn't support ZeroMQ)

like image 208
nickb Avatar asked Jan 06 '12 22:01

nickb


2 Answers

I also read about the nginx+zeromq module and I immediately spotted a considerable difference.

ZeroMQ nginx module uses REQ/REP sockets to communicate with the backend processes. On the other hand mongrel2 uses two sockets. One PUSH/PULL to send messages downstream (to the handlers) and one PUB/SUB (to receive responses from handlers). This makes it totally asynchronous. When mongrel2 sends a request to the backend handlers it returns immediately from the zmq_send() call and the response will be received in another socket, anytime later.

Another difference is that mongrel2 is capable of sending the same response to more than one client. Your handler can tell mongrel2 something like this: "Deliver this response to connections 4, 5, 6 and 10, please". Mongrel2 send the connection ID within the message to the handlers.

Hope this helps! =)

like image 165
Dalton Barreto Avatar answered Nov 10 '22 16:11

Dalton Barreto


NGINX+ZeroMQ has bugs. 1. It does not work with NGINX 1.5 reason NGINX before doing send to ZMQ server(for that it calls send chain) upstream hook, tests whether connection is valid or not. And it would fail because it has ZMQ socket and not TCP socket as protocol is different it would say its an invalid connection.

  1. There are plenty more like that.

  2. This module does not support keepalive. Not only upstream but even downstream would not work. I am struggling with making keepalive work at downstream.

My recommendation: It would take two man month to implement ZMQ NGINX with keepalive.

like image 43
Prashant Singh Avatar answered Nov 10 '22 15:11

Prashant Singh