Page MenuHomePhabricator

Remove ParserCache hack added to support merging ParsoidOutputAccess and ParserOutputAccess without cold cache misses
Closed, ResolvedPublic

Description

As part of T332931, ParsoidOutputAccess and ParserOutputAccess are being merged. Since this changes both ParserCache instances as well as the options used in cache key computation, if nothing is done, this will lead to cold cache misses as ParsoidOutputAccess used a 'parsoid' ParserCache instance and did not set the 'useParsoid' parser option for tier 2 ParserOutput cache key computations.

ParserOutputAccess uses 'pcache' for legacy parser output and 'parsoid-pcache' for Parsoid parser output objects based on whether 'useParsoid' parser option is true or false. 'parsoid-pcache' is right now very sparsely populated since useParsoid is only used for testing.

The patch to address T332931 will route all Parsoid parser output requests to ParserOutputAccess's 'parsoid-pcache' instance which is sparsely populated and hence will result in a lot of cold cache misses.

To eliminate this scenario, we are adding hardcoded hacks to ParserCache and ParserOutputAccess to query the 'parsoid' PC instance on cache misses to the 'parsoid-pcache' instance.

Over a 3-week period, as 'parsoid-pcache' fills up, there will be fewer and fewer accesses to the 'parsoid' PC instance which will also expire. At the end of that period, we can remove this hack.

So, optimally, we would remove this hack 3 weeks after https://gerrit.wikimedia.org/r/c/mediawiki/core/+/953342 is deployed. But, we could also do it after 2 weeks (so anything that had been cached 2 weeks prior and not refreshed would potentially be a cache miss if accessed again, but from a LRU point-of-view, they are less likely to be hit again).

This task will also be a blocker for 1.41 release since this is a temporary production-only hack and shouldn't make it into the final release.

Event Timeline

Change 967983 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/core@master] Revert "Hacks to avoid cold cache misses after ParsoidOutputAccess changes"

https://gerrit.wikimedia.org/r/967983

ssastry triaged this task as Medium priority.
ssastry moved this task from Backlog to Code Review on the Content-Transform-Team-WIP board.

Change 967983 merged by jenkins-bot:

[mediawiki/core@master] Revert "Hacks to avoid cold cache misses after ParsoidOutputAccess changes"

https://gerrit.wikimedia.org/r/967983

Change 972022 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/core@REL1_41] Revert "Hacks to avoid cold cache misses after ParsoidOutputAccess changes"

https://gerrit.wikimedia.org/r/972022

Change 972022 merged by jenkins-bot:

[mediawiki/core@REL1_41] Revert "Hacks to avoid cold cache misses after ParsoidOutputAccess changes"

https://gerrit.wikimedia.org/r/972022