Optimize placeholder retrieval from cache

Created on 13 March 2025, 5 days ago

Problem/Motivation

In 📌 Create placeholders for more things Active and on Slack we (@berdir, @catch and myself) did some digging and came to the conclusion that the single cache lookups of placeholders no longer makes sense in Renderer. We now have a ::getMultiple() method on the render cache and we know we're going to look all of the placeholders up in one go in CachedStrategy.

So why don't we skip the retrieving of placeholders in Renderer altogether and allow CachedStrategy to do that? The ones we didn't find will still end up getting rendered live, but at least this way we went to the cache once instead of for every placeholder individually.

Steps to reproduce

N/A, check metrics after the change

Proposed resolution

Skip single placeholder cache GETs and offload to getMultiple()

Remaining tasks

Investigate and discuss potential fall-out from moving this bit around

User interface changes

N/A

Introduced terminology

For discussion in this issue:

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

Feature request
Status

Active

Version

11.0 🔥

Component

cache system

Created by

🇧🇪Belgium kristiaanvandeneynde Antwerp, Belgium

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

Merge Requests

Comments & Activities

  • Issue created by @kristiaanvandeneynde
  • 🇨🇭Switzerland berdir Switzerland
  • 🇧🇪Belgium kristiaanvandeneynde Antwerp, Belgium
  • Pipeline finished with Canceled
    5 days ago
    Total: 71s
    #447471
  • 🇧🇪Belgium kristiaanvandeneynde Antwerp, Belgium

    Will fail tests, but that's the idea. If it's only performance tests that fail, we have no collateral damage.

  • Pipeline finished with Failed
    5 days ago
    Total: 300s
    #447474
  • Pipeline finished with Failed
    5 days ago
    Total: 515s
    #447491
  • 🇬🇧United Kingdom catch

    One performance test to update, but otherwise looks like it should be green. Not entirely sure why there are more cache gets in this case.

  • 🇨🇭Switzerland berdir Switzerland

    Asserted the render bin operations, but not sure I fully understand this.

    --- Expected
    +++ Actual
    @@ @@
         16 => 'entity_view:block:stark_site_...-admin'
         17 => 'entity_view:block:stark_syndi...-admin'
         18 => 'navigation:navigation:[langua...-admin'
    -    19 => 'navigation_user_block:[languages:language_interface]=en:[theme]=stark:[user.permissions]=is-admin, shortcut_set_navigation_links:[languages:language_interface]=en:[theme]=stark:[user]=2'
    +    19 => 'navigation_user_block:[languages:language_interface]=en:[theme]=stark:[user.permissions]=is-admin'
         20 => 'navigation_user_block:[langua...ser]=2'
    -    21 => 'view:frontpage:display:page_1:[languages:language_interface]=en:[theme]=stark:[url.query_args]=:[url.site]=http://core.ddev.site:[user.node_grants:view]=all:[user.permissions]=is-admin'
    -    22 => 'view:frontpage:display:page_1:[languages:language_interface]=en:[theme]=stark:[user.permissions]=is-admin'
    +    21 => 'shortcut_set_navigation_links:[languages:language_interface]=en:[theme]=stark:[user]=2'
    +    22 => 'view:frontpage:display:page_1:[languages:language_interface]=en:[theme]=stark:[url.query_args]=:[url.site]=http://core.ddev.site:[user.node_grants:view]=all:[user.permissions]=is-admin'
    +    23 => 'view:frontpage:display:page_1...-admin'
     )
    

    something about the shortcut placeholder in the navigation, I think it's being fetched separately now, but I'm not sure why the CachedStrategy isn't picking it up with the other one? maybe due to the user cache context somehow?

Production build 0.71.5 2024