6

The swap is at low usage, and the OS sometime run out of memory and start scarifying processes

swapon -s 

Filename                                Type            Size    Used   Priority
/dev/vda1                               partition       2047992 75030       1

Memory is around 97% used. any idea what is wrong ? I tried turning swap off/on, that did not help.v

Centos 6.5 / kernel 2.6.32

cat /proc/meminfo

MemTotal:       15000800 kB
MemFree:          300532 kB
Buffers:           11364 kB
Cached:           211224 kB
SwapCached:            0 kB
Active:         12613992 kB
Inactive:        1854012 kB
Active(anon):   12555272 kB
Inactive(anon):  1690320 kB
Active(file):      58720 kB
Inactive(file):   163692 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       2047992 kB
SwapFree:        2047992 kB
Dirty:                68 kB
Writeback:             0 kB
AnonPages:      14245460 kB
Mapped:            19440 kB
Shmem:               176 kB
Slab:              76136 kB
SReclaimable:      48572 kB
SUnreclaim:        27564 kB
KernelStack:        2400 kB
PageTables:        35352 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     9548392 kB
Committed_AS:    7996680 kB
VmallocTotal:   34359738367 kB
VmallocUsed:       40680 kB
VmallocChunk:   34359684884 kB
HardwareCorrupted:     0 kB
AnonHugePages:   9834496 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:        9204 kB
DirectMap2M:    15417344 kB

swappiness looks ok

cat /proc/sys/vm/swappiness
60
  • Sounds just fine. You have enough RAM to avoid excessive swap usage, and you haven't wasted money buying way more RAM than you need. So it all sounds like you hit just the right amount of RAM for your workload. – kasperd Nov 17 '15 at 18:19
  • could you post a cat /proc/meminfo output? – Francesco P Nov 17 '15 at 18:25
  • @kasperd, but I am having programs crashed, killed by kernel because it is out of memory – Nabil Sham Nov 17 '15 at 18:42
  • @FrancescoP I did. – Nabil Sham Nov 17 '15 at 18:43
  • 2
    It's entirely possible that by the time you are able to look swap has been freed and it just looks like swap is not being used. Take a look at the output sar -r for the period you had the problem. – user9517 Nov 17 '15 at 19:13
2

Very interesting you have almost 300 MB free and 200 cached probably your swappines it's not aggressive , I played many times in my past with this in order to have more performance with hosted VPS , so you have to change your vm.swappiness kernel parameters to set a fine threshold for you these links are good for you but take care test it before go in production.

https://askubuntu.com/questions/103915/how-do-i-configure-swappiness https://en.wikipedia.org/wiki/Swappiness

I hope it helps!

| improve this answer | |
2

Another option to try messing with in /proc or your /etc/sysctl.conf is /sys/vm/overcommit_ratio. By default Linux starts killing processes before the swap is more than slightly utilized.

The exact formula used can be found by running the command "man proc"

| improve this answer | |

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.