I have a WordPress site hosted in a Basic
(small) Azure Web App with ClearDb (Titan). I also have another Web App hosted in this Basic
service plan using Azure SQL DB. I had some latency issues with that, but ultimately using persistent connections they got solved (Azure web app slow server response time).
Given that the other app works great and the WordPress site also works fine once the page gets loaded I think the issue might be with the database connection. I tried hosting MySql
in a docker image on Azure VM, but the performance did not improve.
Note that when the site is cold the page loads in around 20 seconds. I would be happy if this could be driven down to somewhere around 1-2 seconds.
I tried setting output_buffering = Off;
, but no improvement at all. I also have AlwaysOn enabled.
Any suggestions how could I improve the latency?
Try to enable Always On in the Settings. 20 seconds is a very serious number, but Always On should eliminate the issue with the cold start.
UPD: Next step – enable Application Insights (performance monitoring in the settings) to see what is going on with your performance. It is really difficult to say what can be a problem – you can check if your DB and your website are in the same region (however, i did not experience such numbers because of that).
It is due to PHP’s output buffering, which is not configured on Azure WebApp.
To resolve this you can add the following code in the web.config file and restart your WebApp.
Please check this reference for improving WordPress Performance on Azure Web Apps: https://blogs.msdn.microsoft.com/azureossds/2016/05/15/improving-wordpress-performance-on-azure-web-apps/
What helped me was putting both the webapp and the db (azure mysql) into the same region. Before I did that – everything was extremely slow but once I recreated the app with both resources in the same region the app became very snappy.
The first time I created the app, it’s resource group was in the Central US, but apparently the azure mysql is not available there at this stage so I had to put the db somewhere else which caused the slowness.
I also turned on the “always on” option.