LINUX - RAM Usage

The RAM (Random Access Memory) is an essential component of a Linux system that has to be monitored closely. In some conditions, we may run out of memory with very slow response times to our server or be completely unresponsive.

Linux machine has swap file which acts as an Extra RAM for the machine

Check RAM available on Machine:

# free -g

              total        used        free      shared  buff/cache   available

Mem:             31           1          25           0           4          29

Swap:            31           1          29


Commands to check RAM usage on Linux Machines:

1) TOP command to get the  high Memory utilization list of processes
$ top -b -o %MEM|head -n 10
top - 19:32:55 up 14 days,  7:32,  1 user,  load average: 0.60, 0.55, 0.48
Tasks: 407 total,   1 running, 288 sleeping,   0 stopped,   0 zombie
%Cpu(s):  2.0 us,  1.5 sy,  0.0 ni, 95.4 id,  0.9 wa,  0.0 hi,  0.1 si,  0.0 st
KiB Mem : 32715792 total, 26923584 free,  1047504 used,  4744704 buff/cache
KiB Swap: 32718844 total, 30952888 free,  1765956 used. 30709704 avail Mem

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
   8172 root      20   0 1185604 247652  44588 S   0.0  0.8   1202:11 kube-apiserver
   8150 root      20   0  827656  91588  43312 S   0.0  0.3 492:36.91 kube-controller
  18398 sivavadd  20   0 1247260  87528   3324 S   0.0  0.3 172:50.32 nautilus

2) PS Command to get  high Memory utilization list of processes 
$ps -eo pid,ppid,%mem,%cpu,cmd --sort=-%mem|head

3) VMSTAT to get memmory utilization 
$ vmstat 2 10 -w -S M
procs -----------------------memory---------------------- ---swap-- -----io---- -system-- --------cpu--------
 r  b         swpd         free         buff        cache   si   so    bi    bo   in   cs  us  sy  id  wa  st
 1  0         1724        26294          222         4411    0    0    13    15    2    2   2   2  95   1   0
 0  0         1724        26293          222         4411    0    0     0    60 2224 5777   1   1  98   1   0
 0  0         1724        26293          222         4411    0    0     0    34 1840 4943   1   0  98   1   0
 0  1         1724        26294          222         4411    0    0     0   150 2189 6314   1   1  96   2   0
 0  0         1724        26294          222         4411    0    0     0   128 2042 5091   1   0  96   2   0
 0  0         1724        26293          222         4411    0    0     0    14 1499 4017   1   0  99   0   0
 0  0         1724        26292          222         4411    0    0     0    60 1952 4857   1   1  97   1   0
 1  0         1724        26293          222         4411    0    0     0    78 2077 5409   1   0  97   1   0
 0  0         1724        26293          222         4411    0    0     0    38 1904 5495   1   1  98   1   0
 0  0         1724        26293          222         4411    0    0     0    12 1946 5481   2   0  98   0   0


Comments

Popular posts from this blog

Cloudbees FlowServer - Debug

PIP Errors and Fix

Terraform Basics