* Alan McKinnon <[EMAIL PROTECTED]> [050121 15:15] wrote: > On Thursday, 20 January 2005 18:07, Mark Miller wrote: > > Thanks for the insight James. Have you been in touch with Dave > > Edwards? We could use some items written in this area... > > Interesting thread this, we seem to agree that there is no firm answer. > I have some thoughts on this, perhaps they are worth discussing. I get > questions on swap often from my students, and the conclusions that come > up are: > > 1. You don't know how much swap you need till you measure it > 2. To measure it, you have to have made some swap anyway > 3. You can't increase your memory (RAM and swap) at the point when you > need it most - when you run out > 4. Once you've made a swap partition, it's hard to change it, usually > not worth the effort, and what you started with is what you end up > living with (not always of course, but this is often the case) > 5. How many users or even admins are in a position to detect when more > swap is needed before it crashes the box, and make an extra swap file > just-in-time?
Let me delurk for a moment... I would add to the your list above that too much swap is better than too little. Something unexpected may happen which could cause it to need to swap, which would be a problem if there is no swap space. This could be from the use of additional software, a script by a careless developer or sysadmin (*cough cough*), etc., or something completely out of left field. As for monitoring the swap partition, this is something we catch fairly often (albeit more often on other Unix platforms, where we're more likely to find databases which use a lot of swap). If a machine is swapping too heavily because it's thrashing, sure, you won't catch it. However, swap usage can increase slowly over time for some applications (such as databases). Changing swap settings isn't that difficult or useless, depending on how your machine was initially configured. I do agree that it's better to create enough swap space at installation, but your needs may change over time. If you're using LVM and you have unallocated space, it isn't too difficult to increase the size of a swap partition. Create a temporary swap file of the same size as your current swap partition with dd and mkswap, and activate it. Deactivate the existing partition with swapoff. Increase its size, run mkswap again (I'm not sure if it's necessary, but it couldn't hurt) activate it with swapon and deactivate the swap file with swapoff. It wouldn't hurt to shut off whatever apps might be swapping. You could also use parted or even good old fdisk, if you have a partition you can delete. You can always add another disk. You can also create a swap file and give it a lower priority than the swap partition (swapon -p n or pri=n in /etc/fstab). The kernel doesn't always honor this, but it should still use the swap partition the vast majority of the time. So there are a few more questions you can ask about swap. How would you go about adding swap? How can you configure a machine so that it uses the swap partition on a fast disk more often than the swap partition on a slow disk? Back to lurking... --Michael _______________________________________________ lpi-examdev mailing list lpi-examdev@lpi.org http://list.lpi.org/mailman/listinfo/lpi-examdev