On Tuesday, March 22, 2011, Graham Dumpleton <[email protected]> wrote:
> On 22 March 2011 09:35, Eric Lemoine <[email protected]> wrote:
>> On Monday, March 21, 2011, Graham Dumpleton <[email protected]> 
>> wrote:
>>> Read:
>>>
>>>   http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading
>>>
>>> Embedded mode on UNIX is always going to be multiprocess, thus these
>>> are likely the script being loaded in different processes.
>>> Specifically, one will be the original page and the other a request
>>> for static resources via the application or a request for favicon.ico
>>> by the browser.
>>
>>
>> Yes I figured that out a couple hours after I wrote to the list.
>>
>> ...
>>
>> Below Is the modwsgi config I'm now considering (untested yet). In my
>> case I want to have multiple instances of the same WSGI app in the
>> same virtual host, and I want to isolate these instances as much as
>> possible.
>>
>> ---
>> #
>> # Use mod_wsgi's daemon mode.
>> # The WSGI app instance is assigned a specific process group.
>> #
>> #
>>
>> # define a process group
>> WSGIProcessDaemon ${instanceid} processes=1 threads=15
>
> Directive is WSGIDaemonProcess.
>
> Also don't use 'processes=1' if the application will run in one process.
>
> I know this sounds counter intuitive, but the default is actually for
> one process anyway.
>
> Use of 'processes=1' does also create one process, but use of the
> 'processes' option with any value causes 'wsgi.multiprocess' to be
> True. So, just allow the default single process to be created. Use of
> 'processes=1' should only be used as back door for flagging it is
> multi process if loading balancing application across multiple
> servers, or splitting a single application across multiple daemon
> process groups.
>
> The default number of threads is also already 15.
>
>> # define the path to the WSGI app
>> WSGIScriptAlias /${instanceid}/wsgi /path/to/script.wsgi
>>
>> # assign the WSGI app instance the process group defined above
>> # we put the WSGI app instance in the global application group so it
>> is always executed within in the main interpreter
>> <Location /${instanceid}/wsgi>
>>     WSGIProcessGroup ${instanceid}
>>     WSGIApplicationGroup %{GLOBAL}
>> </Location>
>
> So long as you are using mod_wsgi 3.0 or later, easier to get rid of
> this Location block and use:
>
> WSGIScriptAlias /${instanceid}/wsgi /path/to/script.wsgi
> process-group=${instanceid} application-group=%{GLOBAL}
>
> Just be aware that supplying process group and application group as
> options to WSGIScriptAlias will also cause the WSGI script file to be
> preloaded when daemon processes startup and not on first request.
> Although unlikely, this could be an issue for some applications.



Thanks a lot for your help Graham! We've now switched to "daemon
mode", and we're realizing the benefits it brings us.

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : [email protected]
http://www.camptocamp.com

-- 
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