66
edits
Changes
no edit summary
== CPU ==
There are two parameters controlling fair CPU scheduler in OpenVZ: cpuunits and cpulimit. Cpuunits are set via<pre>vzctl set 101 --cpuunits 1000 --save</pre>For example. If you set a cpuunit for one container to a value and set a cpuunit on another container to a different value, the time allotted to each of the containers will be the ratio of the two units. Let's use a real example. We did the following:<pre>vzctl set 101 --cpuunits 1000 --savevzctl set 102 --cpuunits 2000 --savevzctl set 103 --cpuunits 3000 --save</pre> If we started a cpu intensive application on each VE, then 103 would be given 3 times as much cpu time as 101 and 102 would get twice as much as 101, but some fraction of what 103 got. Here's how to determine what the real ratios are. Add the three units, 1000+2000+3000 = 6000 101 gets 1000/6000 or 1/6th of the time. (16%)102 gets 2000/6000 or 1/3rd of the time. (34%)103 gets 3000/6000 or 1/2 of the time. (50%) CPULIMIT The cpulimit parameter sets the absolute maximum limit for a container to a percent value. For instance:<pre>vzctl set 101 --cpulimit 25 --save</pre>says that container 101 cannot ever have more than 25 percent of the cpu even if the cpu is idle for the other 75% of the time.
{{Stub}}