Even in multiprocess embedded mode, a subsequent request could still
come back to the same process. So quite normal for a global singleton
once created to be reused on subsequent request. Quite fine for single
threaded processes. If multithreaded, then would need mutex locks on
creation and potentially access and use of the singleton. Depending on
what it is, for multithreaded, you may want to use threading.local()
instead so that each thread has its own copy of the object.

Graham

On 11 November 2012 04:31, miso <[email protected]> wrote:
> Hello and thanks Graham.
>
> I'm analyzing the different modes and their behaviors. This happens when I
> use a singleton class, the instance keep alive even in the next request,
> where the same process is used for handle it. This is common in daemon mode.
> But I've noticed that this happens also in the embedde mode.
>
> Sorry for this questions. I am programing a little framework for wsgi
> enviroment. I know that exist framework like flask, django but I am just
> doing it for learn purpose. I want to know how work a web server...
>
> I will read the link.. Thanks for the reply.
>
>
>
>
>
> On Sat, Nov 10, 2012 at 12:04 AM, Graham Dumpleton
> <[email protected]> wrote:
>>
>> On 10 November 2012 07:54, miso <[email protected]> wrote:
>> > Hello everyone
>> >
>> > I have a question about embeded mode operation. I thought that for every
>> > request, a new process is started..
>> > After seeing strange behavior in my code, I realized that the processes
>> > do
>> > not die, remain active.
>> > When I make a request to the server, such request fall somewhere above
>> > process with already instantiated objects. Objects of previous request.
>> >
>> >
>> > This is normal? Thanks
>>
>> A process is not created per requests. A single process can handle
>> more than one request, all handled within same sub interpreter for
>> that application. For embedded mode on UNIX systems there would
>> generally be more than one process.
>>
>> In other words, once a process/sub interpreter/application are setup,
>> they are kept around as long as possible.
>>
>> Under embedded mode Apache may itself decided to kill off or create
>> more processes as it deems necessary to handle the current throughput.
>>
>> More details can be found in:
>>
>> http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading
>>
>> Graham
>>
>> --
>> 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.
>>
>
> --
> 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.

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