Docker Desktop on Windows performance

Hello Wapplers,

Recently I’ve finished to develop a small internal tool (NodeJS + Docker + PostgreSQL) for our company and figured out interesting fact regarding Docker Desktop performance comparing to pure-native Docker on Linux.

I’ve executed same API on my development computer (Windows 10 x64 i7-10700K, 32GB RAM) and on virtual Linux (CentOS 7, 2GB RAM, 2vCPU) to proceed with 1300 entries - several repeats, variables, etc.

On Windows - 132 seconds
On Linux - 38 seconds.

On my development machines I have WSL based and Use Docker compose V2 enabled.

I’ve spoke with our Linux engineers and they told that even with WSL 2 developed by Microsoft - Linux on Windows is slow.

@Teodor @George what’s your thoughts about it? Is there any options to tune up Docker performance on Windows?

The docker images that are being used are Linux based images. On Linux they run in an isolated environment and do not need any virtualization.

On Windows without WSL 2 they run in a Virtual Machine with Linux running on it. With WSL 2 they run in the Linux without the overhead of a Virtual Machine directly under Windows.

In most cases the WSL 2 performs better then without WSL on Windows. It should be close to running directly on Linux. There is however a factor that slows down performance a lot and that is the File System. When you access files from outside your Docker Image that are located on a Windows partition. WSL 2 is slow with accessing files on Windows drives, to solve this issue you can copy the files first to the File System of your Linux Subsystem where it can access the files faster.

In most cases you use Docker on Windows only using development and then performance is not such an issue.

3 Likes

@patrick Thank you very much for a detailed answer.

As WSL effectively runs as a Hyper-V session anyway perhaps it may be faster to use pure Hyper-V docker configuration directly. Never tried any timings to be honest

Some good readings from Microsoft

What is Windows Subsystem for Linux | Microsoft Learn

Comparing WSL Versions | Microsoft Learn

Use Hyper-V instead of WSL (uncheck the first checkbox), @karh said it loads much faster (edit: for filesystem stuff)

P.S: There’s also Rancher Desktop if you want to try as Docker alternative (only do this if you’re using Windows or Linux, not MacOS as there’s a known problem with filesystem stuff impacting NodeJS restarts upon file change)

I don’t think that you will notice any performance difference between you local development Docker Desktop and your production Linux, during your development.

Because usually your development PC is fast and also you are not doing any too intensive tasks in local development.

So it is more the ease of usage and emulating the exact same Linux services and databases.

Indeed as @Apple mentioned Rancher Desktop is also a good alternative.

After a recommendation from George some time ago on community, I ditched Docker Desktop for Rancher Desktop. There is a visible improved system performance in comparison. Battery life has improved a bit as well.
I don’t know/do much so its good enough for me. But Docker Desktop does seem to have some extra options.
Another drawback with Rancher is that Wappler does not auto-start it, and neither does it understand always that its running. But it works.

Update:
I’ve installed Hyper-V role and Switched off “Use the WSL2 based engine”.
Execution time lowered from 100 seconds to 85 second in rough estimate comparing to 30 seconds on Linux Docker.
Huge drawback: after I switched to WSL2 and re-deployed my dev environment - my PostgreSQL got completely lost. Most likely because Wappler/Docker creates completely new container. After switching back to WSL2 - PostgreSQL data was back.

Yes when switching WSL engines or going to Rancher desktop any data volumes will be created again in the new engine. This is because each docker engine has its own way of organizing its docker data. So it isn’t Wappler specific.

Happily in Wappler you can just reapply the database changes and have your database schema up to date. But any previous data will be lost indeed if you didn’t have made a backup.

If you had made backup in Wappler from the publishing panel next to the docker deploy icons, it will be auto restored on new deploy.

I have full DB schema SQL Query with me! :slight_smile:

Is this possible in a Wappler compatible way? In other words, how can we do this with our Wappler projects?