Question about garbage collection
I’m afraid I’m not sure how WP Super Cache actually does its work, but for me it often seems to leave my site not much faster than without the cache. I think this may have to do with garbage collection. I’m hoping someone who knows more can explain.
My site is quite complex, but not very busy. In other words, it has some elements that get updated from offsite (twitter feeds, and the like), but relatively few visitors.
If I just leave GC on, the pages often feel slow. I think this is because they are being thrown out before they get reused, so often we don’t get cached files.
If I use preloading, then things get fairly fast, but the feeds get out of date.
I’d love an option that would let me preload, but also do GC. In other words, if a file is stale, then replace it only _after_ serving the stale file to the user from the cache.
In fact, even just an option to allow GC to work this way without preloading would be fine. I’d like to set a cache timeout that is _never_ scheduled. Instead of a traditional schedule, I want the check for staleness only ever done _after_ the file has been served from the cache. Then, if found to be stale, the file is replaced so the next user gets the newer version.
Yes, I know this means that some users would get very old versions. But if that bothers them, they could reload to see the newer info. Let’s imagine page A being visited by two users. If I have the cache timeout set to 600 seconds, then page A becomes stale after 10 minutes. The first user comes along and forces page A into the cache at 2pm. The second user comes along at 2:40pm and gets the 2pm version of page A, but WP Super Cache would notice that page A is more than 10 minutes old and generate a new version for the cache. The third users comes at 2:45 and gets the 2:40 version. The fourth user comes at 5pm and gets the 2:40 version, but also forces a new 5pm version to be cached. And so on.
Can anyone tell me if this kind of arrangement is possible?
Right now it feels like GC throws away files and then users have to wait for new cache files to be generated in real time. What I’m describing is a way for not-so-sensitive dynamic elements to be recreated after a certain degree of staleness, but never to make the user wait for that regeneration. I think of this as lazy GC. Note that if the traffic picks up, the difference between this method and the pro-active GC is negligible. And if a site is low-traffic, then this lazy GC would at least make it feel fast, if a bit out of date.
- The topic ‘Question about garbage collection’ is closed to new replies.