wpsharks / comet-cache

An advanced WordPress® caching plugin inspired by simplicity.
https://cometcache.com
GNU General Public License v3.0
76 stars 17 forks source link

Performance Improvement via Server Side Cron #887

Open sous-studio opened 7 years ago

sous-studio commented 7 years ago

Hey folks! :) Long time not see, huh?

As I am a performance geek, I was testing my server with and without Comet Cache Pro (thanks again ;-)). Anyway, I came to a conclusion that when CC Pro is disabled, the page actually loads faster than when it's "just-enabled" (eg. cache is NOT created yet). Now my proposition is to detect whether DISABLE_WP_CRON is set to true (as in server side cron enabled), and if it is so, and IF cache is not yet created, serve page as-is, without burdening the output with actual generation of cached (and maybe compressed) page. Meanwhile, feeding an event to cron, telling it to schedule caching of said page.

Example: 1) Bob requests http://www.example.com/ (index.php) 2) CC Pro cannot find cache for it, but finds DISABLE_WP_CRON setting. 3) Instead of generating cache (+compression), CC Pro serves the page uncached, meanwhile passing the URL to a specially crafted (wp_schedule_event) event. 4) This event's job is to receive URLs and generate cache for them.

Since the generation occurs in cron, on server side, without any user interaction, user always gets the page with maximum speed.

Now to me (I didn't studied the WP Core), the only question here is how to store these URLs. Whether using transients API, writing to DB directly or elseway.

Anyway, I'll guess I'll try implementing it on one of my installations, just as proof of concept. I'll let you know the results.

Thanks!

raamdev commented 7 years ago

@sous-studio Thanks for the feedback—I'm glad to hear you're still enjoying Comet Cache. :-)

The problem you describe is what we developed the Auto-Cache Engine for:

2017-04-24_19-22-21

I understand that what you're describing is a little different, i.e., to prevent anyone from ever experiencing that First-Come Slow-Load Issue, you never allow a visitor request to generate the cache. It's an interesting idea. :-)

We have several Auto-Cache Engine feature requests open, but the user-defined list of URLs feature would allow for the development of something like what you're describing.

Please let us know how your proof-of-concept goes—we'd love to hear more. :-)