Answer the question
In order to leave comments, you need to log in
Why is the speed of disk operations in a docker container so slow?
I have been working with docker for a long time, I have collected many containers that work and, in fact, there are no complaints. But I just can’t understand this: there is a dump of the sql base, for example, 10Mb. There is a Docker container with mysql inside (mysql docker container from the official image). Let's assume that the database files are physically located on the HDD disk, which are forwarded inside the container. When I upload a dump from a sql file to this docker container, it will take, for example, 5 minutes to upload.
If the database files are on the SSD, then the time is reduced by about 10 times, which is understandable, the read / write speed on the SSD is just 10 times higher than that of the HDD.
But the question worries me: if I just install mysql inside the system and upload the dump there, then the upload speed is significantly reduced. The same 10MB will be uploaded to the HDD in 20 seconds, you can not talk about SSD at all. Why is there such a big difference in the speed of deploying a dump of an sql file inside a container compared to deploying it directly? And the question is not only in the speed of deployment, that is, the write operation, reading also suffers. Because of this, a regular drupal site loads many times slower than if its database was not in a docker container.
I did not take exact measurements, but the proportions in terms of execution time are approximately the same. Of course, I understand that docker is a virtualization system, and for sure because of this there is some kind of overhead, but not that big! Nowhere on the Internet can I find information on this issue, it seems that everyone does not care about this.
Answer the question
In order to leave comments, you need to log in
The main overhead when writing to disk in a container is writing to image volumes, not directly to the host file tree. Can be avoided by specifying mount points in docker run ... -v /path/source:where/mount
Documentation
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question