Docker Mysql Slow

Related

Join the DigitalOcean Community

Join 1M+ other developers and:

And from my mac console as well (without docker exec -it) mysql -ufoo -pfoo -h0.0.0.0 foo The problem I see is that the second approach it takes a long time to connect. It connects successfully but there is like a delay of 15 to 20 seconds. Whereas in docker exec it connects instantaneously. MySQL is very slow. I’m running mysql:5.7 on Docker version 17.09.0-ce, build afdb6d4 with a local volume for the data directory, which is ext4. The volume driver is local and on my system the mounts show up as nsfs. Importing a gigabyte of data from an external server takes half an hour on localhost, but close to 24 hours on this container. I'm using a docker container for WordPress linked to another container for MySQL. The Performance of the MySQL container is horrible. SELECT and INSERT queries are both extremely slow as tested with MySQL workbench. WordPress often fails to establish a connection to the database. Performance used to be much better before a reboot and firmware. Threads fairness: events (avg/stddev): 1250.0000/60.86 execution time (avg/stddev): 8.8545/0.00. The results are disappointing. The MySQL server running in a docker instance performs somewhere between 1/2 and 2/3 of the native one, which is unacceptable. I started the container with the following command, so it is possible that we can avoid. Currently i am experiment with docker container. In past i have worked with Linux container. When i start Docker windows server container. It is very slow. It takes more than 3-0 to 45 sec to start the container, in Linux it is used to start in.

  • Get help and share knowledge in Q&A
  • Subscribe to topics of interest
  • Get courses & tools that help you grow as a developer or small business owner
CPU usage problem by MySQL In a WordPress site Question
Create a Droplet from a snapshot using the snapshot's name instead of its id Question

Question

Hi,
I’m trying to run a simple project with nginx, php and mysql on a droplet with 2 vCPU and 2 GB Ram using the Ubuntu-Docker-Image. The project runs on a really cheap host so far and collects about 1.5GB of data in a database so far and I’m trying to migrate this to a docker environment on Digital Ocean. Basically the main (InnoDB) tables are blogs (about 200 entries) and blog_posts (about 200000 entries).

Docker Mysql Slow

My problem is, that a simple query is awful slow! Its basically like:

So, nothing special. All used fields are indexed. On my local MacBook with the same docker-compose.yml the query takes about 400ms. On the droplet it takes more than 9 seconds!

Docker mysql slow mac

So far i tried:

  • use mysql 8
  • use mysql 5.7
  • use mysql 5.6
  • use mariadb
  • run Optimize-Table-Query
  • additional indexed the PrimaryKey fields with a regular INDEX
  • modified the fstab with barrier=0 for that volume
  • changed the provider, Digital Ocean is the third now
  • tried a larger configuration (more RAM)
  • changed the innodb-default-row-format to Compact instead of dynamic
Docker Mysql Slow

Docker Mysql Slow Query Log

Nothing made this query noticeable faster.
When monitoring the server during those queries neither the CPU nor the RAM or the disk I/O seem to reach the limit.
When profiling the query the most time is used during “Send Data”
The best configuration so far is mariadb because it caches the query, but without caching or with changing/adding more parameter it is as slow as the other configurations.

I’m running all conatiner with a single docker-compose.yml and each component as a single service using:

  • nginx (nginx:alpine)
  • php-fpm (docker/php-fpm)
  • mysql (mysql:5.7 / mysql:5.6 / mariadb)
Mysql

The MySql Data is mounted as volume

So I’m really run out of Ideas! I’m struggling with this for 2 weeks now and really hope that someone can help me to find the bottleneck.

Mysql

Related

Docker Mysql Slow Mac

Join the DigitalOcean Community

Join 1M+ other developers and:

  • Get help and share knowledge in Q&A
  • Subscribe to topics of interest
  • Get courses & tools that help you grow as a developer or small business owner
CPU usage problem by MySQL In a WordPress site Question
Create a Droplet from a snapshot using the snapshot's name instead of its id Question

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Docker Mysql Slow Motion

×