I see with kubernetes it's possible to set node affinity for certain workloads. I'm wondering if there are any facilities in the various container technologies, such as docker, rocket etc that allow you to pin processes to cores? or if this is even possible in multitenant environments? Perhaps it would imply a bare metal setup?
1 Answer
If your system supports SMP (Symmetric multiprocessing) with some combination of multiple physical CPUs, CPU cores, and logical CPUs, you can assign Docker Containers to specific CPU resources.
Example Commands for CPU affinity with Docker Containers
The examples shown here cover the assignment of the mycontainer Docker Container to specific CPU resources when the containers are created with the docker run command. When running commands, you must substitute your Docker Container name and CPU component numbers to suit your environment.
This command will assign the mycontainer Docker Container to the first CPU (CPU0):
# docker run --cpuset 0 /bin/bash mycontainer
Multiple CPUs can be specified. This command will assign the mycontainer Docker Container to CPU 0 and 1:
# docker run --cpuset 0,1 /bin/bash mycontainer
A range of CPUs can be specified. This command will assign the mycontainer Docker Container to CPU 0, 1 and 2:
# docker run --cpuset 0-2 /bin/bash mycontainer
-
1great! found some more info here: ` --cpuset-cpus=6 ` agileek.github.io/docker/2014/08/06/docker-cpuset– barrymacCommented Oct 16, 2018 at 10:37
-
Welcome , you may find more information from docker documentation and kubernetes docs Commented Oct 16, 2018 at 14:50