beer9
asked on
how to calculate total memory used in freebsd ?
I am using these two command in freebsd box.
ps aux | awk '{memory +=$4}; END {print memory }'
5134.9
ps aux | awk '{memory +=$6}; END {print memory }'
246991968
whereas total physical memory is
sysctl -a | grep -i hw.physmem
hw.physmem: 4289929216
What is the difference between the output of %Mem and RSS of 'ps' command ?
ps aux | awk '{memory +=$4}; END {print memory }'
5134.9
ps aux | awk '{memory +=$6}; END {print memory }'
246991968
whereas total physical memory is
sysctl -a | grep -i hw.physmem
hw.physmem: 4289929216
What is the difference between the output of %Mem and RSS of 'ps' command ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
There are shared libraries and SHM segments that count multiple times if you run daemonized servers and/or databases.
ASKER
yeah.. I am running above in mysql server.. which have around 900 established connection. So I want to find how much memory mysql processes are using..
opesource databases are notoriously intrackable in regard of memory usage.
you should take sum of virtual memory sizes, and retract shared memory size from each process using shared memory (as seen by ipcs -m)
Then dynamic loader comes around - it loads one instance of shared library ans shares between multiple processes.
you should take sum of virtual memory sizes, and retract shared memory size from each process using shared memory (as seen by ipcs -m)
Then dynamic loader comes around - it loads one instance of shared library ans shares between multiple processes.
ASKER
on more info I need, how can I identify whether particular process is a shared libraries or SHM segments, I will count those process only once to get the accurate result.
P.S: what is SHM ?
P.S: what is SHM ?
ASKER
Excellent!
You can get full path to executable from ps, then use ldd command to see which modules can be loaded.
SHM - SysV shared memory
SHM - SysV shared memory
ASKER