Question

MySql is much slower on docker than setting it up on bare VPS

What could I do to solve this problem? My backend call to sql just to do a pagination of 1000 data delay up to 5.6 second. This is insane for production.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi there @oudamsith,

I’ve seen similar problems in the past, one solution worked quite well for me as described here:

  • First disable writing barrier for the ext4 fs:
  1. sudo nano /etc/fstab
  • Your configuration would look see something like this:
UUID=b87de212-52ca-4600-9e30-6e80e24df1ed / ext4 errors=remount-ro 0 1
  • You need to add barrier=0:
UUID=b87de212-52ca-4600-9e30-6e80e24df1ed / ext4 errors=remount-ro,barrier=0 0 1
  • Finally you have to reboot your server.

Another thing that you could do is use the MySQLtunner script to test your SQL instance and adjust your settings:

https://www.digitalocean.com/community/questions/how-to-tweak-mysql-mariadb-configuration-for-increased-performance-and-stability

Regards, Bobby