You will noticed that my Blog here will be hosted on Azure. But you notice too, that this Blog is not very fast and has sime times very silly response times. My Blog is hosted in a Webapplication server, this is an PaaS that hosting the WordPress. Next I use a MySql Database, the cheapest one. You will ask “Why is he doing that?” the answer: costs. At the moment I only pay around 7 Euro per month for all of it. This is cheaper as an hosted server or s.th., because I use this blog only for replacing my memories and a positive effect for you :).
So I don’t want scale up, I want to figure out what the problem may be. After a bit googleing around I figured out the the small Database Server could a perfomance issue. But to prevent this I must scale up to a larger database tier. This is not what I want for now. So next I girued you that my Webapplication use not the newer Version of PHP, so I switched to PHP 7.1. This did a small change. But not a significant change. How did I see this?
With Azure Webapps you get a nice tool to get this info from your requests. It’s calles Application Insights. This tool show me how long wich request take. After I changed the PHP the loading time was reduced. But not good enough. What now? After a bit more googeling around, I figured out that every WordPress will be configured that it will not use persisten connections. So the next try is to activate this feature. To do this I install a Plugin that will enable the persistent database connection (pdb) for databases. The problem, when you disable pdb, it throttle your connections and it seem to get slow. After installing and activating this, I seem that the timing was now very well.
I figured out to, that you can set the output buffer to off for PHP in your webapp. To do this, you must create a “.user.ini” (yes with a dot) in your webapplication root folder. This can be done with kudu. In this file you only msut write the following:
output_buffering = Off;
The problem for now is, that I have slow response times, but the reason now ist, that I use the smales pricing tier (free) for my mysql server.
So what is the solution?
Let’s wrap up together, what would be done?
- Switchting to the newest PHP Version
- Enabling persistent database connection
- Setting the output buffering to off
The last option now is to scale up to the next pricing tier to improve the performance, but for me this is a nice solution.