In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to find processes with large memory consumption in Linux". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to find processes with large memory consumption in Linux".
1) how to use the ps command to find the most memory consuming process in Linux
The ps command reports a snapshot of the current process. The ps command means "process status". This is a standard Linux application for finding information about running processes on Linux systems.
It is used to list the currently running process and its process ID (PID), process owner name, process priority (PR), and the absolute path of the running command, etc.
The following ps command format provides you with more information about the processes that consume the most memory.
# ps aux-- sort-rss | head USER PID% CPU% MEM VSZ RSS TTY STAT START TIME COMMANDmysql 1064 3.2 5.4 886076 209988? Ssl Oct25 62:40 / usr/sbin/mysqldvarnish 23396 0.0 2.9 286492 115616? SLl Oct25 0:42 / usr/sbin/varnishd-P / var/run/varnish.pid-f / etc/varnish/default.vcl-a: 82-T 127.0.0.1 var/run/varnish.pid 6082-S / etc/varnish/secret-s malloc,256Mnamed 1105 0.02.7 311712 108204? Ssl Oct25 0:16 / usr/sbin/named-u named-c / etc/named.confnobody 23377 0.22.3 153096 89432? S Oct25 4:35 nginx: worker processnobody 23376 0.1 2.1 147096 83316? S Oct25 2:18 nginx: worker processroot 23375 0.0 1.7 131028 66764? Ss Oct25 0:01 nginx: master process / usr/sbin/nginx-c / etc/nginx/nginx.confnobody 23378 0.01.6 130988 64592? S Oct25 0:00 nginx: cache manager processroot 1135 0.0 0.9 86708 37572? S 05:37 0:20 cwpsrv: worker processroot 1133 0.0 0.9 86708 37544? S 05:37 0:05 cwpsrv: worker process
Use the following ps command format to display only specific information about the memory consumption process in the output.
# ps-eo pid,ppid,%mem,%cpu,cmd-- sort=-%mem | head PID PPID% MEM% CPU CMD 1064 1.5.4 3.2 / usr/sbin/mysqld23396 23386 2.90.0 / usr/sbin/varnishd-P / var/run/varnish.pid-f / etc/varnish/default.vcl-a: 82-T 127.0.1 etc/varnish/secret-s malloc 256m 1105 1 2.7 0.0 / usr/sbin/named-u named-c / etc/named.conf23377 23375 2.3 0.2 nginx: worker process23376 23375 2.1 0.1 nginx: worker process 3625 977 1.9 0.0 / usr/local/bin/php-cgi / home/daygeekc/public_html/index.php23375 1 1.7 0.0 nginx: master process / usr/sbin/nginx-c / etc/nginx/nginx.conf23378 23375 1.6 0.0 nginx: cache Manager process 1135 3034 0.9 0.0 cwpsrv: worker process
If you only want to see the command name and not the absolute path of the command, use the following ps command format.
# ps-eo pid,ppid,%mem,%cpu Comm-- sort=-%mem | head PID PPID% MEM% CPU COMMAND 1064 1 5.4 3.2 mysqld23396 23386 2.9 0.0 cache-main 1105 1 2.7 0.0 named23377 23375 2.3 0.2 nginx23376 23375 2.1 nginx23375 1 1.7 0.0 nginx23378 23375 1.6 0.0 nginx 1135 3034 0.9 0.0 cwpsrv 1133 3034 0.9 0.0 cwpsrv2) how to use the top command to find the processes that consume the most memory in Linux
Linux's top command is the best and best-known command used to monitor Linux system performance. It displays a real-time view of the running system processes on the interactive interface. However, if you want to find the processes that consume the most memory, use the top command in batch mode.
You should correctly understand the top command output to solve performance problems in the system.
# top-c-b-o +% MEM | head-n 20 | tail-15 PID USER PR NI VIRT RES SHR S% CPU% MEM TIME+ COMMAND 1064 mysql 200 886076 209740 8388 S 0.05.462 head 41.20 / usr/sbin/mysqld23396 varnish 200 286492 115616 83572 S 0.03.0372 S 0.03.0Rule 42.24 / usr/sbin/varnishd-P / var/run/varnish.pid-f / etc/varnish/default. Vcl-a: 82-T 127.0.0.1 malloc 6082-S / etc/varnish/secret-s malloc 256m 1105 named 200 311712 108204 2424 S 0.0 2.80 etc/named.conf23377 nobody 16.41 / usr/sbin/named-u named-c / etc/named.conf23377 nobody 200 153240 89432 2432 S 0.0 2.3 415 35.74 nginx: worker process23376 nobody 200 147096 83316 2416 S 0.0 2.1 2 VR 18.09 nginx: worker process23375 root 200 131028 66764 1616 S 0.0 1.7 0:01. 07 nginx: master process / usr/sbin/nginx-c / etc/nginx/nginx.conf23378 nobody 20 0 130988 64592 592 S 0.0 1.7 0 nginx 00.51 nginx: cache manager process 1135 root 20 0 86708 37572 2252 S 0.0 1.0 nginx 20.18 cwpsrv: worker process 1133 root 20 086708 37544 2212 S 0.0 1.0 cwpsrv 05.94 cwpsrv: worker process 3034 root 20 086704 36740 1452 S 0.0 0.9 nobody 00.09 cwpsrv: master process / usr/local/cwpsrv/bin/cwpsrv 1067 nobody 1356200 2352 S 0.00.8 usr/local/apache/bin/httpd / usr/local/apache/bin/httpd-k start 977 nobody 1356088 31268 2372 S 0.0 0.8 30.44 / usr/local/apache/bin/httpd-k start 968 nobody 2001356216 30544 2348 S 0.0. 8 0purl 19.95 / usr/local/apache/bin/httpd-k start
If you only want to see the command name and not the absolute path of the command, use the following top command format.
# top-b-o +% MEM | head-n 20 | tail-15 PID USER PR NI VIRT RES SHR S% CPU% MEM TIME+ COMMAND 1064 mysql 200 886076 210340 8388 S 6.7 5.4 62 named23377 nobody 20 mysqld23396 varnish 200 286492 115616 83572 S 0.0 3.0 named 20 0311712 108204 2424 S 0.0 2.880 named23377 nobody 20 0 153240 89432 2432 S 13.3 2.3 4:35.74 nginx23376 nobody 20 0 147096 83316 2416 S 0.0 2.1 2:18.09 nginx23375 root 20 0 131028 66764 1616 S 0.0 1.7 0:01.07 nginx23378 nobody 20 0 130988 64592 592 S 0.0 1.7 0:00.51 nginx 1135 root 20 0 86708 37572 2252 S 0.0 1.0 0:20.18 cwpsrv 1133 root 200 86708 37544 2212 S 0.0 1.0 0:05.94 cwpsrv 3034 root 200 86704 36740 1452 S 0.0 0.9 0:00.09 cwpsrv 1067 nobody 200 1356200 31588 2352 S 0.0 0.8 0:56.04 httpd 977 nobody 200 1356088 31268 2372 S 0.0 0.8 0:30.44 httpd 968 nobody 200 1356216 30544 2348 S 0.0 0 Reward tip: how to use the ps_mem command to find the most memory-consuming process in Linux
The ps_mem program is used to display the core memory used by each program, not each process. This program allows you to check how much memory each program uses. It calculates the amount of private and shared memory based on the program and returns the total memory used in the most appropriate way.
It uses the following logic to calculate memory usage. Total memory usage = sum (dedicated memory usage for program processes) + sum (shared memory usage for program processes).
# ps_mem Private + Shared = RAM used Program128.0 KiB + 27.5KiB = 155.5 KiB agetty228.0 KiB + 47.0 KiB = 275.0 KiB atd284.0 KiB + 53.0 KiB = 337.0 KiB irqbalance380.0 KiB + 81.5 KiB = 461.5 KiB dovecot364.0 KiB + 121.5 KiB = 485.5 KiB log520.0 KiB + 65.5 KiB = 585.5 KiB auditd556.0 KiB + 60.5 KiB = 616.5 KiB systemd-udevd732 .0 KiB + 48.0 KiB = 780.0 KiB crond296.0 KiB + 524.0 KiB = 820.0 KiB avahi-daemon (2) 772.0 KiB + 51.5 KiB = 823.5 KiB systemd-logind940.0 KiB + 162.5 KiB = 1.1 MiB dbus-daemon 1.1 MiB + 99.0 KiB = 1.2 MiB pure-ftpd 1.2 MiB + 100.5 KiB = 1.3 MiB master 1.3 MiB + 198.5 KiB = 1. 5 MiB pickup 1.3 MiB + 198.5 KiB = 1.5 MiB bounce 1.3 MiB + 198.5 KiB = 1.5 MiB pipe 1.3 MiB + 207.5 KiB = 1.5 MiB qmgr 1.4 MiB + 198.5 KiB = 1.6 MiB cleanup 1.3 MiB + 299.5 KiB = 1.6 MiB trivial-rewrite 1.5 MiB + 145.0 KiB = 1.6 MiB config 1.4 MiB + 291.5 KiB = 1 .6 MiB tlsmgr 1.4 MiB + 308.5 KiB = 1.7 MiB local 1.4 MiB + 323.0 KiB = 1.8 MiB anvil (2) 1.3 MiB + 559.0 KiB = 1.9 MiB systemd-journald 1.8 MiB + 240.5 KiB = 2.1 MiB proxymap 1.9 MiB + 322.5 KiB = 2.2 MiB auth 2.4 MiB + 88.5 KiB = 2.5 MiB systemd 2.8MiB + 458. 5 KiB = 3.2 MiB smtpd 2.9 MiB + 892.0 KiB = 3.8 MiB bash (2) 3.3 MiB + 555.5 KiB = 3.8 MiB NetworkManager 4.1 MiB + 233.5 KiB = 4.3 MiB varnishd 4.0 MiB + 662.0 KiB = 4.7 MiB dhclient (2) 4.3 MiB + 623.5 KiB = 4.9 MiB rsyslogd 3.6MiB + 1.8MiB = 5.5MiB Sshd (3) 5.6MiB + 431.0 KiB = 6.0MiB polkitd 13.0MiB + 546.5 KiB = 13.6MiB tuned 22.5MiB + 76.0KiB = 22.6MiB lfd-sleeping 30.0 MiB + 6.2MiB = 36.2MiB php-fpm (6) 5.7MiB + 33.5 MiB = 39.2MiB cwpsrv (3) 20.1 MiB + 546.5 MiB = 45.4MiB httpd (5) 104.7 MiB + 156.0 KiB = 104.9 MiB named112.2 MiB + 479.5 KiB = 112.7 MiB cache-main 69.4 MiB + 58.6 MiB= 128.0 MiB nginx (4) 203.4 MiB + 309.5 KiB = 203.7 MiB mysqld-- 775.8 MiB== Thank you for reading The above is the content of "how to find processes with large memory consumption in Linux". After the study of this article, I believe you have a deeper understanding of how to find processes with large memory consumption in Linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.