[mod_python] Resource consumption

Gregory (Grisha) Trubetskoy grisha at modpython.org
Mon Sep 8 09:53:57 EST 2003



On Mon, 8 Sep 2003, Neo Eureka wrote:

> IIUC, shared memory and semaphores are allocated even if I don't use
> sessions or PSP at all?

Yes (there is no shared memory used for sessions, only locks, which *may*
be semaphores or some other lock implementation, depending on your OS).

> Is there a way to completely "switch off" the features I do not (and
> will not) use ever ?

Not right now. I couldn't think of a way to do it that wouldn't be
confusing. Locks must be allocated at server startup so that children
have access to them. We could have a directive like "PythonSessionLocks
Off", IMHO that's on the ugly side.

Generally, I think keeping the number of Apache directive to a minimum is
a good idea.

> It seems very strange to me: features that I do not use still consume
> system resources

That's not unusual - as an example, every RH box will load all kinds of
modules (including mod_python), but few people ever use them all.

> and cause problems with server startup

This, I agree, *is* a problem, but I think I can work around it without
introducing new Apache directives.

Another point to consider is that on many other systems there will not be
a limit to the number of locks allocated, and there is no cost to
allocating a lock but never using it, so a directive like this wouldn't
make much sense.

Grisha

> (yes, I've got RedHat box).


>
>
> > On Sat, 6 Sep 2003, Conrad Steenberg wrote:
>
> >> This prompts a change in the kernel semaphore settings on older linuxes
> >> (redhat 7.3 specifically).
>
> > Well - I think this is really a redhat problem. I believe I even saw
> > something reporting it as a security problem - it is very easy for someone
> > to deprive an rh box of available semaphores. I wonder what the default is
> > on rh 8 and 9 (anyone?).
>
> >> As this will likely trip up new sysadmins that just want to try out the
> >> package,
>
> > It probably will :-(
> > But that's why there is a "Hint" in the error log for Linux users.
>
> >> is there a way to reduce the number of sessions (or space for
> >> these sessions) by using a directive?
>
> > Yes, there is a way - adjust MaxClients. Some MPM's (at least worker) will
> > alter MaxClients if the other directives do not add up to or exceed it, so
> > it's possible other values may need adjusting.
>
> > BTW, mod_python does NOT quit if it was able to allocate *some* locks, but
> > not *all*, it only writes a warning to the error log and proceeds. But
> > what craps out after that is mod_rewrite, which wants a global lock, but
> > mod_python has eaten them all. So perhaps I can adjust it so that if we
> > allocated *some* but not *all*, then to free one (or two?)  so that
> > mod_rewrite is happy.
>
> > (On the other hand doing this may seem like going too far to adress what
> > is really a lousy config default in the kernel....)
>
> > Grisha
>
>
> ---
> Neo Eureka / mailto:neo at https.ru
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list