Tag Archives: Memory utilization is high

How to find the process using high memory in Linux

Learn how to find the process using high memory on the Linux server. This helps in tracking down issues and troubleshooting utilization problems.

Find process using high memory in Linux

Many times you came to know system memory is highly utilized using a utility like sar. You want to find processes hogging on memory. To find that, we will be using the sort function of process status ps command in this article. We will be sorting ps output with RSS values. RSS is Resident Set Size. These values show how much memory from physical RAM allocated to a particular process. It does not include swapped out memory numbers. Since we troubleshooting processes using high physical memory RSS fits our criteria.

Lets see below example :

# ps aux --sort -rss |head -10
USER           PID %CPU %MEM    VSZ   RSS     TTY STAT START   TIME COMMAND
oracle_admin  14400  0.0 11.8 36937384 31420276 ?   Ss    2016  86:41 ora_mman_DB1
oracle_admin  14405  0.2 11.3 36993676 30023868 ?   Ss    2016 1676:11 ora_DB3
oracle_admin  14416  0.2 11.3 36993676 30023656 ?   Ss    2016 1722:47 ora_DB3
oracle_admin  14410  0.2 11.3 36993676 30020400 ?   Ss    2016 1702:09 ora_DB3
oracle_admin  14421  0.2 11.3 36993676 30018272 ?   Ss    2016 1754:25 ora_DB3
oracle_admin  14440  0.0 10.5 36946868 27887152 ?   Ss    2016 130:30 ora_mon_DB3
oracle_admin 15855  0.0  6.9 19232424 18298484 ?   Ss    2016  41:01 ora_mman_DB4
oracle_admin 15857  0.1  6.7 19288720 17966276 ?   Ss    2016 161:45 ora_DB4
oracle_admin 15864  0.1  6.7 19288720 17964584 ?   Ss    2016 173:36 ora_DB4

In the above output, we sorted processes with RSS and shown only the top 10 ones. RSS value in output is in Kb. Let’s verify this output for the topmost process with PID 14400.

# free
             total       used       free     shared    buffers     cached
Mem:     264611456   96146728  168464728          0    1042972   75377436
-/+ buffers/cache:   19726320  244885136
Swap:     67108860     539600   66569260

On our system, we have 264611456Kb physical RAM (highlighted entry in the above output). Out of which 11.8% is used by process 14400 (from ps output above) which comes to 31224151Kb. This value matches the RSS value of 31420276Kb (in ps output above)!

So the above method works well when you try to find processes using the highest physical memory on the system!

You can even use other methods to get high memory using processes like top, htop, etc. but this article aimed at using ps.

Processes using high memory, cpu using unix95

Learn how to get a list of processes consuming high memory or CPU on the kernel in sorted order using unix95. Helpful for troubleshooting high system utilization.


Listing of processes who are using high memory :

# UNIX95=1 ps -ef -o vsz= -o pid= -o comm= | sort -rnk1 | awk '{ print $1/1024" MB "$2" "$3; }'
749.156 MB 2025 cimprovagt
60.1875 MB 2842 midaemon
56.8672 MB 3616 opcmona
49.3633 MB 6905 cmcld
43.8906 MB 3485 coda
42.9375 MB 2035 cimprovagt
41.043 MB 2372 java
22.875 MB 2039 cimprovagt
21.2578 MB 3414 nsrexecd
18.2617 MB 2617 vxpal
17.2188 MB 2431 vxsvc
16.9297 MB 3264 postgres:

----- output truncated -----

or

# UNIX95= ps -eo vsz,comm,args | sed 1d | sort -rn | more
 767136 cimprovagt      /opt/wbem/lbin/cimprovagt 0 4 9 root SFMProviderModule
  61632 midaemon        /opt/perf/bin/midaemon
  58232 opcmona         /opt/OV/lbin/eaagt/opcmona
  50548 cmcld           /usr/lbin/cmcld -j
  44944 coda            /opt/OV/lbin/perf/coda
  43968 cimprovagt      /opt/wbem/lbin/cimprovagt 0 4 9 root HPUXFCIndicationProviderModule
  42028 java            /opt/hpservices/jre/opt/java1.4/jre/bin/IA64N/java -Xmx512m -DRunnerValuePairFile=/var/opt/runner/data/valuePairs -cp /opt/runn
  23424 cimprovagt      /opt/wbem/lbin/cimprovagt 0 4 9 root HPUXStorageIndicationProviderModule
  21768 nsrexecd        /opt/networker/bin/nsrexecd
  18700 vxpal           /opt/VRTSobc/pal33/bin/vxpal -a StorageAgent -x
  17632 vxsvc           /opt/VRTSob/bin/vxsvc -r /etc/vx/isis/Registry -e

----- output truncated -----





Listing of processes who are using high CPU:

# UNIX95= ps -e -o "vsz pcpu ruser pid stime time state args" | sort -rn |head -10
 767136  0.00 root      2025  Nov 15  1-04:47:22 R /opt/wbem/lbin/cimprovagt 0 4 9 root SFMProviderModule
  61632  0.07 root      2842  Nov 15  11:29:30 R /opt/perf/bin/midaemon
  58232  0.00 root      3616  Nov 15  05:52:05 R /opt/OV/lbin/eaagt/opcmona
  50548  0.14 root      6905  Nov 15  1-05:23:35 R /usr/lbin/cmcld -j
  44944  0.00 root      3485  Nov 15  04:46:17 R /opt/OV/lbin/perf/coda
  43968  0.00 root      2035  Nov 15  05:53:58 R /opt/wbem/lbin/cimprovagt 0 4 9 root HPUXFCIndicationProviderModule
  42028  0.09 root      2372  Nov 15  22:59:12 R /opt/hpservices/jre/opt/java1.4/jre/bin/IA64N/java -Xmx512m -DRunnerValuePairFile=/var/opt/runner/data/valuePairs -cp /opt/runn
  23424  0.00 root      2039  Nov 15  02:26:51 R /opt/wbem/lbin/cimprovagt 0 4 9 root HPUXStorageIndicationProviderModule
  21768  0.00 root      3414  Nov 15  01:22:45 R /opt/networker/bin/nsrexecd
  18700  0.00 root      2617  Nov 15  01:04:36 R /opt/VRTSobc/pal33/bin/vxpal -a StorageAgent -x