Daniel Lemire's blog

, 7 min read

Computational overhead due to Docker under macOS

9 thoughts on “Computational overhead due to Docker under macOS”

  1. me says:

    It would be great if you’d include numbers for a Linux and a Windows host, too. And also measure overheads on IO.
    At 12 seconds run time, I’d also average multiple runs to get a better estimate and avoid cold-start effects.

  2. It would be great if you’d include numbers for a Linux and a Windows host, too.

    For Linux, there is no computational overhead as far as I know. I think I mention this in the post.

    For Windows, you have WSL as an option which complicates the analysis. And then you have WSL1 and WSL2.

    And also measure overheads on IO.

    IO is likely a much more complicated story because it comes in different forms and difference usage scenarios, and also because measuring IO is just flat out harder to do reliably, but we know the the overhead is going to be significant and, in some cases, large.

    At 12 seconds run time, I’d also average multiple runs to get a better estimate and avoid cold-start effects.

    The results are consistent and accurate (within a 1% margin of error). Note that I use a desktop (iMac). If you use a laptop, you are likely to get more noise in the measures. But on my iMac, the numbers are precisely reproducible, run to run.

  3. If you want to squeeze every once of computation performance …

    Typo: s/once/ounce/

    1. Also, you might likely want to mention that you run that loop a billion times. It took me some time to count those zeros. 🙂

  4. José Duarte says:

    Docker on Windows 10 uses Hyper-V by default, though this might require Windows 10 Pro. Hyper-V is a very solid hypervisor, I would bet higher performance than VirtualBox.

    With the latest Windows 10 update, the 2004 release, Docker offers to use WSL2 as an alternative hypervisor, though I’m not sure what that means under the hood. Is it Docker on top of Linux on top of Hyper-V? I would be surprised if Microsoft built a completely different hypervisor just for WSL(2).

    I wonder how the container’s OS image impacts things. It probably doesn’t matter, but Ubuntu is enormous so I use Alpine.

  5. Prabindh says:

    Thanks for the post on MacOS. On Windows, a higher exit time from container is seen, and I filed a bug on Moby that is not yet addressed (https://github.com/moby/moby/issues/40832)

  6. Robert Pankowecki says:

    Hey, can you try to reproduce my micro-benchmark ? My team is observing 40-80% overhead, not 3%.

    1. I wrote a comment in your issue after checking it out.

  7. Example says:

    On Windows you also have the option to use the Windows Subsystem for Linux (WSL) in version 2. You can use docker either inside the Linux instance or still use the docker desktop for Windows if you need that GUI in the tray.