Docker can slow down your code and distort your benchmarks

One of the benefits of containers over virtual machines is that you get some measure of isolation without the performance overhead or distortion of virtualization.
Docker images therefore seem like a good way to get a reproducible environment for measuring CPU performance of your code.

There are, however, complications.
Sometimes, running under Docker can actually slow down your code and distort your performance measurements.

On macOS and Windows, for example, standard Linux-based Docker containers aren’t actually running directly on the OS, since the OS isn’t Linux.
And the image filesystem from the container itself is typically mounted with some sort of overlay filesystem, which can slow things down, so for anything I/O bound you want to use a bind-mounted volume.

But even on Linux, with seeminly CPU-only workloads,

 

 

 

To finish reading, please visit source site