WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
[resolved] Random cache purge creates unnecessary load (8 posts)

  1. titanas
    Member
    Posted 3 years ago #

    Hey,

    It looks like that W3 Total Cache cleans the op code cache in random times. Using apc.php i noticed that User Cache Information keeps growing to ~30MB but usually purges around 4000 files. The trigger caused but different admin behavior susch as saving settings etc. Disabling cache for admins helped a lot but still the problem persists.

    Note that APC has 256MB or RAM and only ~30MB go to User Cache Information and W3 Total Cache. Approximately ~40MB are File Cache Information which are *never* purged randomly. For the sake of figuring out what's going on, i set very high TTL times on W3 Total Cache which are confirmed on APC stats. W3TC is configured for page, database and object cache only.

    Purging and building the cache all over again causes unnecessary load on top of the daily load. I can't figure out why W3 Total Cache behaves like this. Is it normal to have the User Cache purged when clicking on the Admin > Comments menu to see the comments? Because this is happening.

    Latest version of W3TC, WordPress, APC used

  2. titanas
    Member
    Posted 3 years ago #

    Adding admin.php wp-.*\.php index\.php to *non* caching groups helps a tiny further, possibly killing the clicking on comments kills the user cache effect... but still, updating a post purges the whole user cache :)

  3. titanas
    Member
    Posted 3 years ago #

    The User Cache is also purged when a logged in user (myself) comments on a blog post! Same thing for non logged-in users. That's a bit crazy or what? :)

  4. Frederick Townes
    Member
    Plugin Author

    Posted 3 years ago #

    First understand the implementation limitations with APC:

    • In order to purge only those user cache objects that have actually expired, a traversal of all objects must occur and respective objects must be invalidated
    • To do the above, every request must traverse all the objects and check their type, status etc
    • The above cases mean that now we have to incur an expense for managing a map of object status and therefore the execution time, load, memory usage as a consequence is increased in some cases by an order of magnitude creating diminishing returns.

    So why is the behavior as it is now?

    • When any event that requires the cache for an object to be purged is made the entire user cache is flushed. That's among the reasons why page caching to APC is not recommended in many cases.
    • APC should only be used to reduce execution time where appropriate, in general it's not the right store for every cache type.
    • If the execution time and therefore time to rebuild the cache is so great that it causes server instability then you have problems that caching is only hiding. Caching doesn't make inefficient code efficient, it reduces execution time and resource utilization only (in this discussion).

    The User Cache is also purged when a logged in user (myself) comments on a blog post! Same thing for non logged-in users.

    I'm not able to duplicate this now, but if you insist that there are duplicate-able events that purge the cache and shouldn't, please simply list them so I can debug.

  5. titanas
    Member
    Posted 3 years ago #

    Thanks for the detailed answer.. do you recommend a solution for page caching on memory?

    i will come up with the video to duplicate the cache purge

  6. Frederick Townes
    Member
    Plugin Author

    Posted 3 years ago #

    I really don't feel that for most users the issue is that critical. If you do feel it is even after maxing out various settings etc, try memcached.

  7. titanas
    Member
    Posted 3 years ago #

    The working solution i came up is: all caches on expect DB caching. The APC cache is still purged but less often. Performance is not optimal but it's adequate until further changes. Thanks again for your help.

  8. Frederick Townes
    Member
    Plugin Author

    Posted 3 years ago #

    You're welcome.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic