-
Notifications
You must be signed in to change notification settings - Fork 70
[Proposal] [RFC] Start VMs with 1 vCPU #1032
Description
Description
By default the runtime starts the VM with the same number of physical cores, sometimes when the number of physical cores is not too big, the boot time and memory consumption is not a problem, but when the number of physical cores is big, the boot time and memory footprint increase [*]:
time to create and destroy a container
+-----------------------+----------------+---------------------+
| Container CPUs_Mem | time(s) | Memory footprint(Mb)|
+=======================+================+=====================+
| 2cpus_2gb | 1.7401 | 68.36 |
+-----------------------+----------------+---------------------+
| 88cpus_2gb | 2.34915 | 166.008008 |
+-----------------------+----------------+---------------------+Other point to consider is the fact that the runtime must have support to update container's resources dynamically, and the only way to achieve this is through QEMU hot-plug and cgroups.
The VM should start with the minimum number of resources (CPU and Memory) to allow the runtime hot plug and unplug resources as needed.
The difference between starting the container with 1 and 2 vCPUs is not considerable [+]
time to create and destroy a container
+--------------------+----------------+
| Container vCPUs | time(s) |
+====================+================+
| 1 | 1.017 |
+--------------------+----------------+
| 2 | 1.0129 |
+--------------------+----------------+[*] thanks to @grahamwhaley for the data
[+] using launch_times.sh -i debian -n 100 -r cc-runtime
Proposal
- Change
default_vcpusto 1 in the runtime configuration file
Currently when a container with CPU constrains is created using docker, the VM starts with a different number of vcpus than the value specified by default_vcpus, this was an expected behaviour but with containers/virtcontainers#512 a CPU cgroup is created inside the VM limiting the CPU usage of the container, hence doesn't matter if the VM has 89 vCPUs the container only can use the CPUs of the cgroup.
- Always start the VM with the number of vCPUs specified by
default_vcpus