4

According to all the sources I read (openvz wiki, various mailinglists, forums, ..) the values of the cpuunits settings are relative to each other. So when all are equal and the system is busy, all receive the same cpu share.

But something still puzzles me with that: why is there a tool "vzcpucheck" which shows "the power of the node/ host":

Current CPU utilization: 18000
Power of the node: 880001

Why is there (do I need) an absolute number when all settings are only relative?

Shouldn't those two settings result in exactly the same?

ve1: 1
ve2: 1
ve3: 1
= 3

ve1: 293334
ve1: 293334
ve1: 293334
= 880001 (power of the node)

What's the difference?

gucki
  • 788
  • 2
  • 10
  • 28

2 Answers2

2

CPU units are CPU priority. The CPU priority comes into play when there are multiple VPS accounts needing more than the total amount of CPU processing power available at any given moment.

An example would be two hypothetical VPS accounts, VPS-A with 800 CPU units and VPS-B with 400 CPU units. If both VPS accounts request 100 percent of the CPU at the same time, VPS-A will get twice the CPU time that VPS-B gets, since 800 is twice as large as 400.

A VPS could still get 100% of the CPU if no other VPS accounts on the hardware node needed it, but that percentage would drop down as soon as another VPS needed CPU time.

source for quote here

Thus, if you want to set up a system whereby containers truly get a guaranteed amount of CPU you need to ensure you don't oversubscribe and carefully count your CPUUNITs against your power of the node carefully. The power of the node allows you to calculate how much a single CPUUNIT is worth (if you dont oversubscribe). e.g a 3hgz computer with 30 CPUUNITs would mean that 1 unit is worth 0.1 ghz (these are not real numbers). Thus you can use this as a guide for if one vm needs 1 ghz and another needs a dedicated 1.5ghz, use 10 and 15 accordingly. Just make sure you dont allocate more than 30 cpu units total, otherwise 10 no longer represents a guarantee of 1 Ghz.

Power of the node is really to solve this problem: Two CPUs that are both 3GHz may not perform the same amount of calculations per second due to advances in technology/different architectures. So different nodes may be able to handle more or less containers even though they have the same cpu frequency. This is why Amazon advertises compute capability in terms of ECU's instead of GHz.

You may find it easier to just use cpulimit, which is percentage of the CPU that the container cannot exceed. If you have two cores, a value up to 200% is acceptable. However the previous setup is more 'dedicated cpu with burst', whereas this, its easier to just set up 'dedicated cpu' (but you still have to ensure you dont oversubscribe your percentages)

Programster
  • 485
  • 12
  • 22
1

As CPU units must be read as "guaranteed CPU units". That clarifies the real meaning.

Each VE can potentially have all power of the node minus all CPU power guaranteed for all others VEs.

Kenny Rasschaert
  • 8,925
  • 3
  • 41
  • 58
samba
  • 11
  • 1