On Sep 7, 2006, at 3:42 PM, Graham Stratton wrote:

> When I ran the app using paster, I was able to maintain one connection
> per thread, which amounted to about 11 connections to the external
> system.

Connection using what db system? If the db system you're using is  
told to use a thread pool, it'll likely be the one doing so, not Pylons.

> When I switched to mod_python, I quickly got nearly 200 connections  
> (at
> which point the system refused to give any more), having made slightly
> fewer than that many requests. I then assumed that Apache would only
> allocate one request to any process at once, so I then changed my code
> to only make one connection per process.  This seemed to work, and  
> kept
> the number of connections at 15. (My tests were with 10 concurrent
> requests; Apache is configured to keep 5 processes free).
>
> This all suggests to me that Apache allows one request per process,  
> but
> the Pylons processes spread those requests (unnecessarily) between
> threads. Is that true?  Should one or the other be configured
> differently?

In the mod_python script, it uses the wsgi setting from Apache 2.0.  
So it knows to do threading if Apache is using the mpm worker, vs the  
prefork worker. Are you using SQLAlchemy?

I'd suggest putting a toggle in your db connection code to make it  
aware of whether its in threads or not (Pylons handles a single  
request at a time and has no threading of its own). The variable  
you'll want to check is environ['wsgi.multithread'] and environ 
['wsgi.multiprocess']. Let me know if those are being set improperly  
under mod_python.

HTH,
Ben

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss
-~----------~----~----~----~------~----~------~--~---

Reply via email to