Discussion:
[zeromq-dev] pyzmq behind pyramid/pylons REST endpoint -- inproc and not block?
Mazzaroth M.
2016-11-13 01:01:19 UTC
Permalink
Hi all, I'm still pretty new to zeromq but I'm pretty excited about its
possibilities. So I have a python class that binds a Router while Dealer
workers connect over tcp. It is pretty much the example found at
http://www.hatchd.com.au/chookfeed/zmq-and-the-art-of-work-distribution/

I modified it such that the class will PULL from a client that is doing a
PUSH. Every time I get a PUSH I will pass the json along to the Router
which will distribute the task to a Dealer worker. So the webapp REST
endpoint does a backend_socket.connect("tcp://localhost:5754") to send the
json to the Router/Dealer. This seems to work nicely.

Pardon my noob question here but what I'd like to know is, if I incorporate
a Router/Dealer in the webapp process(using *inproc*), how do I architect
it such that zeromq proxy between the Router/Dealer does not block the
entire webapp upon initialization? I am talking about something like this
example in the guide: http://zguide.zeromq.org/py:mtserver

Is this possible or are most zeromq architectures in a separate running
process? Is there a better way?

regards,
Michael
Kevin Sapper
2016-11-17 11:08:11 UTC
Permalink
Hi Michael,

In C (czmq) we use actors to distribute work across threads. Have a
look at https://github.com/zeromq/czmq#toc2-8330 which explains the
idea. This approach is used for example with zyre or malamute.

//Kevin
Post by Mazzaroth M.
Hi all, I'm still pretty new to zeromq but I'm pretty excited about
its possibilities. So I have a python class that binds a Router while
Dealer workers connect over tcp. It is pretty much the example found
at
http://www.hatchd.com.au/chookfeed/zmq-and-the-art-of-work-distribution/
I modified it such that the class will PULL from a client that is
doing a PUSH. Every time I get a PUSH I will pass the json along to
the Router which will distribute the task to a Dealer worker. So the
webapp REST endpoint does a
backend_socket.connect("tcp://localhost:5754") to send the json to
the Router/Dealer. This seems to work nicely.
Pardon my noob question here but what I'd like to know is, if I
incorporate a Router/Dealer in the webapp process(using inproc), how
do I architect it such that zeromq proxy between the Router/Dealer
does not block the entire webapp upon initialization? I am talking
http://zguide.zeromq.org/py:mtserver
Is this possible or are most zeromq architectures in a separate
running process? Is there a better way?
regards,
Michael
Loading...