brubeck icon indicating copy to clipboard operation
brubeck copied to clipboard

m2reader.py PULLs Mongrel2 requests meant for Brubeck

Open stuntgoat opened this issue 13 years ago • 5 comments

I noticed that m2reader.py is using a 0mq PULL socket, which, when testing the websockets demo, steals every other message from Mongrel2. According to the 0mq documentation, PULL socket types respond to PUSH socket types; PUSH socket messages are sent 'round-robin' to all down stream nodes. That is, messages sent from Mongrel2 over the PUSH socket are alternately PULLed from Brubeck and the m2reader.py.

I think this is why my websocket requests are being eaten, so to speak, by m2reader.py. I don't know how you would want to fix this, since in order to get m2reader.py to stop eating messages it would have to be changed to a SUB socket type; this would require the Mongrel2 PUSH socket, that I am assuming Brubeck subscribes to, be changed to a PUB socket.

stuntgoat avatar Apr 23 '12 04:04 stuntgoat

Yes, that's correct. m2reader wasn't really designed to be a middle point between brubeck and mongrel2, but I think that might actually be a great idea.

@jordanorelli once proposed this and I think I shot it down then, but I'm realizing it's a good idea.

j2labs avatar Apr 26 '12 20:04 j2labs

Isaac, this could be a pretty awesome project. It would involve building a middle man between Mongrel2 and Brubeck such a message can be read from Mongrel2 and then forwarding it along.

I think it could be a little tricky for users since it would have to introduce an addition ZeroMQ socket to consideration. I'm not sure how to handle that yet.

j2labs avatar May 16 '12 08:05 j2labs

I wonder if it would be as simple as passing log=True to the Connection class. If True, open a zmq PUB socket to forward the zmq_msg acquired in self.recv, before returning it. Something(s) could open a zmq SUB socket to the logger socket. This should receive every message sent from Mongrel2 to Brubeck and allow for multiple clients to read from the logger.

stuntgoat avatar May 16 '12 18:05 stuntgoat

Yes! Great idea!

Wanna try implementing it? It will probably require adjustments to brubeck.connections too, meaning this should also work for WSGI messages.

On Wednesday, May 16, 2012 at 2:06 PM, Isaac wrote:

I wonder if it would be as simple as passing log=True to the Connection class. If True, open a zmq PUB socket to forward the zmq_msg acquired in self.recv, before returning it. Something(s) could open a zmq SUB socket to the logger socket. This should receive every message sent from Mongrel2 to Brubeck and allow for multiple clients to read from the logger.


Reply to this email directly or view it on GitHub: https://github.com/j2labs/brubeck/issues/66#issuecomment-5747603

j2labs avatar May 16 '12 18:05 j2labs

Great! Yes, I'll take a shot.

stuntgoat avatar May 16 '12 19:05 stuntgoat