I would like to know if anyone has played around with the "Swappiness" parameter in Linux which allows you to tweak how often pages get swapped out to disk. I believe the default value is 60 but many of the articles that i've looked at suggest a lower value is recommended especially for Databases and JVM processing.
Gareth, are you trying to solve an existing problem with this, or is this a general curiousity? I guess that answer would depends what's on the machine and it that machine is constrained by lack of memory. For database machine it would indeed make sense to set it lower than 60 as you don't want your database 'pages' to be swapped out of physical memory, or at least with lowest possible frequency. If you have a memory constrains and loads of batch clients or generally jobs, which for example run for a bit and then sit and way, you might want to bump out the swappiness so the memory would get swapped out more aggressively and made space for something else. I haven't played with this myself, but aware of one isssue where it's been set to 0, and the OOM (out of memory) killer on Linux went on a killing spree when the machine cames under load, so probably best not to set it to 0.
With respect to database shared memory, you can also look at using the -pinshm broker startup parameter to prevent shared memory pages from being paged out.
if you are not paging, then it does not matter to what value you set it so check that first.
This was just something that I came across and was wondering if anyone has implemented this on a production environment. We do have one particular client where I've noticed excessive swapping and when monitoring this through protop I noticed that the Tomcat java process was the top process that was causing swapping along with the appserver agent processes. When issuing a free -m there is still plenty of available memory available. My thinking is to reduce this value to around 20 to see if this improves %iowait time on the box. The %iowait time on the box pretty much stays between 0.00 and 5.00 but as soon as the machine starts swapping this climbs up to around 20.00 which has a noticeable impact on performance.
Thanks Rob, yes i'm aware of the -pinshm parameter but I see no swapping on the DB but rather on the java processes. Tomcat and appserver agents.