What do you mean with “combine these”? Both the Ajaxify Widget feature and WPP’s / Recently’s caching feature should work together without problems, but I’m not sure I understood your question correctly 😛
Before when I didn’t ajaxify an only used the Cache option, I could monitor my site using top on Linux. MySQL and Apache where almost never active.
Since I switched to ajaxify I can see MySQL being used on every visit which will slow down load times.
So to me it seems caching and ajaxify are not working together. If I use ajaxify it will use MySQL no matter what even if I have set caching to 1 day.
I’ll try to clear your doubts a bit.
Before when I didn’t ajaxify an only used the Cache option, I could monitor my site using top on Linux. MySQL and Apache where almost never active.
Of course, that’s to be expected. What Varnish does is serve static HTML files, so the amount of requests to PHP/MySQL are greatly reduced. That’s the whole point of using a caching plugin 😛
Now, what’s the problem with caching plugins? They also cache stuff that shouldn’t be cached: dynamic contents -such as a popular posts list, o a recent posts list- become static as well and won’t be updated until Varnish recreates its cache again.
This is where AJAX comes in handy. It helps dynamic sections of your site stay dynamic. And to do that, they make requests to your server to retrieve fresh data. It’s a tradeoff you can’t avoid. It’s either serve static pages with static contents that won’t be updated until Varnish’s cache expires, or serve static pages with dynamic sections that makes requests to your server to stay dynamic.
OK good we understand each other so far.
My question then becomes, why can I enable caching for Popular Posts AND ajaxify if ajaxify always hits MySQL then enabling caching for a day with Popular Posts seems pointless. Do you see what I mean?
My hope was that Popular posts could cache the results for a day while using ajax thereby bypassing MySQL for at least 24 hours and then fetch the fresh data every 24 hours using ajax. This is how I thought they could be combined.
If I use ajaxify it will use MySQL no matter what even if I have set caching to 1 day.
Ah, about this. The same happens even if the Ajaxify widget feature is disabled. You just don’t notice it because your site also uses a caching plugin. If you disable Varnish, WPP / Recently will still send a request to PHP/MySQL. The difference is that the amount of queries required to build the content is minimal. Read here for more details.
Thanks for the explanation, does using redis object cache have any influence on ajaxified widgets?
To be honest, I don’t know for sure.
What I know about Redis is that it’s similar to Memcache, and that both are used to store small data chunks (strings, objects) in server’s memory. A RAM-based cache, so to speak.
I imagine that it will affect any widgets the same way as Varnish does: dynamic content will be made static until the cache expires. Ajaxified widgets / scripts, on the other hand, should work just fine unless Redis also caches database queries / objects. Under such situations, they won’t display new content until Redis refreshes its cache.