Swap memory usage is high in Linux

Hi ,

There is one following alert .

Message : cdm:Average (2 samples) swap memory usage is now 91%, which is above the warning threshold (90%)

Here is my findings.

Output of TOP command in Linux server.

top - 14:21:44 up 6 days,  4:48,  1 user,  load average: 2.55, 2.06, 1.99
  Tasks: 495 total,   3 running, 492 sleeping,   0 stopped,   0 zombie
  Cpu(s):  5.3%us,  0.6%sy,  0.0%ni, 93.0%id,  0.8%wa,  0.0%hi,  0.3%si,  0.0%st
  Mem:  49454056k total, 49184128k used,   269928k free,    92960k buffers
  Swap: 16777208k total, 15902972k used,   874236k free, 45983512k cached
[oracle@server20 ~]$ vmstat 4 5
  procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
  r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
  0  0 15903124 265780  92988 45987776    0    2  2606   216    2    1  5  1 93  1  0
  0  0 15903124 269848  93028 45984436    0    0 36708   299 2885 10146  1  2 96  1  0
  0  0 15903124 268988  93100 45985100    0    0  3924   244 1481 9375  1  1 98  0  0
  0  0 15903124 269884  93088 45985180    0    0 52223    44 3446 9826  1  1 97  1  0
  1  0 15903124 270236  93024 45984104    0    0 86088   133 5065 10756  1  2 96  1  0

OS - Linux 5.11
This is 2 node cluster with one DB is running.

Please suggest me how to reduce swap usage in linux ?

Regards,
Maddy

The propensity of the Linux kernel to swap out is determined by the value in the file /proc/sys/vm/swappiness

You can modify by running the following (10 is the recommended value by Oracle for DB servers)

sysctl -w vm.swappiness=10
1 Like

Oracle also has a "unique" feature - when an SGA is allocated in shared memory, a backing store (identical size) is created in swap. This assures virtual memory availability later on. You create an 11GB SGA you also consume 11GB of swap.

1 Like

Thanks all.