1

Server is using swap memory when there is enough RAM is available because of which users are facing intermittent slowness and performance issues. In the free command I can see that there is 6927mbs of swap is used but when I sorted the PIDs through top i found only 2 pids that to consuming few kbs.

Details:-

free -m
             total       used       free     shared    buffers     cached
Mem:        129043     123398       5644      56782        147      59134
-/+ buffers/cache:      64116      64926
Swap:         8191       6927       1264

top output sorted by SWAP usage:-

top - 11:08:18 up 17 days,  8:29, 318 users,  load average: 18.64, 18.34, 17.73
Tasks: 3115 total,  12 running, 3103 sleeping,   0 stopped,   0 zombie
Cpu(s): 26.3%us,  3.5%sy,  0.0%ni, 67.5%id,  2.5%wa,  0.0%hi,  0.1%si,  0.0%st
Mem:  132140360k total, 131050280k used,  1090080k free,    27072k buffers
Swap:  8388604k total,  7093580k used,  1295024k free, 60220780k cached

   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  **SWAP** COMMAND
  2353 mfg       20   0 38.6g 532m 2452 S  0.2  0.4   9:06.68 **4096** java
 23499 mfg       20   0 24.4g 358m 245m S  0.0  0.3   0:56.71 **2692** D_finqonddb_AS_
     1 root      20   0 23600  724  368 S  0.0  0.0   7:20.05    0 init
     2 root      20   0     0    0    0 S  0.0  0.0   3:08.08    0 kthreadd
     3 root      RT   0     0    0    0 S  0.0  0.0   1:04.47    0 migration/0

swappiness value

cat /proc/sys/vm/swappiness
**1**

Please help me on how to identify which processes are using/writing to the SWAP memory.

0

You may want to take a look using smem or check /proc/-PID-/status for the line starting with VmSwap.

https://confluence.atlassian.com/bamkb/how-to-review-swap-space-usage-on-a-linux-server-865042927.html has this nice CLI expression to report that line and the process name for all PIDs:

for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r | less

New contributor
Eradian is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.