Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker hyperkit process CPU usage going crazy. How to keep it under control?

Using docker (docker-compose) on macOS. When running the Docker containers and attaching Visual Studio Code (VSCode) to the active app container it can make the hyperkit process go crazy :( the macBook fans have to go at full speed to try to keep the temperature down.

When using VSCode on python files I noticed that actions, such as done by pylint, that result in scanning/parsing your file will increase the hyperkit CPU usage to the max and the macBook fans go on full speed :(. Hyperkit CPU usage goes down again when the action of pylint is finished.

When using VSCode to debug my Django Python app the hyperkit CPU usage goes to the max again. When actively debugging the hyperkit goes wild but it does settle down again afterwards.

I'm currently switching "bind mounts" to "volume mounts" I think I see some improvements but haven't done enough testing to say anything conclusive. I've only switched my source code to using "volume mount" instead of "bind mount" and will do the same for my static files and database and see if that results in improvements.

You can check out this stackoverflow post on Docker volumes for some more info on the subject. Here is some post that I found regarding this issue: https://code.visualstudio.com/docs/remote/containers?origin_team=TJ8BCJSSG https://github.com/docker/for-mac/issues/1759

Any other ideas on how to keep the hyperkit process under control❓

[update 27 March] Docker debug mode was set to TRUE I've changed this to FALSE but I have not seen any significant improvements.

[update 27 March] Using "delegated" option for my source code (app) folder and first impressions are positive. I'm seeing significant performance improvements we'll have to see if it lasts 😀 FYI Docker docu on delegated: the container’s view is authoritative (permit delays before updates on the container appear in the host)

[update 27 March] I've also reduced the number of CPU cores Docker desktop can use (settings->advanced). Hopefully this prevents the CPU from getting too hot.

like image 514
Dennis Avatar asked Mar 27 '20 01:03

Dennis


People also ask

Does Docker limit CPU usage?

CPU. By default, each container's access to the host machine's CPU cycles is unlimited. You can set various constraints to limit a given container's access to the host machine's CPU cycles.

How many CPUs should I give Docker?

Performance and Containers If no value is provided docker will use a default value. On windows, a container defaults to using two CPUs. If hyperthreading is available this is one core and two logical processors. If hyperthreading is not available this is two cores and two logical processors.

What is CPU quota Docker?

0 of Docker onward. The --cpu-quota option specifies the number of microseconds that a container has access to CPU resources during a period specified by --cpu-period. As the default value of --cpu-period is 100000, setting the value of --cpu-quota to 25000 limits a container to 25% of the CPU resources.

Does Docker use all CPU?

By default, Docker does not apply any CPU limitations. Containers can all of the hosts given CPU power. Relax, a Docker container will not consume the entire CPU power of your physical host. If you are using Docker Desktop, the host I mentioned, it is a virtualized host, responsible for running your Docker containers.


1 Answers

I "solved" this issue by using http://docker-sync.io to create volumes that I can mount without raising my CPU usage at all. I am currently running 8 containers (6 Python and 2 node) with file watchers on and my CPU is at 25% usage.

like image 133
Theo Avatar answered Nov 01 '22 04:11

Theo