[zeromq-dev] zeromq & pylons

Brian Granger ellisonbg at gmail.com
Tue Aug 3 21:48:21 CEST 2010


Eric,

I don't know enough about pylons to know what it does with threads.  But, if
pylons is not using threads, you are fine.  But if pylons is running
handlers in threads, you will need to create sockets for each thread.  If
pylons is load balancing requests to a thread pool, you will need to make
sure that ZMQ sockets stay with a single thread.  But, the Context object is
thread safe, so you can create a single Context at the app_global level and
use that to create all of your sockets.

If you can provide more details about pylons threading model we can help
with more specifics.

Cheers,

Brian

On Tue, Aug 3, 2010 at 12:43 PM, Eric Bell <eric at ericjbell.com> wrote:

> I am developing an application using pylons and I am concerned about the
> implications of something I read in Pieter's user guide (thanks for that,
> btw, the explanation of how bind/connect is used to define the topology was
> very helpful)
>
> THE QUOTE: "You MUST NOT share sockets between threads. ØMQ will in some
> future make it possible to move sockets to different threads. Right now the
> thread which creates a socket is the only thread that may use it."
>
> I am new to both pylons and zeromq, so I have a lot of murkiness about how
> all this works. I imagine that pylons "handlers" come from some sort of
> thread pool, but honestly I have no real idea what's happening under the
> hood. In my initial design, I create zeromq sockets and store them in the
> app_global object. My thinking was that then any handler "thread" could
> have
> access to the sockets. Upon reading the quote above I am now concerned that
> I have violated a basic restriction on how to use ZeroMQ sockets.
>
> It works right now but maybe I just haven't loaded my server enough to
> cause
> it to break.
>
> I welcome any thoughts or suggestions. Thanks,
>
> --eric
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



-- 
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu
ellisonbg at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100803/b56f03cb/attachment.htm>


More information about the zeromq-dev mailing list