WordPress slow on azure

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.

Read More

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?

Related posts

4 comments

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

  2. 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)PHPv5.4php-cgi.exe"
                    resourceType="Either"
                    requireAccess="Script" 
                    responseBufferLimit="0" />
             </handlers>
          </system.webServer>
    </configuration>
    
  3. 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

Comments are closed.