[SATLUG] Swappiness in Ubuntu

Bruce Dubbs bruce.dubbs at gmail.com
Fri Apr 25 16:53:44 CDT 2008


ed wrote:
> Hi Folks;
> 
> I have some rather interesting questions regarding RAM swapping in
> Ubuntu or other Debian-based Linux OS.  I've just increased my Acer
> laptop's RAM from 1GB to 2.5GB by replacing a 512MB SODIMM with a 2GB
> SODIMM (1.8GHz CPU).  BIOS and system both acknowledge the increase, and
> my system now runs somewhat faster.  But, as well as faster, I'm looking
> for "better."  My questions relate to optimizing performance based on
> this new increase.  I've seen/read a lot of debate on modifying the
> "swappiness" value, the percentage of RAM content swapped to disk at any
> given moment.  My current setup looks like this:
> 
>> root at xxxx:/# free -m
>>          total    used   free  shared buffers     cached
>> Mem:      2470     809   1660       0      25        367     
    (misnomer: 32MB shared to video)

>> -/+ buffers/cache: 416   2054
>> Swap:      721       0    721

>> root at xxxx:/# cat /proc/sys/vm/swappiness
>> 60
>> root at xxxx:/#
> My questions: 
> 
> 1. Is there a need to change swappiness based on increased RAM?  Note:
> Changing my swappiness (values ~ 0-100) via sysctrl.conf to "1" seemed
> to have an inverse effect on CPU use, increasing cycles tremendously,
> and maxing it out more often than Ubuntu's default setting of "60."

I've never messed with it.  I don't think you need to either.  Notice that you 
are now using no swap at all.  Your best performance is if you don't swap at all 
-- and you aren't swapping.

Did you see:

http://kerneltrap.org/node/3000

> 2. If I do need to change swappiness, what's a good value?  Why?  Why
> not? What's gained? What's lost?

See above.

> 3. Are there any other values besides or instead of swappiness that'll
> increase or optimize performance?  How would these or other changes
> affect system stability?  Hardware performance?  Hardware life-cycle?

I don't know how your kernel is created, but you have an option when it is 
compiled:  High Memory supoprt: Off, 4G, 64G.  It sounds like you are
OK there.

Actually, you don't need to 'optimize' most of the time.  If you are swapping, 
add memory.  If you need more cpu cycles, add cpus.  If you want to play, try 
what you want, but I doubt you will notice anything.

You can mess with the disk parameters with hdparm, but be sure to read the man 
page and google before changing parameters.

   -- Bruce


More information about the SATLUG mailing list