Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 560
Pio Avatar asked Apr 20 '16 21:04

Pio


People also ask

Is Azure good for WordPress?

Hosting on Azure offers you the reliability and scalability of the cloud for your WordPress website while being cost-effective and user-friendly.

Why is my WordPress site running so slow?

The most common reasons your Wordpress site is slow to load are: Slow or poor quality hosting that doesn't match your level or traffic or site. No caching or caching plugins in place. You have a high traffic site but no content delivery network (CDN) to reduce the load on the hosting.

How do I improve my Azure Web app performance?

Scale your cache to a different size or SKU to improve cache and application performance. Cache instances perform best when they're not running under high memory pressure, high server load, or high network bandwidth.

Why does WordPress take so long to load on Azure cloud?

The ridiculously long loading time you experience on WordPress on Microsoft Azure cloud is due to free database that comes with the application. Obviously, Microsoft wants you to pay more if you want to host a production site on Azure Web Apps. It’s a great solution if you have the budget and don’t mind spending few extra bucks.

Why is my Wordpress site so slow?

WordPress workloads tend to be read-heavy, which occasionally causes issues with performance. With research, and by using optimization techniques and performance testing, we’ve been able to identify some parameters that you can change to improve performance for your WordPress workloads.

Why is my website running slow on azure WebApp?

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). Show activity on this post. It is due to PHP's output buffering, which is not configured on Azure WebApp.

What to do if you have to run WordPress on azure?

What To Do If You Have to Run WordPress On Azure? If you use a caching plugin, then the front end of the site loads pretty well, but as soon as you do any work on the admin end of things, the performance goes back down, and running updates takes a very long time.


4 Answers

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

like image 62
Alex Belotserkovskiy Avatar answered Oct 17 '22 20:10

Alex Belotserkovskiy


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>
like image 29
Ashutosh Dwivedi Avatar answered Oct 17 '22 19:10

Ashutosh Dwivedi


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/

like image 29
mredison Avatar answered Oct 17 '22 19:10

mredison


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

like image 1
tkit Avatar answered Oct 17 '22 18:10

tkit