On Sun, 2013-07-07 at 23:33 -0700, icook wrote:
> Hello all,
>
>
> I've been working on a site I'm building with Pyramid for a while now,
> and I'm hitting a bit of an understanding stumbling block. I've read
> the docs that mention thread locals and how they interact with
> requests, but what I'm still fuzzy on is how and when does Pyramid
> spawn new threads? Is there a new thread for each request? Is there a
> single master thread that dispatches view callables to run in a new
> thread? This is how I imagine it working, but short of reading through
> the code thoroughly I'm at a bit of a loss. While it's probably not
> critical to know this to reach my end goal, I like to know how stuff
> ticks.
Pyramid itself doesn't handle any of that. All of the threading is done
by the WSGI server, so it depends which WSGI server you're using. In
general, though, most WSGI web servers are either multiprocess or
multithreaded. The multithreaded ones generally either spawn a new
thread for each request or keep a thread pool around where threads are
reused to perform work.
>
>
> Oh, and a bit of info on my end goal for those interested. In a
> nutshell I'm trying to setup some way for my views to send tasks that
> are too time consuming (big db updates, etc) to a worker thread to be
> done asynchronously.
I'd probably suggest an existing message queue system for this. There
are several; Celery seems to be popular.
>
>
> Also, if contributors read this I wanted to say thanks. Pyramid is a
> great framework.
Thank you!
- C
>
>
> Isaac
>
> --
> You received this message because you are subscribed to the Google
> Groups "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
pylons-discus...@googlegroups.com.
> To post to this group, send email to
pylons-...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/pylons-discuss.
> For more options, visit
https://groups.google.com/groups/opt_out.
> --
> You received this message because you are subscribed to the Google
> Groups "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
pylons-discus...@googlegroups.com.
> To post to this group, send email to
pylons-...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/pylons-discuss.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>