In need of a Linux memory-utilization tool

555 Views Asked by At

I'm working on a thesis right now where I have to measure the usage and power consumption of VM's.

To do so, I create a VM, then log into it and start a lookbusy process which utilizes the allocated memory to the max.

However, I noticed that the real memory-usage (of the host system) starts dropping after a couple minutes of VM-utilization.

When I log back in into the VM it shows full utilization, though.

Let's say, my VM has 2GB assigned. When I start the utilization, the VM as well as the Host show both that 2GB are under load.

After a short while however, the hosts' memory starts decreasing and stops at about 400MB although the VM still is working at the max.

I assume it has something to do with the usage of only the needed mem-pages, instead of the whole allocated memory.

This is why I now need your help - I need a tool that would let me utilize the allocated memory,

but also keep the real host's memory utilized as well, in order for me to measure the power consumption of the host under such load.

Lookbusy in fact would do its work, if the memory usage wouldn't start dropping after 1-2 minutes. The measurements need to last for days!

3

There are 3 best solutions below

0
On

You didn't offer many details... but, depending on the usage, you may be seeing the effects of ksm (kernel samepage merge). Check to see if ksm is enabled.

3
On

"Balloon memory" can also be an issue, for example with VMWare:

http://www.virtualinsanity.com/index.php/2010/02/19/performance-troubleshooting-vmware-vsphere-memory/

PS: If you want to GENERATE excessive memory use, and if your VM (guest OS) is Linux, then you can always use "memtester":

http://linux.die.net/man/8/memtester

4
On

If you want to measure memory consumption of a particular process (of process id 1234 for instance), the /proc/1234/ directory is relevant (or /proc/self/ from inside the process itself). In particular the stat, statm, status and maps pseudo-files there. For instance, cat /proc/self/maps or cat /proc/self/status gives you information about the cat process itself.

I'm not sure to understand what you mean by "measuring the VM"; AFAIK virtual machines like e.g. Qemu eat their specified memory.

I am also curious of how you measure power consumption.