Azure MySQL Database Flexible Server is Slow Out of the Box??
I was notified by my database provider recently (ClearDB) that I would need to host my database somewhere else. I'd been using them for about 10 years and they were originally a partner with Microsoft, which is how I got hooked up with them in the first place. They didn't give any explanation as to why they were mysteriously going away. Regardless, they had a hard deadline of November 30 so I had to do something.
To me, the obvious choice was to migrate to Azure MySQL Flexible Server, since all of my web apps are hosted on Azure. It was initially challenging, because I wanted to create the server in East US and it continuously failed to deploy there. Upon someone's suggestion, I tried Central US and it deployed fine. So now, I have my web apps in East US and the database server in Central US.
My previous MySQL database was version 5.6, so it's probably a good thing that I upgraded to MySQL 8.0 at the same time. Sure, a handful of old queries had some syntax errors, but that was an easy fix. Everything is up and running now. But the queries are SO SLOW. I wouldn't think that I'd need to do anything to tune the database out of the box. And I did a SQL dump from my old database to create the new one, so all the indexes are still there. But the thing is just a lot slower:
- My PHP pages which rely on the database load more slowly than they used to
- My PHP batch jobs which call recursive INSERT or UPDATE statements went from sub 10 seconds in duration to over 100 seconds.
I want to be clear...I don't think I need to tune my queries to solve this problem. It isn't a micro problem, it is a macro problem. I read somewhere that someone else was having this issue and he solved it by turning off binary logging. He saw an immediate return to his MySQL 5.6 speed. Binary logging is ON by default in MySQL 8.0. And in the Azure console, it is a locked environment variable, so I cannot turn it off myself to see if that solves the issue.
Can anyone provide advice on how I can try to turn off binary logging? I'd like to try that before attempting things like revamping my batch jobs to do bulk inserts. I know there are a lot smarter people out there than me, but I really don't think the answer to this problem needs to be over-engineered. I think it is something very simple that just needs to be tweaked and I will be as good as new. Thank you for your help!