What's the benefit of Object Caching for common or garden Wordpress sites?

Stones

BuSo Pro
Joined
Nov 3, 2018
Messages
142
Likes
77
Degree
0
What's the benefit of Object Caching for common or garden Wordpress sites?
 
It's kind of confusing. It helps to understand what Page Caching is first (not saying you don't). Page Caching queries the database with all the various queries and then compiles an HTML file to send to the user. What gets "cached" is that final HTML file.

With Object Caching (and it's not persistent with Wordpress's built in one, you need a caching plugin to use it fully), what's being cached are the results of each individual database query. That means it'll cache the results of pulling the thumbnails, the main content, the comments, the related posts, etc. and cache them separately. Then re-use these results to build or re-build the page cache.

Obviously there's going to be different "objects" you want to have different expiry times, like blog comments or "most recent comments" widgets, etc.

For most Wordpress sites I don't think it's necessary or really saving that much RAM or bandwidth if you're using Page Caching with a decent expiry time. For something like Reddit or an Image Board which needs to be live but can possibly fake the adding of new posts just for the current user with AJAX or something and have even minute long caches, it'd be a huge help.
 
Just to throw a wrench into the equation since WordPress uses MYSQL - a lot of the querying might already be cached. MYSQL has several built-in functionalities for caching.

For example "Innodb Buffer Pool" is a portion of the database used by INNODB tables for caching the most recent queries. The larger the pool the less re-querying of the same piece of command against the harddrive the MYSQL is stored on (the results are saved in RAM instead).

So for example: If Wordpress has some widget that queries the amount of blog posts in the category "SEO" within your site and the command comes out to "SELECT * FROM table WHERE category = 'SEO'" (bad format, but go with me on this).

The end resulting data will get cached against that executed command. So if that exact same query is done within seconds, minutes, or hours you'll get the cached piece of data. So technically that executed command does not get fully ran but instead you are sent the cached version.

You don't really have to worry about the data being off since there are so many functionalities built into MYSQL to make sure the data is the most recent in the cache.

The way you can test this yourself is by querying MYSQL and looking at the response time. Then do the EXACT same query once again, and the response time SHOULD be faster. That's because it was cached (usually using an index is required).

So when I see stuff like this "Object Caching" and I google it, I have zero clue why that would be needed.

Sounds like double and triple caching is going on, which is un-necessary. I can be way off, but it's reason for existing doesn't sound right. Researching it so far makes it sound like fluff. A database guy might have a better explanation and real-world example where someone would need this. But I can't figure out why it's needed.

I think this is one of those outlier scenarios that might be talked about but are completely un-necessary on most garden/simple WordPress installs.
 
It's kind of confusing. It helps to understand what Page Caching is first (not saying you don't).
Caching is one of those things that requires knowledge of systems on several levels and how they play off each other. There's a lot I don't know pal.

I think this is one of those outlier scenarios that might be talked about but are completely un-necessary on most garden/simple WordPress installs.
From my now limited understanding, this seems like one of those things that would have made a big difference before SSDs took over the market. I'll file it under something nice to test in the future.
 
Good question, can't speak to it technically, but my investigations discovered it's best to leave it off provided you have page caching. Can sometimes even slow sites down.
 
Back