OpenVZ Forum


Home » Mailing lists » Users » Measuring and Adjusting CPU utilization
Re: Measuring and Adjusting CPU utilization [message #3603 is a reply to message #3602] Tue, 06 June 2006 23:17 Go to previous messageGo to previous message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

Looks like you misunderstand the concept of cpuunits. cpuunits is not a
hard limit, but just a suggestion, and a CPU time is shared
proportionally to the values given. So, if you will have 9 VEs and the
host system with cpuunits set to 1000 for all of them, and run the loop
in all of them, each VE will use 10% of the CPU time.

In case you will stop the loop running in 5 VEs so there will be 4 such
VEs (plus the host system) left, each of them will use 20% of the CPU.
So, all the CPU time is distributed between VEs which will need it,
according with their proportional cpuunits.

More to say, the concept of "total CPU units" is purely fiction, and is
here just for the convenience. People do want to set CPU units is terms
of processor's megaherts, and this is what cpuunits does. But in fact it
is not a megaherts but just a relative weights. I.e. all the cpuunits
values are relative to each other, it doesn't matter what the actual
numbers are -- what matters is a number given to a VE in relation to the
sum of all cpuweights (which is expressed as "total CPU units" just for
the convenience).

So, cpuunits, if you do not oversell them, are a CPU guarantee, not a
limit. If you want CPU limit -- use cpulimit parameter.

Pradeep Padala wrote:

> Hi,
>
> I am trying to measure the CPU utlilization of the VZ containers, and
> change the cpu share dynamically. I have poured over most of the
> documentation, and looked at the code as well, and it seems like
> there's no utility that can directly show the current CPU utilization
> of a container (some thing like 30% of CPU). A search on the user list
> got me a message, where someone suggested using loadavg. However, It
> seems like the loadavg is not showing the proper utilization (or
> showing the total CPU utilization). This is what I am doing.
>
> I setup a container with 1000 units limit (total CPU units: ~10000). I
> wrote a small do {; }while(1); loop and ran it in the container, now I
> do cat /proc/loadavg in both the container and on the host node.
> Since, the container is only using 1000 units, I should see something
> like 100% loadavg in the container, and 10% loadavg in the hostnode.
> But, I see 100% at both places. Am I doing something wrong? How do I
> get the current cpu utilization of a container?
>
> Thanks,
> --
> Pradeep Padala
> http://ppadala.blogspot.com
>
> ------------------------------------------------------------ ------------
>
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Noob questions
Next Topic: Live migration and SAN
Goto Forum:
  


Current Time: Wed Aug 21 17:20:18 GMT 2024

Total time taken to generate the page: 0.03135 seconds