Page MenuHomePhabricator

SettingsBuilder: Combine multiple settings files before caching
Open, Needs TriagePublic

Description

Currenty, SettingsBuilder will cache the contents of each settings file separately. It may be desirable to process and combine multiple settings files, and then cache the combined result. This could easily be done by introducing a MultiSettingsSource that can be used explicitly (e.g. in CommonSettings.php), or transparently in SettingsBuilder.

Loading a combined settings structure from cache is faster than loading individually cached settings file, and then merging their contents. However, the number of possible permutations of settings files need to be considered, especially in the context of WMF production sites: we could easily end up with tens of thousands of them, if the batching is done in a naive way. This could lead to a large amount of duplicate data in the cache, which may cause data to be evicted from the cache, leading to cache churn and effectively degrading performance.

It may turn out to be better to pre-generate merged settings files as php structures that are then loaded by SettingsBuilder as a single file. This would give us full control of the number of permutations, and loading data structures from PHP files is faster than any caching we could apply, because of the opcode cache. On the other hand, this requires a build step.

Event Timeline

Change 773201 had a related patch set uploaded (by Daniel Kinzler; author: Daniel Kinzler):

[mediawiki/core@master] SettingsBuilder: add comments about batched caching.

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

Change 773201 merged by jenkins-bot:

[mediawiki/core@master] SettingsBuilder: add comments about batched caching.

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