我现在正在写一篇论文,我必须测量虚拟机的使用情况和功耗。
为此,我创建了一个虚拟机,然后登录到它并启动一个 lookbusy 进程,该进程利用分配的资源内存调到最大。
然而,我注意到(主机系统的)实际内存使用量在虚拟机使用几分钟后开始下降。
不过,当我重新登录虚拟机时,它显示已充分利用。
假设我的 VM 分配了 2GB。当我开始使用时,虚拟机和主机都显示 2GB 处于负载状态。
然而,不久之后,主机的内存开始减少,并停止在大约 400MB,尽管虚拟机仍然以最大速度工作。
我认为这与仅使用所需的内存页面有关,而不是与整个分配的内存有关。
这就是为什么我现在需要您的帮助 - 我需要一个工具,既可以让我利用分配的内存,
又可以保持真实主机内存的利用,以便我能够测量主机在这种负载下的功耗。
事实上,如果内存使用量在 1-2 分钟后没有开始下降,Lookbusy
就会完成它的工作。测量需要持续几天!
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)
“气球内存”也可能是一个问题,例如对于 VMWare:
http://www.virtualinsanity.com/index.php/2010/02/19/performance-troubleshooting-vmware-vsphere-memory/
PS:
如果您想生成过多的内存使用情况,并且您的 VM(客户操作系统)是 Linux,那么您始终可以使用“memtester”:
http://linux.die.net/man/8/memtester
"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
如果您想测量特定进程(例如进程 ID 1234)的内存消耗,则 /proc/1234/ 目录是相关的(或 /proc/self/从流程本身内部)。特别是其中的
stat
、statm
、status
和maps
伪文件。例如,cat /proc/self/maps
或cat /proc/self/status
为您提供有关cat
进程本身的信息。我不确定你所说的“测量虚拟机”是什么意思; AFAIK 虚拟机(例如 Qemu)会占用其指定的内存。
我也很好奇你是如何测量功耗的。
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 thestat
,statm
,status
andmaps
pseudo-files there. For instance,cat /proc/self/maps
orcat /proc/self/status
gives you information about thecat
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.
您没有提供很多细节...但是,根据使用情况,您可能会看到 ksm(内核同页合并)的效果。检查 ksm 是否启用。
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.