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
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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:

Regards, Bobby