Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
authcache_builtin_expire_v2_expire_cache() can easily attempt to clear hundreds of thousands of cid's in one hit and cache_clear_all
will blow out in memory usage
In this case I've seen $cids contain more than 300,000 rows
My patch breaks the processing up into chunks of some arbitrary number which seems to stop memory blow outs
Comment | File | Size | Author |
---|---|---|---|
#6 | 2750245-authcache-clear-memory-usage.patch | 1.44 KB | dgtlmoon |
#5 | 2750245-authcache-clear-memory-usage.patch | 1022 bytes | dgtlmoon |
#4 | 2750245-authcache-clear-memory-usage.patch | 1.13 KB | dgtlmoon |
#3 | 2750245-authcache-clear-memory-usage.patch | 1.13 KB | dgtlmoon |
#2 | 2750245-authcache-clear-memory-usage.patch | 1.13 KB | dgtlmoon |
Comments
Comment #2
dgtlmoon CreditAttribution: dgtlmoon commentedComment #3
dgtlmoon CreditAttribution: dgtlmoon commentedSlight change, re-include the
!empty($cids);
Comment #4
dgtlmoon CreditAttribution: dgtlmoon commentedwith the define() removed and a
variable_get
in place, and a lower chunk valueComment #5
dgtlmoon CreditAttribution: dgtlmoon commentedComment #6
dgtlmoon CreditAttribution: dgtlmoon commentedThis patch is even better, limits the size of the
$cids
arrayComment #7
znerol CreditAttribution: znerol commentedIs this on a multilingual site? If this is the case, would you mind testing the patch in #2507797: authcache_builtin_expire_v2_expire_cache is a killer with locale on.
Comment #8
dgtlmoon CreditAttribution: dgtlmoon commentedUnfortunately not, single language site
Comment #9
dgtlmoon CreditAttribution: dgtlmoon commentedThe issue in general is that $cids can get so huge it can eat up an extra 200Mb of RAM when saving/editing nodes etc (our
$cids
was over 310,000 entries)Comment #10
znerol CreditAttribution: znerol commentedI feel that 300'000 entries is an awful big number. How long does it take to perform that operation? Keep in mind that the purpose of the Cache Expiration module is to selectively remove items from the cache. That said, first thing I'd do on a site like this would be to double check the expiration rules in order to reduce the number of entries affected by an operation.
If it is really necessary to kill the cache of so many pages, then it might be just cheaper (and far less complex) to stick with the default behavior and remove the Cache Expiration module from the mix. Operations on the content will then simply kill the whole cache.
My technical reasons for being skeptical about this patch are the following:
Comment #11
znerol CreditAttribution: znerol commentedComment #12
znerol CreditAttribution: znerol commented