Posts

Showing posts from October, 2009

Tune the way linux use the swap with the swappiness parameter

Image
On linux, you can tune the way the system use the swap via the 'swappiness' parameter.


Check how the swap is used on your machine:

You can print how the system is using the swap with the vmstat command :

thomas@home:~$ vmstat 2 procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 0 0 25192 81956 93052 2383988 0 0 8 15 1 1 1 1 98 0 6 0 25192 71076 93100 2384224 0 0 10 272 1148 1265 8 10 80 2 0 0 25192 97492 93016 2368148 0 0 132 1186 1380 1845 26 35 39 0 0 0 25192 96648 93032 2368740 0 0 70 188 1121 1066 2 2 96 1 0 0 25192 96400 93044 2368976 0 0 0 188 1117 1082 1 1 98 0
the '2' parameter stands for the refresh time in seconds.

si stands for Swap IN (byte written to the swap)
so stands for Swap OUT (byte removed from the swap)

On a server which has enough RAM, I observed …