To count the physical memory occupied by the Apache process

Source: Internet
Author: User

To count the physical memory occupied by the Apache process

[[email protected] ~]# ps aux | grep httpdroot      13698  0.0  0.0 185628  4356 ?         Ss   17:12   0:00 /usr/sbin/httpdapache    13705  0.3  0.1 293504 27340 ?         s    17:12   0:00 /usr/sbin/httpdapache   13706   0.3  0.1 293504 27324 ?        s     17:12   0:00 /usr/sbin/httpdapache   13707   0.3  0.1 293504 27324 ?        S     17:12   0:00 /usr/sbin/httpdapache   13708  0.3   0.1 293504 27324 ?        s    17:12    0:00 /usr/sbin/httpdapache   13709  0.3  0.1 293504  27324 ?        s    17:12    0:00 /usr/sbin/httpdapache   13710  0.3  0.1 293504 27328  ?        s    17:12   0:00  /usr/sbin/httpdapache   13711  0.3  0.1 293504 27324 ?         s    17:12   0:00 /usr /sbin/httpdapache   13712  0.3  0.1 293504 27324 ?         s    17:12   0:00 /usr/sbin/ httpdroot     13831  0.0  0.0 103320   908 pts/6     s+   17:15   0:00 grep httpd# use pidof to view all httpd process numbers [[email  protected] ~]# pidof httpd 13712 13711 13710 13709 13708 13707  13706 13705 13698[[email protected] ~]# cd /proc/13698  #apache的主进称, The others are Wahabbi called [[email protected] 13698]# cat statusname:httpdstate:s  (sleeping) Tgid:13698Pid :13698ppid:1tracerpid:0uid:0000gid:0000utrace:0fdsize:64groups:0vmpeak:  185628 kbvmsize:   185628 kBVmLck:       0 kBVmHWM:     4356 kbvmrss:    4356 kb  # This is the physical memory that the feed is occupying vmdata:     1812 kbvmstk:      88 kbvmexe:     336  Kbvmlib:    9964 kbvmpte:     376 kbvmswap:        0 kb

Then the sum of the physical memory occupied by all the httpd processes is counted, and all the memory occupied by the Apache service can be counted.


In [all]: from subprocess import Popen,pipein [+]: P=popen ([' pidof ', ' httpd '],stdout=pipe,stderr=pipe) in [22]: P.stdout.read (). Split () out[22]: [' 13712 ', ' 13711 ', ' 13710 ', ' 13709 ', ' 13708 ', ' 13707 ', ' 13706 ', ' 13705 ', ' 13698 ']



This article comes from "Plum blossom fragrance from bitter cold!" "Blog, be sure to keep this provenance http://daixuan.blog.51cto.com/5426657/1883130

To count the physical memory occupied by the Apache process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.