• I understand that page garbage collection interval is the time that determine how frequently expired cached pages are removed. But It is not clear how it works exactly.

    This is how I think it works (probablly I’m wrong):

    1.- A page is requested, the static file is created for next request.
    2.- The cached page is valid until the expire time.
    3.- When the cached page is not valid, the name file is appended with “.old” and a new one is created.
    4.- Garbage collection removes all files containing “.old” in the name

    Is this how it works? If so, I could set a very high garbage collection interval without affecting the cache building proccess. The only drawback would be a lot of disk space wasted in “.old” files but my server is plenty of free space, so it is not important to me and I could liberate the resources needed for the garbage collection.

    Am I right or the garbage collection proccess also check if cached files are valid?

    https://www.ads-software.com/plugins/w3-total-cache/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Ramanan

    (@superpoincare)

    cybmeta,

    I guess that’s how it is supposed to work but it in practice it seems to work differently.

    What happens is that the garbage collection run checks files whether they have expired and simply changes them to old.

    You can check this by keeping low expiry for the HTML in the browser cache setting and a high garbage collection interval in the page cache setting and check files in the cache folder. Files don’t get renamed to .old till garbage collection is run.

    Also my garbage collection never removes .old files.

    Well it should be deleting them and it does for me.

    You want the interval to be low or default. Having it set to a longer time would make no sense at all.

    Thread Starter Juan

    (@cybnet)

    If garbage collection checks if the files have expired and then rename them to .old, it doesn’t work as I thought. This checking and renaming is what I thought prime cache was doing.

    If garbage collection only (emphasis in this “only”) remove .old files, it works as I thought and set a high time has a lot of sense for me. I can live with that files in the disc and this doesn’t affect the cache rebuild proccess. Space ir really a lot cheaper than CPU and memory.

    Thank you for your answers but unfortunately they don’t solve my doubts.

    I’m going to make some tests following @superpoincare’s suggestion.

    Thread Starter Juan

    (@cybnet)

    @superpoincare, you are right. Garbage collection doesn’t remove any file, just check if it is still valid, if not it renames the file to .old. Then, at next request, the cached file doesn’t exist so it is regenerated and the .old file deleted.

    Garbage collection can not be disable or set it too long because it is what make cached files invalid if they have expired. Without garbage collection a cached file would be used forever or until manually clear the cache.

    Ramanan

    (@superpoincare)

    Cybmeta,

    Exactly my observation.

    .old doesn’t get deleted because of garbage collection. When Cache priming works and sees a .old, it removes it and creates a fresh cache. Or even a user request for the link does that.

    And shouldn’t set garbage collection to high as it will serve expired files then.

    So in short, the job of garbage collection seems to be to set expired files to .old

    (There’s still a possibility that it may delete an already existing .old in addition to renaming an expired file to .old but I don’t see that happening).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Understanding garbage collection’ is closed to new replies.