Speeding up WordPress on Azure Web-Apps with ClearDB – Disable Output Buffering in PHP

WordPress running on Azure Web-Apps (a.k.a Azure Websites) seems to be very slow by default.

If you do some research on the web you’ll notice that most people assume, that the bad performance of the MySQL database by ClearDB is the cause for this problem.

The behaviour of WordPress on Azure Web-Apps with disconnections in the backend, lags and delays also goes exactly in this direction.

Ok, it’s a free database – so I upgraded the database to different paid plans from ClearDB (Venus, Saturn, Jupiter) – without significant success – the website was still slow and had some delays and disconnections.

After that, I tested an Azure Linux VM as MySQL-Server for my WordPress website but I had to find, that the problems were almost the same as with ClearDB.

That was the point where I got doubt that ClearDB is the cause for this issue.

So I got the suspicion, that the PHP version or configuration of my Azure Web-App could be the sticking point – and I was right:

I found out, that PHP’s Output Buffering is the cause for the slowness of WordPress on Azure Web-Apps.

As you can read on http://php.net/manual/en/outcontrol.configuration.php#ini.output-buffering – since version 4.3.5, this directive is by default always ‚Off‘  – but not on Azure Websites, it has the value ‚4096‘.

Do change this, just create a .user.ini file in your root folder with the following text and restart your website:

output_buffering = Off;

After that you will notice a remarkable speed increase of your WordPress Website.

The combination of WordPress with ClearDB on Azure Web-Apps is certainly not the cheapest solution, but on the other hand you get a reliable, clustered database which is perfectly integrated into Microsoft’s cloud ecosystem – and it can be fast 🙂

10 Gedanken zu “Speeding up WordPress on Azure Web-Apps with ClearDB – Disable Output Buffering in PHP

  1. I uploaded the .user.ini to the wwwroot folder and restarted the app but I am still seeing slowness. Slowness being around 3-5 seconds after a click. Is there a way to see if it is actually disabled?

  2. Thorsten, you’re a life-saver! 🙂
    It was so strange and disappointing to experience this kind of performance issues. And your fix really works, I confirm it!

  3. From php.net:

    output_buffering boolean/integer
    You can enable output buffering for all files by setting this directive to ‚On‘. If you wish to limit the size of the buffer to a certain size – you can use a maximum number of bytes instead of ‚On‘, as a value for this directive (e.g., output_buffering=4096). As of PHP 4.3.5, this directive is always Off in PHP-CLI.


    PHP-CLI refers to the command-line interpreter, not PHP as a whole. Output buffering is routinely used on websites. If the reasoning is based on the description I pasted above, then I feel this is not a proper solution. Do you have any other reasoning to believe this improves the performance? I actually saw my web app load time increase and also become inconsistent w/ OB off.

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:


Du kommentierst mit deinem WordPress.com-Konto. Abmelden /  Ändern )


Du kommentierst mit deinem Facebook-Konto. Abmelden /  Ändern )

Verbinde mit %s