<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">On Wed, Feb 5, 2025 at 11:14 AM Ronald Barnes via kwlug-disc <<a href="mailto:kwlug-disc@kwlug.org">kwlug-disc@kwlug.org</a>> wrote:</div></div><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
I've played around with this a bit.<br>
<br>
How do you determine whether you want:<br>
a) rss (resident set size)<br>
b) drs (data resident set size - "other then executable code"<br>
c) size (swap space related)<br>
d) sz (size in physical pages)<br>
e) trs (text resident size - executable code)<br>
f) vsz or vsize (virtual memory size)<br>
<br>
"?!?"<br></blockquote><div><br></div><div><div style="font-size:small" class="gmail_default">Some of those include shared library memory, others measure code, <br></div><div style="font-size:small" class="gmail_default">and so on. <br></div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default"><div style="font-size:small" class="gmail_default">Here is the difference between rss and vsz:</div><div style="font-size:small" class="gmail_default"><br></div><div><div style="font-size:small" class="gmail_default"><a href="https://www.baeldung.com/linux/resident-set-vs-virtual-memory-size">https://www.baeldung.com/linux/resident-set-vs-virtual-memory-size</a></div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">And the man page for ps has this: "The SIZE and RSS fields don't count some parts </div><div style="font-size:small" class="gmail_default">of a process including the page tables, kernel stack, struct thread_info, and struct </div><div style="font-size:small" class="gmail_default">task_struct.  This is usually at least 20 KiB of memory that is always resident."</div><div style="font-size:small" class="gmail_default"><br></div></div></div><div style="font-size:small" class="gmail_default">Code is usually not a large portion of a problematic processes' memory usage,<br></div><span class="gmail_default" style="font-size:small">and there is no much you can do to reduce it unless you want to rewrite an <br></span></div><div><span class="gmail_default" style="font-size:small">application.</span></div><div><span class="gmail_default" style="font-size:small"><br></span></div><div>I use rss because it is the closest thing to what actual usage <span class="gmail_default" style="font-size:small">for a process </span>is<span class="gmail_default" style="font-size:small">.</span></div><div><span class="gmail_default" style="font-size:small">Even though it is not exact, it is the closest proxy for that.</span></div><div><br></div><div><div style="font-size:small" class="gmail_default">The goal is not how much bytes do I need, the goal is "why are these processes </div><div style="font-size:small" class="gmail_default">using a lot of memory".<br></div></div><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
# ps -eo rss,trs,drs,vsize,args |    grep php-fpm |    grep -v grep | <br>
awk '{ s += $1+$2+$3+$4 } END {print s}'<br></blockquote><div><br></div><div style="font-size:small" class="gmail_default">If my goal is comparative, then I keep things simple, and just use rss </div><div style="font-size:small" class="gmail_default">as a proxy to "memory consumption".</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
For the tired-eyed, that's 33MB 33,086,265 bytes.<br>
<br>
However...<br>
<br>
systemctl status php8.1-fpm.service<br>
      Status: "Processes active: 0, idle: 30, Requests: 233130, ...<br>
       Tasks: 31 (limit: 6949)<br>
      Memory: 446.6M<br>
         CPU: 7h 49min 22.955s<br>
      CGroup: /system.slice/php8.1-fpm.service<br>
<br>
<br>
These results are off by 1-1½ orders of magnitude.<br></blockquote><div><br></div><div style="font-size:small" class="gmail_default">The unit for rss in ps is Kilobytes, not bytes.</div><div style="font-size:small" class="gmail_default">So that is part of the discrepancy.</div><div style="font-size:small" class="gmail_default"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
What is yours like when comparing `ps` vs `systemctl status` on PHP, <br>
similar?<br></blockquote><div><br></div><div style="font-size:small" class="gmail_default">I can't restart PHP using systemctl on this server as it is a live busy site.</div><div style="font-size:small" class="gmail_default"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Any thoughts on how to reconcile these wildly divergent results?<br></blockquote></div><div class="gmail_quote gmail_quote_container"><br></div><div class="gmail_quote gmail_quote_container"><div style="font-size:small" class="gmail_default">I think no matter how you measure it, MM3 uses MUCH more memory.</div><div style="font-size:small" class="gmail_default">Exact figures don't matter.</div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">I was hoping it was a due to one or two features that you can disable, <br></div><div style="font-size:small" class="gmail_default">either because you don't use them at all, or you can make do without</div><div style="font-size:small" class="gmail_default">them. <br></div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">But it does not seem like a viable path so far.<br></div><div style="font-size:small" class="gmail_default">So your best bet is to post these data to the issues that others have</div><div style="font-size:small" class="gmail_default">complained about already, and hope that if enough people report this</div><div style="font-size:small" class="gmail_default">as a show stopper, they will modularize the code more, or do something</div><div style="font-size:small" class="gmail_default">else. <br></div><br></div></div>