- 🇫🇷France andypost
The issue is duplicated by 🐛 ChainedFastBackend invalidates all items when cache tags are invalidated Fixed
The current implementation of ChainedFastBackend and DatabaseCacheTagsChecksum are not efficient when dealing with changes - writes to the cache backends.
- DatabaseCacheTagsChecksum heavily relies on the database to do validate cache item checksum so ChainedFastBackend is completely avoiding the use of tags on the fastBackend.
- ChainedFastBackend is invalidating the complete fastBackend on every cache write - both for the current head and other heads.
This implementation behaviour is penalizing applications where data changes a lot. ChainedFastBackend even had to be disabled during the install process where cache writes happen all the time. We don't won't a Drupal that will only work for read-only applications.
- Create a new Cache API (CacheRawBackend) that is simpler, faster and lighter than the current one. This new API saves data as-is in the storage backend so that it can leverage native funcionalities such as counter() (apc_inc for example) and touch(). This new Cache API is not tag aware.
- Create a new ChainedFastBackend (ChainedRawFastBackend) on top of the new Cache API. The old implementation of ChainedFastBackend cannot be used on the new Cache API because this new API is not able to store cache metadata such as the created timestamp, so it needs a new invalidation strategy. As the new Cache API, the new ChainedRawFastBackend is not tag aware.
- Implement an alternative to DatabaseCacheTagsChecksum that is built on top of the new ChainedRawFastBackend.
- Improve the current ChainedFastBackend to not invalidate the fastBackend for it's own webhead. It should only invalidate the fastBackend for other heads/processes.
- Bring back the usage of tags for the fastCache backend in ChainedFastBackend. This is needed to prevent the complete invalidation of the fastBackend when something changes. It should not be a problem now that cache tags are backed by a fast in-memory storage backend.
- Bring back ChainedFastBackend during the install process. It should actually be faster than not using ChainedFastBackend at all.
Profile before doing any further work and decide if it is worth the effort
Review all the code. I've already spoted some bugs in it
Write test coverage - lots of them
None
No API changes, only new APIs and changes in implementation details.
None.
Needs work
10.1 ✨
It affects performance. It is often combined with the Needs profiling tag.
The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
The issue is duplicated by 🐛 ChainedFastBackend invalidates all items when cache tags are invalidated Fixed