On 6/6/06, <b class="gmail_sendername">Kir Kolyshkin</b> <<a href="mailto:kir@openvz.org">kir@openvz.org</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
CPU limit is in per cent units. I.e. if your server has a single CPU,<br>use --cpulimit 10 to limit a VE to 10% of the CPU.<br><br>On a two-way SMP box max. value of cpulimit is 200. Say, if you want a<br>VE to use no more than one CPUs, use --cpulimit 100.
</blockquote><div><br><br>Thanks ! This solved the problem. However, I still see the loadavg at 100% (got from cat /proc/loadavg), but if I run top and see the CPU% for the one particular application (while(1) loop), it is limited to 10% CPU.
<br><br>I can add up the CPU% for all the processes running in the container, and can get the current % utilization of the container. Is there a better way to do this?<br><br>Pradeep<br> </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Pradeep Padala wrote:<br><br>> Thanks for the explanation, but I DID use the --cpulimit parameter.<br>><br>> I set the limit to 1000 units, I run a while(1) loop, and I see a 100%<br>> loadavg on the host node. Shouldn't it be somewhere around 10% ?
<br>><br>> Pradeep<br>><br>> On 6/6/06, *Kir Kolyshkin* <<a href="mailto:kir@openvz.org">kir@openvz.org</a> <mailto:<a href="mailto:kir@openvz.org">kir@openvz.org</a>>><br>> wrote:<br>><br>> Looks like you misunderstand the concept of cpuunits. cpuunits is
<br>> not a<br>> hard limit, but just a suggestion, and a CPU time is shared<br>> proportionally to the values given. So, if you will have 9 VEs and the<br>> host system with cpuunits set to 1000 for all of them, and run the
<br>> loop<br>> in all of them, each VE will use 10% of the CPU time.<br>><br>> In case you will stop the loop running in 5 VEs so there will be 4<br>> such<br>> VEs (plus the host system) left, each of them will use 20% of the CPU.
<br>> So, all the CPU time is distributed between VEs which will need it,<br>> according with their proportional cpuunits.<br>><br>> More to say, the concept of "total CPU units" is purely fiction,
<br>> and is<br>> here just for the convenience. People do want to set CPU units is<br>> terms<br>> of processor's megaherts, and this is what cpuunits does. But in<br>> fact it<br>> is not a megaherts but just a relative weights.
I.e. all the cpuunits<br>> values are relative to each other, it doesn't matter what the actual<br>> numbers are -- what matters is a number given to a VE in relation<br>> to the<br>> sum of all cpuweights (which is expressed as "total CPU units"
<br>> just for<br>> the convenience).<br>><br>> So, cpuunits, if you do not oversell them, are a CPU guarantee, not a<br>> limit. If you want CPU limit -- use cpulimit parameter.<br>><br>
> Pradeep Padala wrote:<br>><br>> > Hi,<br>> ><br>> > I am trying to measure the CPU utlilization of the VZ<br>> containers, and<br>> > change the cpu share dynamically. I have poured over most of the
<br>> > documentation, and looked at the code as well, and it seems like<br>> > there's no utility that can directly show the current CPU<br>> utilization<br>> > of a container (some thing like 30% of CPU). A search on the
<br>> user list<br>> > got me a message, where someone suggested using loadavg.<br>> However, It<br>> > seems like the loadavg is not showing the proper utilization (or<br>> > showing the total CPU utilization). This is what I am doing.
<br>> ><br>> > I setup a container with 1000 units limit (total CPU units:<br>> ~10000). I<br>> > wrote a small do {; }while(1); loop and ran it in the container,<br>> now I<br>
> > do cat /proc/loadavg in both the container and on the host node.<br>> > Since, the container is only using 1000 units, I should see<br>> something<br>> > like 100% loadavg in the container, and 10% loadavg in the hostnode.
<br>> > But, I see 100% at both places. Am I doing something wrong? How do I<br>> > get the current cpu utilization of a container?<br>> ><br>> > Thanks,<br><br></blockquote></div>