0

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!

Kara
  • 6,115
  • 16
  • 50
  • 57

3 Answers3

1

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.

jim washer
  • 73
  • 7
1

"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

paulsm4
  • 114,292
  • 17
  • 138
  • 190
  • Hello, thanks for your answers. It really seems I am experiencing the effects of KSM, and this is why I tried to disable it. However, in this case I get another problem - the host's memory now stays utilized, but after I finish the utilization in the VM, the host still says that 2GB are loaded, although no process is loading it anymore. This on the other hand might be a virtio ballooning problem. – Adnan Pasic Dec 05 '11 at 09:12
  • To provide you with more information - for my project I need to create and migrate VMs over the hosts. to be able to do that I use a framework called "opennebula" (www.opennebula.org), which makes it possible to do everything with just one click. Opennebula however works via KVM, creates the xml files all by itself, etc. Since I have to use opennebula I can't change anything in KVM itself, can't create the xml files or anything - everything has to be done automatically by this framework. – Adnan Pasic Dec 05 '11 at 09:12
  • And that's when my problem emerges! I have tried the programme "memtester" and it looks very promising, but it stops after approx. 5 seconds, even when I set the iterations to one million or so. Do you have any idea what might be going on there?? Any more tips about such programmes????? Please help! :( – Adnan Pasic Dec 05 '11 at 09:12
0

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.

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547
  • Ehm, I guess you didn't quite understand my problem. I don't want to see the memory consumption of a single process, but I need a process that would utilize the virtual memory of a virtual machine! There are programmes which tend to do that (like e.g. "stress", "lookbusy", or "prime95"), but as I explained above, the problem is that the real memory of the host on which the VM is running, starts decreasing. This is why I need a programme that would keep the virtual memory utilized and prevent this drop! – Adnan Pasic Dec 04 '11 at 18:08
  • Oh, and for the power consumption - I have a raritan power distribution unit in which my servers are plugged. This power unit allows one to query every single power socket via SNMP for the current power consumption in Watt. – Adnan Pasic Dec 04 '11 at 18:11
  • Writing a program consuming a lot of memory don't seems to be an issue to me... (e.g. a program allocating a big tree of 2**20 elements in a Scheme interpreter). – Basile Starynkevitch Dec 04 '11 at 18:36
  • Well, I'm not very much of a computer scientist and programmer, so this is the point where I hoped somebody could help me :) – Adnan Pasic Dec 04 '11 at 18:52