durusmail: quixote-users: Re: Request contexts
Request contexts
2003-12-11
Re: Request contexts
2003-12-11
2003-12-11
2003-12-12
2003-12-12
2003-12-13
2003-12-13
2003-12-16
2003-12-16
2003-12-16
2003-12-16
2003-12-15
Re: Request contexts
2003-12-16
2003-12-16
2003-12-24
2003-12-30
2003-12-31
Re: Request contexts
Graham Fawcett
2003-12-13
Matt Goodall wrote:

> Dave Kuhlman wrote:
>
>> [snip]
>>
>>
>> Would that be safe?  My understanding is that, with SCGI at least,
>> different requests are running in separate processes.  Perhaps they
>> even have separate (Python) global interpreter locks.  So would
>> they be safe from each other when they modified the context object?
>>

Each Python process has exactly one GIL and its own global namespace, n'est-ce
pas? Only threads within a single process contend for the same GIL.

>>
> It depends on how you define safe ;-). With SCGI there is only one
> request being handled by a single process at any time. Access to the
> context and objects in it is inherently thread-safe (there's only one
> thread) but trying to use the context to store information that must be
> consistent across all of the application's SCGI processes will cause you
> much pain. This is true of any process forking setup.

[snip]

Great answer. My take on Matt's response is that persisting and sharing your
context would be no easier or harder than persisting and sharing any other
state between your worker processes.

-- Graham




reply