As described at the documents, WSGIApplication directive "can be used to 
specify which application group a WSGI application or set of WSGI applications 
belongs to. All WSGI applications within the same application group will 
execute within the context of the same Python sub interpreter. " .
   In the source code, all sub interpreters are stored at a global variable 
"wsgi_interpreters" and it is shared within a daemon process. I just curious 
about the situation when multiple daemon  processes (within the same process 
group or not, whatever) are serving at the same time, WSGI applications, which 
are within a same application group, will probably be execute at different 
daemon process or even process group, depending on the configuration. So at 
that case, WSGI applications don't execute witnin the context of the same 
python sub interpreter. Considering the following cases:
 

1. Considering the following httpd.conf file, all scripts at /usr/wsgi/script 
and /usr/wsgi/script2 belong to process group www.site1.com and www.site12.com 
respectively, but to the same application group joshua_app_group_1, then all 
scripts at /usr/wsgi/script/ and those at /usr/wsgi/script2/ will execute 
within two distinct sub interpreters whose name are both 'joshua_app_group_1'. 

    WSGIScriptAlias /wsgi/script  "/usr/wsgi/script/"
    WSGIScriptAlias /wsgi/script2  "/usr/wsgi/script2/"
    WSGIDaemonProcess www.site2.com   processes=2 threads=25 
display-name=%{GROUP}
    WSGIDaemonProcess www.site1.com  processes=2 threads=25  
display-name=%{GROUP}

    <Directory "/usr/wsgi/script/">
    WSGIProcessGroup www.site1.com
    WSGIApplicationGroup joshua_app_group_1
    Allow from all
    </Directory>

    <Directory "/usr/wsgi/script2/">
    WSGIProcessGroup www.site2.com
    WSGIApplicationGroup joshua_app_group_1
    Allow from all
    </Directory>

2. unlike the previously case, all scripts at /usr/wsgi/script/ belong to the 
same process group and application group, but multiple daemon process are still 
serving. It still isn't guarantee that all scripts will execute at the same sub 
interpreter. Actually, two sub interpreters named "joshua_app_group" will be 
created at each daemon process. Which sub interpreter will be designated to 
excute the script depends on which daemon process is designated to handle the 
request.

    WSGIScriptAlias /wsgi/script  "/usr/wsgi/script/"
    WSGIDaemonProcess www.site.com   processes=2 threads=25 
display-name=%{GROUP}
    <Directory "/usr/wsgi/script/">
    WSGIProcessGroup www.site.com
    WSGIApplicationGroup joshua_app_group
    Allow from all
    </Directory>


So my conclusion is the scripts within the same application group "will execute 
within the context of the same Python sub interpreter" if and only if those 
scripts execute at a same process, daemon process(daemon mode) or Apache child 
process ( embedded mode). 

Is the conclusion correct, or I just misunderstand something? Any comments are 
welcome. Thanks!

2009-06-22 



Joshua Wang

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"modwsgi" 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/modwsgi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to