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.
Conclusion:
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 🙂
So you disabled PHP Output Buffering on your Linux VM, how does that help to speed up WordPRess on Azure Web-App?
I disabled it on my Azure Web App, not on a Linux VM
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?
Did you restart your WebApp after the change?
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!
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.
Hallo or hi,
Is there a way to check if the change took place ,other than winging it by eye?
Hi,
you can check the actual value of ‚output_buffering‘ with phpinfo()
Thorsten
Should the value be „Off“? After applying your fix, my webapp showing „no-value“ for ooutput-buffering in php info
Hi Nikita, it is a bug in the phpinfo() function – but „no value“ means, it is Off:
https://bugs.php.net/bug.php?id=54051
Thorsten