swap space usage
Haakon Gjersvik Eriksen
haakon at basefarm.no
Wed Jan 3 06:34:51 CST 2007
Robert Gravsjö wrote:
> Hi,
>
> I'm seeing something strange on one of our servers. The swap space usage
> keeps growing alarmingly. We've run the server with 2GB swap for over a
> year and everything seems fine. A couple of weeks ago we saw the swap
> space was running out, which was strange, so we started by adding
> another 1GB swap space and then another 1G later on since the first
> addition also got used up.
> I belive I can swapoff everything and then swapon the original swap
> space to reclaim the space (or just do a reboot) to fix things. The
> thing is, I really need to know what's causing this.
> Has anyone seen this before? Any idea of what's causing it? Is it
> possible to track what process is swapping out? Using ps, iostat, vmstat
> and /proc/meminfo and /proc/stat doesnt give enough information (or I'm
> missing it).
Hej :)
The /proc file system is your friend. You can easily make a list of the
biggest processes by doing something like
# grep VmSize /proc/*/status | sort -nr -k 2 | head
And then match the PIDs you get out of that to /proc/PID/cmdline to get
the process names if PIDs aren't sufficient.
If just getting the biggest process isn't enough, you can try grepping
out VmRSS (which is non-swapped-out memory) from /proc and subtracting
that from VmSize to get swapped out memory. Shouldn't be too difficult
with your favorite scripting language.
(sorry, I'm a bit busy so most of this is, unfortunately, left as an
exercise for the reader. I figured it might be better than nothing, though)
--
Haakon Gjersvik Eriksen -- Basefarm AS
More information about the Linux-PowerEdge
mailing list