Under Linux, how do I find out which process is using the swap space more?
Any scripts/links appreciated..
Under Linux, how do I find out which process is using the swap space more?
Any scripts/links appreciated..
I suppose you could get a good guess by running top
and looking for active processes using a lot of memory. Doing this programatically is harder---just look at the endless debates about the Linux OOM killer heuristics.
Swapping is a function of having more memory in active use than is installed, so it is usually hard to blame it on a single process. If it is an ongoing problem, the best solution is to install more memory, or make other systemic changes.
I don't know of any direct answer as how to find exactly what process is using the swap space, however, this link may be helpful. Another good one is over here
Also, use a good tool like htop to see which processes are using a lot of memory and how much swap overall is being used.
Run top then press 'O' (capital letter o) followed by 'p' then 'enter'. Now processes should be sorted by their swap usage.
It's not entirely clear if you mean you want to find the process who has most pages swapped out or process who caused most pages to be swapped out.
For the first you may run top
and order by swap (press 'Op'), for the latter you can run vmstat
and look for non-zero entries for 'so'.