From owner-freebsd-hackers Tue Feb 6 07:50:37 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id HAA19535 for hackers-outgoing; Tue, 6 Feb 1996 07:50:37 -0800 (PST) Received: from zappa.cs.uncc.edu (zappa.cs.uncc.edu [152.15.35.2]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id HAA19530 for ; Tue, 6 Feb 1996 07:50:34 -0800 (PST) Received: by zappa.cs.uncc.edu (5.x/SMI-SVR4) id AA13100; Tue, 6 Feb 1996 10:40:28 -0500 From: jlrobins@zappa.cs.uncc.edu (James Robinson) Message-Id: <9602061540.AA13100@zappa.cs.uncc.edu> Subject: Re: Swap adding daemon To: Duncan.Barclay@pa-consulting.com (Duncan Barclay) Date: Tue, 6 Feb 1996 10:40:27 -0500 (EST) Cc: freebsd-hackers@freebsd.org In-Reply-To: <31178897@SMTPGATE.PA-CONSULTING.COM> from "Duncan Barclay" at Feb 6, 96 08:47:00 am X-Mailer: ELM [version 2.4 PL24] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org Precedence: bulk > I am going to write a daemon to keep an eye on the ammount of swap used > and add extra to the system using the vn driver. if a threshold is crossed. > I ensivige this to be useful to people with home machines which are rebooted > most days and dont always need loads of swap space. The swap files > created would be deleted on the next reboot by rc or as part of the daemon > configuration. Good idea! And if the ability comes to unswap from a device, then it could do that too! Sortof of an amd for swap. > > Questions: > Has anyone done it before. > > Would a fstab like config script be better than > automatically finding spare vnodes in /dev and > allocating space. > ie. > #file vnode size threshold > # to create on > /usr/tmp/swapfile1 /dev/vn0a 12M 80% > /usr/tmp/swapfile2 /dev/vn0b 12M 80% > /disk2/tmp/swapfile /dev/vn0c 24M 90% > where the threshold is the percentage of currently used swap. Hmm. fstab syntax is the way to go. I assume that the system, in this case, would add /usr/tmp/swapfile1, after creating it to be 12M, first, once the system exceeds 80% swap capacity. Then, after some time, swapfile2 is joined in after the previously augmented swap space exceeds 80%. Etc. > > Should the swap usage be looked at over a long time to determine > threshold or be faily reactive? Hmm, since we can't remove swap at this moment in time, I'd lean towards the more conversative. What two threshold fields, one to specify 5 minute avg swap usage, and the other to specify one minute swap usage? So, it would add that space if the one minute swap load reading exceeded 95%, or add it if the 5 min swap load average exceeded 75%. This would handle a heavy swap hog (netscape, anyone?), or a general increase in load over time. Just my $.02 -- good idea! Heck, you could prototype it in a script language.