[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Estimating CPU utilization of DomU


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Gaurav Dhiman <dimanuec@xxxxxxxxx>
  • Date: Thu, 15 Jul 2010 17:59:09 -0700
  • Delivery-date: Thu, 15 Jul 2010 18:00:33 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=QDqgnBBBVm2WDJimYKpt2XRQGhIhutBy1lZaWkaqktfIK0xE8ViDenSaxzqI6pJSfJ ISxiRmS68/jGMIm+xArdWImwqQY60RRenScqFOYI3NobCOFOqVXlNhSmk/PJZ5hVI9a1 C8D50SG2ygt1nnkZeFGA3AxFFQz4X10A+kDcQ=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

Hi All,

I am trying to implement a small script to estimate the CPU
utilization of my DomU's from Domain-0 using libvirt APIs. I am using
the virDomainInfo structure for that:

struct virDomainInfo{
unsigned char   state   : the running state, one of virDomainState
unsigned long   maxMem  : the maximum memory in KBytes allowed
unsigned long   memory  : the memory in KBytes used by the domain
unsigned short  nrVirtCpu       : the number of virtual CPUs for the domain
unsigned long long      cpuTime : the CPU time used in nanoseconds
}

So basically I query this structure for my DomU's every 'n' seconds,
and get the CPU utilization by taking the difference of cpuTime (in
seconds) and diving it by 'n'. To verify my estimates, I am running
sar inside my DomU's (I do 100-%idle to estimate CPU util). It works
perfectly for CPU intensive DomU's, but I observe some discrepancies
for I/O intensive DomU's. My scripts shows higher CPU utilization than
the sar output. Sometimes the difference is close to 10-15%. I am not
sure what is the reason for this? Is there some time which the DomU
VCPUs spend running, which sar cannot see? Or does the libvirt API add
up the time spent by domain-0 for work done on behalf of DomU to its
structure?

Any insights here would be really helpful!

Thanks,
-Gaurav

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.