DiigIT | IT Community
No Profile Image
Welcome Guest
New User? Register | Login

Memory Utilization

By: rekha singh | 13 May 2010 11:34 am
I have Oracle database servers, and I am not only looking for max memory utilization (as found in /proc/meminfo)
 
I am also looking for instantaneous/ mean , and the best I can think of is top, which is not quite helping me.
 
I am trying to find a mean or an average memory utilization. But meminfo only gives a max representation.
 
Any suggestions?

 

Comments

The short answer is, at least for current utilization, /proc/meminfo which gives you MemTotal and MemFree, the difference between which would be current utilization.

 
For a quick and dirty average, I always just scripted a cron job to run at a set interval.
 
That ran a script that would find the current usage and add it to a file, then would sum the totals and divide by the lines to get a current average usage.
 
There seems to be a lot of discussion, though, on the internet, about what constitutes actual memory usage since linux relies a LOT on shared libraries, so if you have progA showing 1024K used, and progB showing 1024K used, but they both use LibraryA which occupies 200K, then the REAL usage for both progA and progB would be 1024k - 200k since the memory being used by LibraryA is actually being shared between the two making the memory space for LibraryA system overhead instead of program usage... if that makes any sense.
 
At least, that's my understanding. ..
 
but as I said, for a quick and dirty average, just periodically sample meminfo to get current usage, and then average that with other periodic samples...
 
Cheers
 

 

By: rekha singh | 13 May 2010

The short answer is, at least for current utilization, /proc/meminfo which gives you MemTotal and MemFree, the difference between which would be current utilization.

 
Isnt this more of a maximum???  as this tracks pages used,so it is more of a straight line?
 
Possibly, I'm not sure if it's counting pages or actual memory amounts... it changes dynamically based on current usage... however, it's also system wide...
 
If you want process specific, look at /proc/PID/status and have a look these entries:
 
VmSize: The size of the virtual memory allocated to the process
VmLck: The amount of locked memory
VmRSS: The amount of memory mapped in RAM ( instead of swapped out )
VmData: The size of the Data segment
VmStk: The stack size
VmExe: The size of the executable segment
VmLib: The size of the library code
VmPTE: Size of the Page Table entry
 
VmRSS should be the memory used by the process itself and VmData should be the memory used to store data for that process.
 
Those should go up and down as memory is allocated and flushed while the process is running...
 
to see this, open Firefox, then run this script in a terminal:
 
#!/bin/bash
 
while true; do
grep Vm /proc/`pidof firefox`/status
sleep 1
done
 
Then in firefox, open some tabs, then open a new window, and open more tabs inside the new window... then close the second firefox window and close some of the tabs in the first window.
 
Check the script output while doing so, and You'll see VmRSS and VmData going up and down accordingly (may take a few seconds for it to really show)...
 
Maybe that'll help you a bit.
 
By: rekha singh | 13 May 2010

Leave a comment

Enter the text in the image
img
Can't read?
Type the characters you see in the picture below.


Close Move