WHY is the SWAP memory increasing on our gateway appliance
search cancel

WHY is the SWAP memory increasing on our gateway appliance

book

Article ID: 419571

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

AppD reporting gateway JVM memory hitting 80%.  The SWAP memory increase during this timeframe going to 70 % usage 

Why is SWAP being used ?

Environment

Gateway 11.1.1

Cause

The default setting for swappiness in the OVA and must linux systems is = 60.  

This value means that the swap file will be used fairly often if the memory usage above 60 (over half of the system memory)

AppD shows Gateway are hitting 60 - 80% - the kernel will move memory to SWAP at times, NOTE there is no system/memory manager for this space it will not recover unless the specific APP using swap is restarted or the system rebooted 

 

Resolution

Swappiness setting of zero means that the disk will be avoided unless absolutely necessary (you run out of memory), while a swappiness setting of 100 means that programs will be swapped to disk almost instantly.

The default GW OVA configured with swappiness of 60

# cat /proc/sys/vm/swappiness

60

#  sysctl vm.swappiness

vm.swappiness = 60

Set SWAPPINESS to 10 to limit it’s usage for GW App

# sysctl vm.swappiness=10

OR disable SWAP 

# sysctl vm.swappiness=0

 

Additional Information

Recommended adding column in “top” to see what application uses SWAP most 

  1. shell (bash).
  2. Type the following command to enter the top utility: # top
  3. Press f to edit the columns display.
  4. Press down to navigate down to the SWAP = Swapped Size (KiB) row.
  5. Press left arrow key “<”, then spacebar to * select
  6. Use the right arrow to select full line  “SWAP    = Swapped Size (KiB)“ 
  7. Press up to move SWAP = Swapped Size (KiB) just directly above the COMMAND = Command Name/Line row.

* SWAP    = Swapped Size (KiB)
* COMMAND = Command Name/Line

  1. Press Esc to exit edit mode.
  2. Press shift+w to save the changes to the ~/.toprc file. You may observe a momentary message similar to the following:
    Wrote configuration to '/root/.toprc'
    The next time you start top, the swap column is displayed according to the settings in .toprc.

top - 07:30:03 up 70 days, 17:56,  1 user,  load average: 0.00, 0.02, 0.05

Tasks: 152 total,   1 running, 151 sleeping,   0 stopped,   0 zombie

%Cpu(s):  0.3 us,  0.2 sy,  0.0 ni, 99.2 id,  0.2 wa,  0.0 hi,  0.0 si,  0.0 st

KiB Mem :  6109252 total,   133868 free,  4954256 used,  1021128 buff/cache

KiB Swap:  2097148 total,  1300732 free,   796416 used.   790080 avail Mem

 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+   SWAP COMMAND

 6569 mysql     20   0 2968356 562928  10964 S   1.0  9.2   1486:58 274112 mysqld

14555 gateway   20   0 7450880   3.5g  10488 S   0.7 60.3   1029:28 242364 java