Allocating dedicated shared CPU
A logical host, e.g., KUBERNETES Kubelet, receives a request for instantiation of containers with shared CPUs that includes an annotation. The logical host adds the shared CPUs to a best-effort set of CPUs available for use by any process. The logical host calls a CRI to instantiate the containers and passes the annotation to the CRI. The CRI is an agent of an orchestrator and binds the shared CPUs to the containers such that the shared CPUs are dedicated to the containers. The CRI adds the shared CPUs to a shared CPU set.
1 . An apparatus comprising:
a computing device including a plurality of processing devices and one or more memory devices operably coupled to the plurality of processing devices, the one or more memory devices storing executable code that, when executed by the plurality of processing devices, causes the plurality of processing devices to:
receive, by a logical host, a request to instantiate two or more containers, the request including a request for a shared allocation of one or more processing devices from the plurality of processing devices and an annotation indicating that the one or more processing devices are to be dedicated to the two or more containers and shared by the two or more containers; and
in response to the request:
allocate, by the logical host, in response to the request for the shared allocation, the one or more processing devices from the plurality of processing devices to a best-effort set of processing devices usable by any process executing on the computing device; and
after allocating, bind, by a container runtime interface separate from the logical host in response to the annotation, the one or more processing devices to the two or more containers as dedicated shared processing devices usable only by the two or more containers and no longer part of the best-effort set;
wherein the executable code, when executed by the plurality of processing devices causes the plurality of processing devices to execute an operating system on the best-effort set of processing devices other than the one or more processing devices.
2 . The apparatus of claim 1 , wherein the executable code, when executed by the plurality of processing devices, further causes the plurality of processing devices to:
invoke, by the logical host, instantiation of the two or more containers by the container runtime interface;
pass, by the logical host, the annotation to the container runtime interface; and
instantiate, by the container runtime interface, the two or more containers.
3 . The apparatus of claim 1 , wherein the plurality of processing devices are a plurality of processor cores on a common chip.
4 . The apparatus of claim 1 , wherein the executable code, when executed by the plurality of processing devices, further causes the plurality of processing devices to:
add a reference to the one or more processing devices to a shared processor set.
5 . The apparatus of claim 1 , wherein the logical host is a Kubelet according to KUBERNETES.
6 . The apparatus of claim 1 , wherein the container runtime interface is configured to cooperate with a kernel executing on the computing device to bind the one or more processing devices to the two or more containers.
7 . The apparatus of claim 1 , wherein the container runtime interface is configured to instantiate the two or more containers by further instantiating application instances within the two or more containers.
8 . The apparatus of claim 1 , wherein the container runtime interface is configured to instantiate the two or more containers by instantiating the two or more containers in a pod implemented by the logical host.
9 . The apparatus of claim 1 , wherein the computing device is part of a cloud computing platform.
10 . A method comprising:
receiving, by a logical host on a computing device comprising a plurality of processing devices, a request to instantiate two or more containers, the request including a request for a shared allocation of one or more processing devices from the plurality of processing devices and an annotation indicating that the one or more processing devices are to be dedicated to the two or more containers and shared by the two or more containers; and
in response to the request:
allocating, by the logical host, in response to the request for the shared allocation, the one or more processing devices from the plurality of processing devices to a best-effort set of processing devices usable by any process executing on the computing device;
after allocating, binding, by a container runtime interface on the computing device and separate from the logical host, in response to the annotation, the one or more processing devices to the two or more containers as dedicated shared processing devices usable only by the two or more containers and no longer part of the best-effort set; and
executing an operating system on the best-effort set of processing devices other than the one or more processing devices.
11 . The method of claim 10 , further comprising:
invoking, by the logical host, instantiation of the two or more containers by the container runtime interface;
passing, by the logical host, the annotation to the container runtime interface; and
instantiating, by the container runtime interface, the two or more containers.
12 . The method of claim 10 , wherein the plurality of processing devices are a plurality of processor cores on a common chip.
13 . The method of claim 10 , further comprising adding a reference to the one or more processing devices to a shared processor set.
14 . The method of claim 10 , wherein the logical host is a Kubelet according to KUBERNETES.
15 . The method of claim 10 , wherein the container runtime interface is an agent of an orchestrator, the request being received from the orchestrator.
16 . The method of claim 10 , further comprising, cooperating, by the container runtime interface, with a kernel executing on the computing device to bind the one or more processing devices to the two or more containers.
17 . The method of claim 10 , further comprising instantiating, by the container runtime interface, application instances within the two or more containers.
18 . The method of claim 10 , further comprising instantiating the two or more containers in a pod implemented by the logical host.