Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker container IO performance

I am trying to investigate the IO performance overhead of docker so I created a mysql docker container on a specific machine and I ran the sysbench mysql benchmark to measure IO performance. Sysbench basically executes some read/write transactions over a period of time and then outputs the number of completed transactions and the transactions/second rate.

When I run the benchmark on the native machine, I get a 779.5 transactions per second. When I run the benchmark in a mysql container, I get 336 transactions/second. Almost half the number of transactions per second. Is this a normal performance overhead of docker? This is a huge disadvantage for running the database in a container in production systems, especially for IO/database intensive applications

like image 659
Keeto Avatar asked Aug 25 '14 17:08

Keeto


People also ask

Why is Docker container so slow?

A slow CPU or insufficient RAM can become a bottleneck, slowing down Docker's performance. When you experience slow Docker performance, check your CPU, memory usage, and available disk space. Consider upgrading your system if a component does not perform as expected.

How is Docker container performance measured?

You can use the docker stats command to live stream a container's runtime metrics. The command supports CPU, memory usage, memory limit, and network IO metrics. The docker stats reference page has more details about the docker stats command.

Does Docker degrade performance?

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.


1 Answers

Are you using a Docker volume for the database files? By default, file writes inside the container will be made to the copy-on-write filesystem, which will be inefficient for database files. Using a volume will mean you can write directly to the host filesystem.

like image 183
Arthur Barr Avatar answered Oct 27 '22 13:10

Arthur Barr