Page MenuHomePhabricator

Cache (expensive) Parsoid config properties in APC and/or memcache
Open, MediumPublic

Description

Parsoid computes a bunch of config properties on startup for every request. A bunch of these don't change between requests for the same wiki, and as such should be cached in an external cache.

Examples: computed extension config, interwiki maps, but basically anything that is non-trivial.

Before deploying this, we should of course perf-test this to make sure it is faster to fetch it from cache (along with the associated I/O latencies) than computing it. This is very likely to be true for things like the extension config that might involve fetching the extension source from disk, compiling it even though the current request might never actually use any of the functionality provided by the extension.

Event Timeline

ssastry triaged this task as Medium priority.Apr 16 2020, 3:00 AM
ssastry moved this task from Needs Triage to Performance on the Parsoid board.
Krinkle renamed this task from Cache (expensive) computed config properties in APC / memcache to Cache (expensive) Parsoid config properties in APC and/or memcache.Jun 5 2020, 11:57 PM

Note that core already does a lot of 'expensive' startup work wrt loading extensions/etc on every request. So it doesn't really make sense to super-optimize this when we're still sitting behind core startup. Although latency is certainly additive, we should get a quantitative sense for what percentage of the request startup time Parsoid is responsible for.

In addition, any cache here will complicate deployment of mediawiki-config changes, which then have to flush any caches after the configuration changes leading to various new race conditions.

See also T270307: Parsoid needs a way to unregister extension modules for testing -- some parser configuration changes (like which extension tags are enabled) are currently bundled in SiteConfig. We'd probably want to do some refactoring to make SiteConfig more purely static before caching it, or else have some way to disable caching when running unit tests and parser tests.