Calculating memory footprints using /proc/sysvipc/shm
- by MarkTeehan
This is for a SLES 10 database server.
One of my servers runs three databases and three app servers; I am analyzing how their shared memory segments grow and shrink to avoid intermittent out-of-memory scenarios. "Top" is hot helpful for this since its calculations for RES and VIRT are inconsistent.
I am doing this by matching up the contents of /proc/sysvipc/shm with memory usage reported by the database admin console.
I do this by totaling up saving the contents of /proc/sysvipc/shm and then total up "bytes" for all of the segments for the offending userid. This is a large server with hundreds of segments and tens (or hundreds) of GB of allocated memory per userid.
However it doesn't match up - the database management software claims to be using around 25% more memory than the total I calculate.
Negligible swap space is in use, so I am ignoring that. I am running it as root so I am sure I see all shared memory segments.
My question is : is all (significant) allocated memory recorded in /proc/sysvipc/shm, or is this only shared memory (*and not "un-shared" memory?).
If this is incorrect, what is the correct way to calculate out the total allocated memory for each userid?
Also: I believe doing a 'cat' on this file locks server IPC. I check it every 5 seconds - is it likely that this frequency could be problematic?
Thanks!
Mark Teehan
Singapore