What do cpu_shares, cpu_period and cpu_quota represent in flavours customization?

asked 2013-10-11 10:38:28 -0500

Zaino gravatar image

updated 2013-10-11 17:22:05 -0500

smaffulli gravatar image

I am reading openstack cloud administrator guide. On page 47 in Flavors customization topic following terms are defined.

The optional cpu_shares element specifies the proportional weighted share for the domain. If this element is omitted, the service defaults to the OS provided defaults. There is no unit for the value, it's a relative measure based on the setting of other VMs. For example, a VM configured with value 2048 will get twice as much CPU time as a VM configured with value 1024.

The optional cpu_period element specifies the enforcement interval(unit: microseconds) for QEMU and LXC hypervisors. Within period, each VCPU of the domain will not be allowed to consume more than quota worth of runtime. The value should be in range [1000, 1000000]. A period with value 0 means no value.

The optional cpu_quota element specifies the maximum allowed bandwidth(unit: microseconds). A domain with quota as any negative value indicates that the domain has infinite bandwidth, which means that it is not bandwidth controlled. The value should be in range [1000, 18446744073709551] or less than 0. A quota with value 0 means no value. You can use this feature to ensure that all vcpus run at the same speed. An example:

nova flavor-key m1.low_cpu set cpu_quota=10000
nova flavor-key m1.low_cpu set cpu_period=20000

In that example, the instance of m1.low_cpu can only consume a maximum of 50% CPU of a physical CPU computing capability.

My Questions

What is cpu_period. In above example what does value 20000 indicating.

What is cpu_quota. In above example what does value 10000 indicating.

Can anyone please elaborate with example ?

edit retag flag offensive close delete