Pio
Pio

Reputation: 4062

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.

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?

Upvotes: 9

Views: 9027

Answers (4)

tkit
tkit

Reputation: 8642

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

Upvotes: 1

Ashutosh Dwivedi
Ashutosh Dwivedi

Reputation: 41

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>

Upvotes: 4

Edison Garcia
Edison Garcia

Reputation: 46

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/

Upvotes: 2

Alex Belotserkovskiy
Alex Belotserkovskiy

Reputation: 4062

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

Upvotes: 4

Related Questions