In addition to defining the number of vCPUs assigned to an instance, limits on the use of these CPU cycles can be further imposed. Nova relies on the underlying hypervisor for the specific implementation of the CPU limits, and thus the values available may vary. Our example is based on QEMU/KVM.
CPU limits are a special case of flavor attributes that you may encounter.
To add a CPU limit to a flavor, you will need the following:
openstack
command-line clientopenrc
file containing appropriate credentialsThese values in our example are as follows:
cpu_quota
= 5000 mscpu_period
= 2500 msThe following commands are used to add CPU limits to a flavor.
properties
set:openstack flavor show openstack.cookbook
This gives the following output:
openstack flavor set --property quota:cpu_quota=5000 --property quota:cpu_period=2500 openstack.cookbook
properties
field:openstack flavor show openstack.cookbook
This gives an output like the following:
In order to help mitigate the noisy neighbor issue, or to provide further definition of service levels, OpenStack supports CPU limits. In OpenStack, this is called the Instance Resource Quota. CPU limits are part of the flavor definition. Meaning, all instances of a given flavor will have the same CPU limits.
Imposing CPU limits are hypervisor specific. For KVM/libvirt environments, CPU limits are enforced using cgroups, using a combination of the following three values:
cpu_shares
cpu_quota
cpu_period
A full discussion of what these values are and how they interact is beyond the scope of this book. However, you can find a detailed explanation of them on the OpenStack wiki at the following:
3.135.205.172