Docker is very slow - 'vmmem' is consuming all CPU

I have a dev setup running under windows with linux-based images for 1) my app server and 2) a postgres server.

While running docker recently after updating my Windows to the October update (1809), I am seeing that the response times for even simple queries have become abysmally slow (10 seconds instead of somewhere around 50ms).

I suspect it’s this Vmmem process which is causing the issue - it’s consuming as much as 60% CPU while consuming nothing else, and I noticed that the CPU usage only flares up whenever I start seeing the response times rising, so there might be a correlation.

This has made running docker under Windows a very painful experience. I tried searching for related issues, but didn’t find any relevant ones. Is there any fix for this which I can do to solve it?

4 Likes

@kumarharsh - I’m having the same issue. Did you find at least a temprorary solution?

I had the same issue. I’ve been able to fix it by increasing CPU, Memory and Swap.

You can change these settings under:
Settings > Advanced

Screenshot:

I don’t have this option.

The other screens don’t have the option you’re showing either.

I don’t use Kubernetes.

So… now what’s the solution?

I don’t know what these apps are doing.

My computer is running slow. I have an i7 Windows 10 Pro with 16GB of RAM at 70% usage, and CPU is between 1 and 15% with Docker Desktop and Vmmem. I just used the install defaults and followed the tutorials.

I’m currently running the example-voting-app tutorial. I just ran the build command and came back from shopping.

I can’t fathom why these are constantly using CPU.

@dockitdave To see this option, you have to run Docker vm in Linux mode, in Windows mode it is unavailable

Have you tried looking at Resources > Advanced ? I see the settings in there. Changed it and it seems to help, now CPU is running normal. See that memory consumption is now high though (make sense, vmmem properly was busy swapping). Thanks for the tip @ [tmuecksch]

Your Docker is running on WSL (specifically WSL 2). You will have to change the resources options for your system’s entire WSL 2 through the .wslconfig file in the %UserProfile% directory. See Advanced settings configuration in WSL | Microsoft Docs for details.

3 Likes

Thank you, I just create .wslconfig enable wsl2 and it fix the problem

I had the same problem and fixed that by .wslconfig. But i have quesion, when the load increases (if containers need more cpu ram), I always need to manually change the config ?

What would be the alternative? :slight_smile: Limits exist so increased resource usage will not stop your entire system. For Kubernetes clusters there are ways to dynamically increase or decrease the number of nodes so you can turn off some servers and use less energy. You can’t do that with one machine.

I am experiencing this CPU consumption issue on Windows 11. I have increased .wslconfig to
cpu: 4
mem: 8GB
swap: 2000

It has not made a difference. I only have 24 GB of ram and 8 CPU’s, I can’t allocated my system 100% to Docker. Has anyone had luck with limits lower than the 7 CPU,s 32GB RAM configuration mentioned above in this thread?

Did it works for windows containers on Win10? I have .wslconfig like:
[wsl2]
processors=1
memory=2GB
localhostForwarding=true

But it does’t work, Vmmem is still consuming more than 50% CPU when contianer is busy

Windows containers don’t use WSL2 only Hyper-V unless the the isolation method is “process”.

I’m not sure if I understand correctly, are you saying that we can’t do anything if we are in Windows?
Only What you said before (moving to some other architecture like Kubernetes)?

What did I say exactly and when? Please, quote it like I quoted yours.

I don’t see how my last post is related to Kubernetes for example. When I wrote about Kubernetes that was because we discussed changing resource limits. What is your issue?

In my last post I meant that since Windows containers don’t use WSL, you can’t limit resources by configuring WSL. I heard about vmmem only in relation to WSL. Windows containers can use the hyperv isolation, but I don’t know if that uses vmmem. If it does, you would need to configure either hyperv or use docker’s resource limits.