[Web-SIG] multi-threaded or multi-process wsgi apps

Chris Withers chris at simplistix.co.uk
Wed Nov 28 22:50:21 CET 2007


Tres Seaver wrote:
> 
> Note first that we use mod_wsgi's "daemon"-mode exclusively, 

Forgive me for being uninformed, but what are the other options?

> which
> implies creating one or more dedicated subprocesses for each "process
> group" defined in the Apache config.

Does each sub process get its own python interpretter?
(ie: does it have to reload all its config and open up its own database 
connections again?)

> In that mode, Apache may create new subprocesses at any time, and may
> destroy old ones (e.g., after reaching a max-requests threshhold).  The
> real issue isn't opening the ZODB;

Even if the ZODB doesn't have index files?

> cache.  A second issue for multi-process configurations is doing all the
> product initialization dance (for a Zope2 app) or processing ZCML (for
> either Zope2 or Zope3).  The "frist hit slow" problem is intrinsic to
> any lazy + scalable system.

Is there really no way that the "slow" work can be shared?

>> The second is a problem I see an app I'm working on heading towards. The 
>> app has web-alterable configuration, so in a multi-threaded and 
>> particular multi-process environment, I need some way to get the other 
>> threads or processes to re-read their configuration when it has changed.
>>
>> Hope you guys can help!
> 
> Making the ZODB connection pool sharable across processes doesn't seem
> feasible.

Indeed, but I don't see this app having any zodb connections 
(necessarilly ;-) )

But, even if you were using, say SQLAlchemy and its connection pooling, 
wouldn't each process end up having its own connection pool, etc?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Web-SIG mailing list