While investigating some performance problem, I've faced the need to understand exactly what is the memory consumption of process on linux server.
While looking to be simple, it takes a while to figure out how different statistics are calculated.
The first tool to use, is of course, top command.
One should remember that not all flags are enabled by default. So, for example, to enable SWAP statistics, one should run top, press 'f' in order to mark needed fields, then press 'p' and enter.
For user space process, next formula is useful: VIRT = SWAP + RES, means total amount of memory used by process consists of amount of physical memory + amount of swapped memory.
% MEM shows percentage of RES relatively to Mem - total amount of physical memory, not including swap.
Thrashing and paging could be traced through nFLT and nDRT fields of top.
Full report about memory used by process and by included shared libraries one can get using pmam -x `pidof my_process`
Swap can be disabled by commenting out swap line in /etc/fstab file
Useful links:
Good description of top:
http://www.linuxforums.org/articles/using-top-more-efficiently_89.html
Article about pmap:
http://www.cyberciti.biz/tips/howto-find-memory-used-by-program.html
Saturday, April 24, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment