Add a CacheTagsAggregator

Created on 7 May 2023, over 1 year ago
Updated 12 July 2023, over 1 year ago

Problem/Motivation

Since we have cache tags, there is aconstant debate about how fine-grained they should be. Both has up- and down-sides.
Fine-grained cache tags allow fine-grained invalidation, but every cache tags adds a probabilistic fraction of one query as cost in the CacheTagsChecksumInvalidator service.

Proposed resolution

Add a CacheTagsAggregator service that aggregates a set of fine grained cache tags to lower granularity.
So get the best of both worlds: Have fine-grained cache tags in the internal API, while only a subset of those cache tags acutally hit the database. Plugability allows site specific optimization of cache tag aggregation strategy.

Remaining tasks

Implement, bikeshed, commit.

User interface changes

None.

API changes

Pure API addition.

Data model changes

None.

📌 Task
Status

Needs work

Version

11.0 🔥

Component
Cache 

Last updated 26 minutes ago

Created by

🇩🇪Germany geek-merlin Freiburg, Germany

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue created by @geek-merlin
  • 🇩🇪Germany geek-merlin Freiburg, Germany
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    Custom Commands Failed
  • @geek-merlin opened merge request.
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    Custom Commands Failed
  • Status changed to Needs review over 1 year ago
  • 🇩🇪Germany geek-merlin Freiburg, Germany

    Some POC code to discuss the direction this goes.

  • 🇩🇪Germany geek-merlin Freiburg, Germany
  • Status changed to Needs work over 1 year ago
  • 🇫🇷France andypost

    needs to fix CS

  • 🇨🇭Switzerland berdir Switzerland

    I don't really understand the goal of this. Some real use cases of when you'd want to use this could help,

    The example is technically valid, but it's not something you ever want to do. Ending up with too many node:list cache tags on your site is one of the main performance issues.

    Invalidation and checking also doesn't follow the same rules. Going with the example, When invalidating, we typically invalidate node:ID, node:list, node:list_article and possibly more. And we must invalidate all of them. When checking for invalidation, I could imagine a case where we say if an item has node:list and node:ID then we can ignore node:ID, but with the bundle cache tags, that gets complicated/expensive again.

    Maybe a scenario where you have 10 global config cache tags that all add some stuff to global attachments (like google analytics and others), those you could aggregate to a single one, but that will be very site specific and you'd need to hardcode that, because any sort of configuration for that will most likely be more expensive to check than an extra query or even just a more entries in an IN condition.

Production build 0.71.5 2024