From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 4 12:46:40 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5910137B401 for ; Fri, 4 Jul 2003 12:46:40 -0700 (PDT) Received: from yertle.kcilink.com (yertle.kcilink.com [216.194.193.105]) by mx1.FreeBSD.org (Postfix) with ESMTP id D568243FA3 for ; Fri, 4 Jul 2003 12:46:39 -0700 (PDT) (envelope-from khera@kcilink.com) Received: by yertle.kcilink.com (Postfix, from userid 100) id 5AC732178C; Fri, 4 Jul 2003 15:46:39 -0400 (EDT) From: Vivek Khera MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16133.55711.263062.288990@yertle.int.kciLink.com> Date: Fri, 4 Jul 2003 15:46:39 -0400 To: hackers@freebsd.org X-Mailer: VM 7.14 under 21.4 (patch 12) "Portable Code" XEmacs Lucid Subject: process sizes X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jul 2003 19:46:40 -0000 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@kciLink.com Rockville, MD +1-240-453-8497 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/