-
Notifications
You must be signed in to change notification settings - Fork 375
Memory usage doesn't match memory limit in container spec #1822
Comments
expected 8G !== actual 9G |
Hi @ekifox - thanks for posting. I'm sure we had a document explaining this and some of the heuristics used to do the calculation - but, I cannot find it.... @egernst @jcvenegas - did I dream that, or did it maybe get part-cleaned up during the recent docs/arch re-org, and needs re-adding in somewhere? We should explain somewhere, as this is not the first time the question has been asked. And then, all the other references to do with adding extra options are more to do with how kata reports its memory usage back to k8s I believe, so we can get the auto-balancing and pod/node allocation correct... so, note, this query itself was from docker. |
@ekifox VM was started with 1G [1] and 8G were hot plugged (-m 8G), the container in the VM has a memory constraint of 8G, the rest is used for overhead (guest kernel, kata-agent, systemd). If you want to honour the amount of memory then set it using [1] and don't use |
Thanks @devimc - I meant to ask if the container workload is then actually constrained in a memory cgroup to the size of the |
Okay, thank you all for the answers! :) But, then I tried to low RAM from 8G (9G) to 2G by it is impossible to lower RAM in runtime? |
Ah, I think that is a wrinkle to do with the complexities of VM memory hotplug - it is easy to plug memory in, but not so easy to unplug it (especially if it is now in use etc.). So, I think we can expand, but do not shrink. Also, I'm not sure if the speaking of which, I think you'll find the same/similar situation with Yes, we do need to document this better ;-) |
It may be possible reduce the memory at runtime via virtio-balloon or virtiofs-mem, there is an old PR that tries to do that but, not it doe not have high priority, so for now that is a limitation. The workload still be limited to the limits via cgroups in the guest side, but if your container initially used those 8G and those 8G will be assigned to the VM as it does not return pages back. In that case it may be better to stop that container and create a new container with the new memory limits. |
Description of problem
Running a container with memory limit == 4gb specified, but got much larger memory size when checking memory info in the container.
Expected result
Actual result
The text was updated successfully, but these errors were encountered: