[kwlug-disc] Service resource management: i.e. Mailman3 vs Mailman2

Ronald Barnes ron at ronaldbarnes.ca
Wed Feb 5 11:13:07 EST 2025


Khalid Baheyeldin wrote on 2025-02-05 06:59:

> Say that I want to calculate to how much memory is being used
> by the PHP-FPM processes on a busy server (has 128GB of RAM):
> 
> $ ps -eo rss,args |
> grep php-fpm |
> grep -v grep |
> awk '{ s += $1 } END {print s}'
> 
> 6054056

I've played around with this a bit.

How do you determine whether you want:
a) rss (resident set size)
b) drs (data resident set size - "other then executable code"
c) size (swap space related)
d) sz (size in physical pages)
e) trs (text resident size - executable code)
f) vsz or vsize (virtual memory size)

"?!?"





When I run that on my system, I see this:


# ps -eo rss,trs,drs,vsize,args |    grep php-fpm |    grep -v grep | 
awk '{ s += $1+$2+$3+$4 } END {print s}'
33086265

For the tired-eyed, that's 33MB 33,086,265 bytes.

However...

systemctl status php8.1-fpm.service
      Status: "Processes active: 0, idle: 30, Requests: 233130, ...
       Tasks: 31 (limit: 6949)
      Memory: 446.6M
         CPU: 7h 49min 22.955s
      CGroup: /system.slice/php8.1-fpm.service


These results are off by 1-1½ orders of magnitude.


What is yours like when comparing `ps` vs `systemctl status` on PHP, 
similar?


Any thoughts on how to reconcile these wildly divergent results?




More information about the kwlug-disc mailing list