7
votes

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?

4
you can try to use azure.microsoft.com/en-us/blog/… to optimize your wordpress siteGary Liu
Hey Gary, I already tried most of the points here, but as my question says I have the biggest issues with cold starts - even though I have AlwaysOn enabled.Pio

4 Answers

4
votes

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).

4
votes

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.

<configuration>
      <system.webServer>
         <handlers>
            <add name="PHP-FastCGI"
                path="*.php"
                verb="GET,HEAD,POST"
                modules="FastCgiModule"
                scriptProcessor="D:\Program Files (x86)\PHP\v5.4\php-cgi.exe"
                resourceType="Either"
                requireAccess="Script" 
                responseBufferLimit="0" />
         </handlers>
      </system.webServer>
</configuration>
2
votes
1
votes

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.

enter image description here