Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295161

Optimize redirect chain retrieval in VariationCache

$
0
0

Problem/Motivation

In #3437499: Use placeholdering for more blocks and on Slack we (@berdir, @catch and myself) did some digging and came to the conclusion that, when trying to get something that was invalidated from VariationCache, we follow the previously set redirect chain twice: Once for GET and once for SET.

As redirect chains are never invalidated, only overwritten during SET (self-healing), we can store the chain we checked during GET in memory to reuse during SET. This should net us an overall reduction of cache lookups. We should clear the chain from memory whenever we do a SET.

The only thing to be careful about is concurrency. If we store the redirect chain in memory during request A and request B sets something in the cache, then request A may use a stale chain to set whatever it is trying to save. In theory this is fine, because the worst thing that could happen here is that we undo a piece of self-healing from request B, making that request's recently stored item unfindable and forcing it to be recalculated.

Steps to reproduce

Check performance results after MR

Proposed resolution

Store redirect chain in memory until the next SET.

Remaining tasks

N/A

User interface changes

N/A

Introduced terminology

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A


Viewing all articles
Browse latest Browse all 295161

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>