I have an Ubuntu 8.04 server which is running a database and a bunch of Java application servers. Its memory configuration and usage is:
total used free shared buffers cached Mem: 16456176 15930028 526148 0 81372 9674196 -/+ buffers/cache: 6174460 10281716 Swap: 1951888 366100 1585788
I noticed that swap goes up every afternoon, and is released some time at night. The demand is not the same on all days, and starts at different times. So it's pretty random, except for the fuzzy "afternoon-night" boundary.
Load on this machine varies during the day. It's very low between midnight and 6-7 AM, much higher (but stable) until 6-8 PM, then dropping gradually.
Now I have the following questions:
- How can I see which processes are using swap?
- Why does it prefer to swap out rather than take some memory from cache?