kolla-ansible/doc/source/reference/resource-constraints.rst
Lakshmi Prasanna Goutham Pratapa 76210a2d85 Apply Resource Constraints to Openstack Services
This commit is to apply resource-constraints only to few OpenStack services.
Commit to apply constraints to other services will be made in coming commits.

Partially-Implements: blueprint resource-constraints

Change-Id: Icafa54baca24d2de64238222a5677b9d8b90e2aa
2018-07-25 17:05:04 +01:00

2.5 KiB

Resource Constraints in Kolla Ansible

Overview

Since the Rocky release it is possible to restrict the resource usage of deployed containers. In Kolla Ansible, container resources to be constrained are referred to as dimensions.

The Docker documentation provides information on container resource constraints. The resources currently supported by Kolla Ansible are:

cpu_period
cpu_quota
cpu_shares
cpuset_cpus
cpuset_mems
mem_limit
mem_reservation
memswap_limit
kernel_memory
blkio_weight

Pre-deployment Configuration

Dimensions are defined as a mapping from a Docker resource name

Resource Constraints
Resource Data Type Default Value
cpu_period Integer 0
blkio_weight Integer 0
cpu_quota Integer 0
cpu_shares Integer 0
mem_limit Integer 0
memswap_limit Integer 0
mem_reservation Integer 0
cpuset_cpus String ''(Empty String)
cpuset_mems String ''(Empty String)

The variable default_container_dimensions sets the default dimensions for all supported containers, and by default these are unconstrained.

Each supported container has an associated variable, <container name>_dimensions, that can be used to set the resources for the container. For example, dimensions for the nova_libvirt container are set via the variable nova_libvirt_dimensions.

For example, to constrain the number of CPUs that may be used by all supported containers, add the following to the dimensions options section in /etc/kolla/globals.yml:

default_container_dimensions:
  cpuset_cpus: "1"

For example, to constrain the number of CPUs that may be used by the nova_libvirt container, add the following to the dimensions options section in /etc/kolla/globals.yml:

nova_libvirt_dimensions:
  cpuset_cpus: "2"

Deployment

To deploy resource constrained containers, run the deployment as usual:

$ kolla-ansible deploy -i /path/to/inventory