Here is the deal with the WordPress cache plugins: even if you install such plugin, there is a fair amount of users who load your sites without speed benefits of cache. No matter if you use Hyper Cache, WP Super Cache, WP Rocket or W3 Total Cache.
WP cache plugins simply skip the cache altogether if the visitor left a comment on the website with his browser by checking for the comment cookie. That’s quite ineffective if you have 10K posts on your blog and the user only left a comment on a single article. Now imagine that your blog has a lot of discussion where dozens of users actively participate – you will see your server load going up.
WP cache plugins typically allow you to send cached data to these comment authors, but that means they don’t get the “Your comment is awaiting moderation” message, which is unacceptable.
Our work on this started when we discovered that singe post view on one of our busiest websites takes 1500 – 2000 ms on average and that the cause is not high number of SQL queries, but slow PHP execution (even though we do use PHP op cache). We analyzed what takes so much time and it was the wp_list_comments() function. This site gets tens of thousands page views every day and there is an average of 120 comments per article. Some articles have thousands of comments and we don’t like to page them. We don’t like paging at all.
That’s why we added a comment caching solution into FV Thoughtful Comments – our comment front end moderation tool. It stores the comments HTML in a file and serves to that to all visitors who are not logged in and don’t have a pending comment under the article.
Simply enable Settings -> FV Thoughtful Comments -> Comment cache. Our solution works with both paged and unpaged comments and support WPTouch Pro for the mobile site. It also works great with any existing WP cache plugin.
Here’s where the Comment cache can be enabled
Does it really improve site speed?
We made a lot of claims, so let’s support it with some data. Here’s the graph of /single transaction time of New Relic for our website:
New Relic /single transaction – no comments cache
Here’s the same graph after FV Thoughtful Comments Comment cache was enabled:
New Relic /single transaction – with FV Thoughtful Comments comments cache
The difference speaks for itself:
- before: 1,690 ms
- after: 1,060 ms
Here’s a table which tells you what is the average page load time (H ) depending on number of comments and comments cache:
Page load time [ms] | ||
---|---|---|
Number of comments | Default WordPress | FV Thoughtful Comments |
29 | 401.062 | 309.062 |
101 | 630.988 | 318.401 |
1,007 | 3080.305 | 371.369 |
4,997 | 12459.64 | 649.616 |
The above tests were performed on localhost with 10 repetitions for each test.
More information
- You can install our plugin via WordPress
- More resources available on our site
- Support available on our FV Thoughtful Comments forums
Martin Viceník
Martin graduated as an engineer in Computer Science from Slovak Technical University in Bratislava. He grew up in Liptovský Mikuláš in northern Slovakia next to the beautiful Tatra mountains. He is the developer behind our FV Player.
Leave a Reply