Decrease WordPress page load time by reducing number of comments per page.


Recently I started receiving notifications in the google webmaster tools dashboard regarding slow loading time of some of the pages on my blog. The blog was running on WordPress on a Ubuntu with Apache as the server. On my end, most pages were loading fine with a average loading time of 2-3 seconds.

In order to increase the performance, I switched the web server from Apache to Nginx. It did bring some improvement in page loading time, but a few weeks down the lane, the issue still persisted, as I was still receiving notifications regarding slow loading time for some of the pages on my blog.

I even tried optimising the MySQL database to bring some improvement, but it did not bring much difference. So I started digging deeper to find the root cause of the issue which was causing increased page load times. As i checked all the urls from the webmaster tools, I came across an popular blog post which had more than 100 comments. This particular page had an loading time of 8 seconds.

Soon I realised that it were the comments that’s were causing increase in loading time for most pages. The server was fine, so was MySQL. I checked out various blogs on possible solutions for optimising the comments, but the only option was to increase the server resource, which was not exactly what i was looking for since, the issue was related to a few pages with high number of comments.

Ultimately I came across a solution that involved decreasing the number of comments displayed per page in order to reduce the load the server and serve the page faster with shorter page loading time. The answer to my problem was present within WordPress itself.

Under the discussions options in WordPress‘s settings, there is an option to limit the number of comments to be displayed per page. By default all the comments for a page were being loaded, adding to that all the nested comments were also being loaded. So probably more than 100 comments were being loading in total.

I decreased the total comments per page to 20 and reloaded the affected page. Behold! the page loaded within 2 seconds!. Here is the speed test screenshot showing the before and after results.

I was beating around the bush for the whole time, having no clue of such an option. Now the performance of my blog has improved with all the pages loading within 2 to 3 seconds on an average.

About the author


Add Comment

By lovejeet


Get in touch

Quickly communicate covalent niche markets for maintainable sources. Collaboratively harness resource sucking experiences whereas cost effective meta-services.