Skip to contentSkip to conversation

confusions on monitoring VM cpu usage in Xen hypervisor

DISCUSSION Charles 3 participants 5 messages Feb 20, 2014 – Feb 25, 2014 1 message not in the archive

lore
Share & tools
lore

Charles

author
#0 lore raw

Hi everyone, I‘m trying to monitor the VM CPU usage in xen hypervisor and use the VM CPU usage
information in Xen's Credit Scheduler. I googled it, and find that most references about this topic is monitoring the VM CPU usage information in Domain-0 while not in the Xen hypervisor.
I'm now blocking at how to determine the state of vCPU, My understanding is that vCPU running on a physical CPU doesn't mean it really consumes CPU cycles, so I could determine the whether vCPU is consuming CPU cycles or not? So could you please give me some advice.

Thank you very much!
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw
Quoted 3 lines · Charles

Hi everyone, I‘m trying to monitor the VM CPU usage in xen hypervisor and use the VM CPU usage information in Xen's Credit Scheduler.

Monitoring how? More important, "use the usage information in Credit" how and for what purpose?

Providing as much info as possible on the final goal is often very important for us to be able to help you.

Quoted 2 lines

I googled it, and find that most references about this topic is monitoring the VM CPU usage information in Domain-0 while not in the Xen hypervisor.

Provided that I really would like you to define better what you mean with "VM CPU usage", what I can say is that credit does not have any load tracking mechanism. Credit2 has, and it would be possible (and nice!) to abstract that from there and make it available for all schedulers.

Basically, that means moving some of the code in schedule.c, as well as add some callbacks, to be implemente by the various scheduler (Credit, Credit2, etc).

This is something I have on my TODO list since a while, but did not manage to get to it yet. If you think this would be helpful for you too, and you're up for helping, I'll be share to discuss/share more.

Quoted 2 lines

I'm now blocking at how to determine the state of vCPU, My understanding is that vCPU running on a physical CPU doesn't mean it really consumes CPU cycles, so I could determine the whether vCPU is consuming CPU cycles or not? So could you please give me some advice.

Mmm... if a vCPU is _running_ on a pCPU, I would say it is consuming pCPU cycles... But perhaps I am not understanding what you really mean here. So, again, please try to describe your final goal, I'm sure it will help figuring out things better.

Regards,
Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Re: confusions on monitoring VM cpu usage in Xenhypervisor

[please, don't drop the list. Re-added]

Quoted 3 lines · Charles

Thanks for your reply.
1.The VM usage I mean here is similar to the result of command top in the VM.

Ok, but still, when running top inside the VM, which part are you interested in? How busy the various vCPUs are or what (as in what process/OS component) is actually keeping the busy?

That matters because, how busy they are is something that you, to some extent, see in Xen, as it is at lest bound to how much he various vCPUs want to run on the host's pCPUs, and that's the hypervisor's scheduler's job!

If you want to know what process they're running, at what time that started, etc., what's the "priority" (inside the VM) then this is something I don't think you can easily have Xen aware of, unless you introduce some kind of scheduler paravirtualization.

Quoted 2 lines

2."use the usage information in Credit" means I want to use the usage information to guess the workload type running in the VM

Still too few info (see above). xentop tells already whether a particular vCPU is getting, say, 5% of pCPU time. Have something like that inside Xen should not be that hard.

What it does not (xentop) tell is whether a particular vCPU, despite getting 5%, is asking for more, and only getting that for whatever reason. That has to do with the estimation of the system load that I was mentioning, which is embedded in credit2 right now, but can be generalized.

So, which one, if any, of the above are you after?

Quoted 3 lines

To the best of my knowledge, when in physical OS, the CPU may be idle or busy. Then the OS CPU usage can be computed by (busy_time / (idle_time + busy_time)) If the vCPU is running the on pCPU and it's consuming pCPU cycles all the time, then is it mean idle_time = 0? then how to I compute the CPU usage?

Err... from Xen's perspective, if a vCPU is always running, then idle_time=0, then (busy_time/(idle_time+busy_time))=1, which matches with the concept of being "always running".

I'm sure I'm missing something of what you meant here...

Regards,
Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#4 lore raw

Re: confusions on monitoring VM cpu usage inXenhypervisor

1. I want the CPU usage information like this:

Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

2. From the VM's perspective, I want to make it out what's the sum of busy_time and idle_time,
According to my understanding, I think when a vCPU is scheduled on pCPU, from the perspective of vCPU, its (busy_time +idle_time) equals to the percentage of CPU it gets from the hypervisor (because I think when scheduled on a pCPU, the scenario is like a physical OS running, contains both busy_time and idle_time ), Then how could I know the busy_time of a vCPU from VM's perspective, since you have noted that if a vCPU is scheduled on pCPU, it keeps consuming CPU cycles?

[please, don't drop the list. Re-added]

Quoted 3 lines · Charles

Thanks for your reply.
1.The VM usage I mean here is similar to the result of command top in the VM.

Ok, but still, when running top inside the VM, which part are you interested in? How busy the various vCPUs are or what (as in what process/OS component) is actually keeping the busy?

That matters because, how busy they are is something that you, to some extent, see in Xen, as it is at lest bound to how much he various vCPUs want to run on the host's pCPUs, and that's the hypervisor's scheduler's job!

If you want to know what process they're running, at what time that started, etc., what's the "priority" (inside the VM) then this is something I don't think you can easily have Xen aware of, unless you introduce some kind of scheduler paravirtualization.

Quoted 2 lines

2."use the usage information in Credit" means I want to use the usage information to guess the workload type running in the VM

Still too few info (see above). xentop tells already whether a particular vCPU is getting, say, 5% of pCPU time. Have something like that inside Xen should not be that hard.

What it does not (xentop) tell is whether a particular vCPU, despite getting 5%, is asking for more, and only getting that for whatever reason. That has to do with the estimation of the system load that I was mentioning, which is embedded in credit2 right now, but can be generalized.

So, which one, if any, of the above are you after?

Quoted 3 lines

To the best of my knowledge, when in physical OS, the CPU may be idle or busy. Then the OS CPU usage can be computed by (busy_time / (idle_time + busy_time)) If the vCPU is running the on pCPU and it's consuming pCPU cycles all the time, then is it mean idle_time = 0? then how to I compute the CPU usage?

Err... from Xen's perspective, if a vCPU is always running, then idle_time=0, then (busy_time/(idle_time+busy_time))=1, which matches with the concept of being "always running".

I'm sure I'm missing something of what you meant here...

Regards,
Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
#5 lore raw
In reply to Charles
Quoted 10 lines · On Thu, 20 Feb 2014 16:09:31 +0800 "Charles" <[email protected]> wrote:

Hi everyone, I‘m trying to monitor the VM CPU usage in xen hypervisor and use the VM CPU usage information in Xen's Credit Scheduler. I googled it, and find that most references about this topic is monitoring the VM CPU usage information in Domain-0 while not in the Xen hypervisor. I'm now blocking at how to determine the state of vCPU, My understanding is that vCPU running on a physical CPU doesn't mean it really consumes CPU cycles, so I could determine the whether vCPU is consuming CPU cycles or not? So could you please give me some advice.

Quoted 5 lines

Thank you very much!
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Checkout simple utility called 'xmstat' I wrote a while ago, you might find it useful as it will tell you how vcpus are bouncing around and consuming cpus:

http://old-list-archives.xenproject.org/archives/html/xen-devel/2010-08/msg01586.html

thanks
mukesh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel