1

We have CentOS 5.11 (64bit) and it has 64G physical memory and 4G swap and i am seeing 900MB swap is in used but trying to find out who is using it. I have tried following but its showing zero usage.

      smem -t -p
      ...
      ...
     4758 root     /usr/bin/python2.6 /usr/bin    0.00%    0.03%    0.03%    0.03%
    21846 root     /usr/bin/ruby /usr/bin/pupp    0.00%    0.06%    0.06%    0.06%
    -------------------------------------------------------------------------------
      920 12                                      0.00%    7.30%   10.04%  161.37%

I have tried top command but its showing wrong data so its useless.

also i have tried following script but it is also showing zero

#!/bin/bash
for i in `ls /proc`
do
        if [ -f /proc/$i/smaps ]
                then
                grep -H Swap /proc/$i/smaps | awk '( $2 != "0" ) { print }'
        fi
done

None of tool able to figure out who is using SWAP so don't know what is the issue here. but in other identical my above bash script works but on this server it's not so what would be wrong?

top command showing following data in swap column and we have total 4G swap, so that is totally wrong

top - 09:38:55 up 111 days, 14:23,  1 user,  load average: 2.09, 2.34, 2.20
Tasks: 994 total,   4 running, 990 sleeping,   0 stopped,   0 zombie
Cpu(s): 12.3%us,  0.9%sy,  0.0%ni, 86.0%id,  0.0%wa,  0.0%hi,  0.7%si,  0.0%st
Mem:  98820240k total, 75660440k used, 23159800k free,  1056112k buffers
Swap:  4192924k total,  4192496k used,      428k free, 59936024k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  SWAP COMMAND
 6292 postgres  15   0 50.0g 109m 100m S  1.5  0.1   0:02.95  49g postmaster
 6797 postgres  15   0 50.0g  10m 8228 S  1.5  0.0  33:35.32  49g postmaster
10300 postgres  15   0 50.0g  60m  53m S  1.5  0.1   0:01.18  49g postmaster
12280 root      15   0 13428 1836  844 R  1.5  0.0   0:00.25  11m top
   26 root      10  -5     0    0    0 S  0.7  0.0 215:11.17    0 events/0
 1969 postgres  15   0 50.0g 141m 132m S  0.7  0.1   0:04.42  49g postmaster
 2549 postgres  15   0 50.0g 141m 132m S  0.7  0.1   0:04.24  49g postmaster
 2550 postgres  15   0 50.0g 141m 132m S  0.7  0.1   0:04.37  49g postmaster
 2699 postgres  15   0 50.0g 141m 132m S  0.7  0.1   0:04.45  49g postmaster
 3128 postgres  15   0 50.0g 131m 123m S  0.7  0.1   0:03.91  49g postmaster
 4556 postgres  15   0 50.0g 115m 107m S  0.7  0.1   0:03.20  49g postmaster
 4560 postgres  15   0 50.0g 116m 108m S  0.7  0.1   0:03.23  49g postmaster
 4669 postgres  15   0 50.0g 113m 105m S  0.7  0.1   0:03.28  49g postmaster
 4671 postgres  15   0 50.0g 114m 106m S  0.7  0.1   0:03.27  49g postmaster

here is my tmpfs output, now question is where that 48G comes from, in postgresql.conf i have specified shared_buffer=48G is that what tmpfs showing? Am i right?

[root@db ~]# df -h -t tmpfs
Filesystem            Size  Used Avail Use% Mounted on
tmpfs                  48G   12K   48G   1% /dev/shm
  • 1
    show df -h -t tmpfs, if that is swapped then it will not be attributed to any process. – sourcejedi Jul 11 '17 at 18:57
  • How do you know top is showing the wrong data? – 0xSheepdog Jul 11 '17 at 19:21
  • @sourcejedi look like you are right i have posted output in my question. – Satish Jul 13 '17 at 13:43
  • That 48G tmfs is that what i specified on postgresql – Satish Jul 13 '17 at 13:45
  • nope, it says only 12Kb of tmpfs is actually used. You probably just used the same algorithm to calculate a sensible allocation relative to physical memory as tmpfs does :). – sourcejedi Jul 13 '17 at 13:46

Your Answer

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

Browse other questions tagged or ask your own question.