Re: swappiness and performance on a low RAM system?
Default swappiness is currently 60 for Ubuntu 10.10 and for any versions that people are still likely to be using. It has been different in the past.
The current setting is shown in /proc/sys/vm/swappiness and you can edit it as a file to change the value for your current session. At reboot it is reset from the value in /etc/sysctl.conf, or potentially from files in /etc/sysctl.d.
60 is actually fairly aggressive about swapping out unused pages. Whether this leads to "better" performance depends entirely on whether what gets swapped out is needed by you or not. The space gained by swapping out pages thought the be unused is then used for maintaining more disk cache.
The disk cache can be useful for improving the responsiveness of your system. Or it may be useless if you do something that fills the disk cache with pages you'll never need again. The application pages swapped out are also a free gain if you never need them again, but if you do need them then your application will slow to a crawl. So there is a balance and swappiness 60 is found to be that balance for most people in most cases.
Consider setting up compcache/ramzswap so that your system will behave a little more gracefully as useful pages start to be swapped out. Swap pages equal to 25% of your RAM size (configurable) will be compressed and stored in (about 10%) of you RAM. You will obviously have a few more swapped pages as they take some RAM, but reading them will be almost unnoticeable because they aren't on disk. If nothing else, rzscontrol then lets you see how many of those swapped pages are then read again. If this number is very low then perhaps a higher swappiness would work for you. If the number of read swap pages is more than a fraction of the number of written swap pages then you would seem to be swapping out too many useful pages and perhaps should try lowering your swappiness.
More RAM is always a gain. Remember that Linux will always use all your RAM after a time. Some utilities will report that you have no free memory, but don't worry about it. Others will subtract the disk cache, since it is quickly discarded if an application needs new memory, and those utilities may report a lot of free memory at the same time as showing swap usage. These things are normal.
Tags for this Thread