[Freeipa-devel] mod_wsgi global data

Dmitri Pal dpal at redhat.com
Thu Jul 7 23:30:04 UTC 2011


On 07/07/2011 07:01 PM, John Dennis wrote:
> Just a follow-up to yesterday's meeting on session support. We were
> pretty sure Python global data is local to the apache child process
> hosting the interpreter and will not be available to other request
> handlers. Stephen also suggested utilizing memcached. FYI both of these
> are validated in mod_wsgi documentation, which I've copied below. Also
> Adam has made a suggestion of using sqlite backed by a file in /dev/shm.
>
> ------------------------------------------------------------------------
>
> Application Global Variables
>
> Because the Python sub interpreter which hosts a WSGI application is
> retained in memory between requests, any global data is effectively
> persistent and can be used to carry state forward from one request to
> the next. On UNIX systems however, Apache will normally use multiple
> processes to handle requests and each such process will have its own
> global data.
>
> This means that although global data can be used, it can only be used to
> cache data which can be safely reused within the context of that single
> process. You cannot use global data as a means of holding information
> that must be visible to any request handler no matter which process it
> runs in.
>
> If data must be visible to all request handlers across all Apache
> processes, then it will be necessary to store the data in the filesystem
> directly, or using a database. Alternatively, shared memory can be
> employed by using a package such as memcached.
>
> Because your WSGI application can be spread across multiple process, one
> must also be very careful in respect of local caching mechanisms
> employed by database connector objects. If such an adapter is quite
> agressive in its caching, it is possible that a specific process may end
> up with an out of date view of data from a database where one of the
> other processes has since changed the data. The result may be that
> requests handled in different processes may give different results.
>
> The problems described above can be alleviated to a degree by using
> daemon mode of mod_wsgi and restricting to one the number of daemon
> processes in the process group. This will ensure that all requests are
> serviced by the same process. If the data is only held in memory, it
> would however obviously be lost when Apache is restarted or the daemon
> process is restarted due to a maximum number of requests being reached.
>
After careful evaluation of the complexity of the issue it seems that it
is impossible to address in the scope of 2.1 in the remaining time.
Since this is a desirable but not required feature I suggest (following
some private comments) we defer it till after 2.1.
Let us focus on making other parts of 2.1 fully function in the
remaining two weeks.
John, please move the ticket into the "2.1 deferrable" bucket and pick
up some other tasks that Rob has in the back log.
We will get back to this issues as soon as we are done with 2.1.

-- 
Thank you,
Dmitri Pal

Sr. Engineering Manager IPA project,
Red Hat Inc.


-------------------------------
Looking to carve out IT costs?
www.redhat.com/carveoutcosts/






More information about the Freeipa-devel mailing list