process sizes

Vivek Khera khera at kcilink.com
Fri Jul 4 12:46:40 PDT 2003


Hi, we're preparing another update to the mod_perl (version 1)
release, and there is an issue with the Apache::SizeLimit module for
it under *BSD (in my case FreeBSD specifically).

The purpose of the SizeLimit module is to enable the server to
gracefully exit when it is using more resources than it should (for
example, after running a large database report) it can gracefully exit
once done.  So far, the most effective use of this module is to limit
the amount of "unshared" data space it is using, as one of the major
benefits of mod_perl is to share much of the perl code pages (which
are data as far as the OS is concerned).

Now, currently, the BSD code from SizeLimit reads like this:

sub bsd_size_check {
    return (&BSD::Resource::getrusage())[2,3];
}

This routine is intended to return the current process size and shared
memory size.  However, the getrusage() above is not really doing what
is intended.  The shared pages value returned is way wrong (only text
pages are given by getrusage) and the current process size is not the
MAX RSS, which is returned above.

I'm at a loss as to what to use to measure the current process size
and also to measure the amount of virtual memory in use by that
process that is in shared pages.

If anyone has good code to get this information on FreeBSD (and other
BSD's in general) please let me know.  If additional libraries are
needed, that's ok.  If we have to poke around /proc, that's ok to.

I'd appreciate direct replies since I'm away at OSCON next week and
don't want to miss anything.  Thanks.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.                Khera Communications, Inc.
Internet: khera at kciLink.com       Rockville, MD       +1-240-453-8497
AIM: vivekkhera Y!: vivek_khera   http://www.khera.org/~vivek/


More information about the freebsd-hackers mailing list