Home > Backend Development > PHP Tutorial > How to loop through the memory usage of php-fpm

How to loop through the memory usage of php-fpm

藏色散人
Release: 2023-04-08 10:52:02
forward
2504 people have browsed it

How to loop through the memory usage of php-fpm

webmail的业务中进行发信,如果携带了附件,会把附件拼接内嵌到邮件正文里,这时会极大的占用内存,可以使用以下命令查看fpm的进程内存占用

ps --no-headers --sort -rss -o "rss,pid,cmd" -C php-fpm
Copy after login

这句的意思是,打印rss,pid,cmd列,并且按rss进行排序,rss就是占用的内存量

awk '{printf("%dM %s\n",$1/1024,$0)}'
Copy after login

这句的意思是,循环每一行结果,并且把kb换算成Mb,$0代表这行数据

while true;do clear;date;ps --no-headers --sort -rss -o "rss,pid,cmd" -C php-fpm|awk '{printf("%dM %s\n",$1/1024,$0)}';sleep 1;done

 

当进行发信操作时可以看到内存占用情况

How to loop through the memory usage of php-fpm

更多相关php知识,请访问php教程

The above is the detailed content of How to loop through the memory usage of php-fpm. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template