I’m trying to understand a bit more about the relationship between what the “docker stats” command shows regarding CPU usage vs. the CPU usage on the host machine where I have started the container(recorded with tools like nmon, new relic)
I’ve noted in testing on a linux host with 1 CPU, for example, running a single docker container, that docker stats shows me very similar data to the host CPU (slightly under as I would expect, I would not expect my docker container CPU reading to be higher than the host, only equal or less)
However, I’ve noted that increasing the number of running containers (to 2 for example) shows me strange information around this.
The docker stats will begin to show me CPU numbers that are then higher than what the host CPU is reading. The difference grows as I drive more load towards the containers.
My main questions are - What is causing multiple docker containers to give me CPU readings that are higher than what the host CPU reads? How is this possible? Is there some issue with summing up multiple docker containers stats? Some additional overhead that’s not accounted for on the host CPU? And also why does the difference factor seem to grow if the containers are more busy?