We are currently running a WordPress blog in a Windows environment, due to other websites that we run on the same server. And for a long period of time things were going fine. But in the last few days the homepage in particular has become very slow.
I can’t blame the server as the other sites run well, the server stats are no where near maxing out, but it just seems that every so often the homepage seems to take a very long time to load.
The homepage itself is real busy, and we put code at the bottom of the site to tell us the query count and time taken. Now we regular see the home page taking only a couple of seconds to run all the queries, but more and more often now it takes upwards of 20-30 and I have even seen 40 seconds time to run the queries to build the homepage.
Could this be a MySQL issue, a PHP issue, a WordPress issue? I know it’s not a plugin issue as I copied the database, had a fresh install of WordPress and found similar issues with speed.
Any help would be much appreciated, even if its a pointer in the right direction.
Throw more Hardware at it. Its probably more cost efficient then the other solutions such as; moving to a new platform or hacking the core for you specific needs.
Try timing the individual queries to see which one is causing the long loading time.
You could also to run an EXPLAIN of all the queries fired and see if you can find any weird output there.
I don’t have any good advice with WordPress, I just prefer not to use it. I haven’t looked into why it’s slow for me, it’s just slow in general for me – the backend and frontend. I’ve found every other CMS faster. It’s slow on client sites I’ve used as well, and by slow I mean it’s not convenient compared to other sites.
Also, Blogs with all those BSA Advertisements on them are insanely slow for me, I rarely go to them.
Enable slow_query logging in mysql for a couple of minutes/hours (if you suspect that the problem is on DB side). It will probably slow things down even more, but at least you will find queries that are to blame. Then run them each with EXPLAIN statement in front. Sudden drop of performance could be because someone dropped some indexes, wrote some unefficient code or even because some table that gets querried often has considerably grown.
Or maybe, you are in luck and you get 1000x more customers (;
Just to let you know (in case you were having sleepless nights…). No matter what I did with MySQL everything just seemed slow. I knew it wasn’t the server as other sites were working real fast.
I had to copy the website down locally, turned off all plugins and re-enabled them 1 by 1. It turned out the 1 plugin that was active but not getting used, slowed the site down. It caused an extra 30 (yes 30) queries per page, even if there was nothing attached to it e.g. code or widget. As soon as I deactivated that, the site ran fine, actually a lot better than I remember
We now have the 100 more customers as the speed increase meant I could enable my custom paywall in WordPress (I had to write my own as there were none out there fitting my client’s requirements :S)
Thanks again for your time and helping me think things through.
Yes it was crazy. When I saw the queries drop from 60 to 30 I almost screamed. I won’t name the plugin as to be fair to them they admitted it was not meant for very large blogs.
But it also shows up how inefficient WordPress is if a simple blog post causes 30 queries. A simple loop in WordPress asking for 4 posts causes 10 queries…things that should have been fixed in the last update. I heart .net and custom/bespoke cms engines though lol so slightly biased.