#### Description
//(Please provide the context of the performance review, and describe how the feature or service works at a high level technically and from a user point of view, or link to documentation describing that.)//
Community configuration is a system that allows on-wiki admins to modify a certain subset of MediaWiki configuration. This is done through storing configuration in the form of JSON on-wiki pages in the MediaWiki namespace, and using them for configuration (subject to caching, see above). A more detailed explanation of the project is available at https://www.mediawiki.org/wiki/Community_configuration. A more technical introduction is available as [a slidedeck for Hackathon 2023](https://docs.google.com/presentation/d/1_V-doxpQExPTlE9FOTJG2uWNnPVEPzUQLrNt4-k0dUA/edit#slide=id.g245f29f3ea0_0_586).
Note CommunityConfiguration is intended as a platform for other Wikimedia developers. It does not function on its own – for it to be actually usable, a client extension needs to exist as well. The Growth team is converting #growthexperiments to CommunityConfiguration as of now; there is also [an example available](https://gitlab.wikimedia.org/repos/growth/community-configuration-example).
#### Preview environment
CommunityConfiguration is enabled at eswiki beta. Administrators can modify the configuration values via https://es.wikipedia.beta.wmflabs.org/wiki/Special:CommunityConfiguration; those values are then used in the following context:
* in page load context (eg. Help panel); this is only used if all three checkboxes under "Newcomer editor features" are checked in Special:Preferences; newly-created accounts are automatically provisioned in this way,
* at [Special:Homepage](https://es.wikipedia.beta.wmflabs.org/wiki/Special:Homepage)
* at [Special:MentorDashboard](https://es.wikipedia.beta.wmflabs.org/wiki/Special:MentorDashboard)
* in maintenance jobs (eg `extensions/GrowthExperiments/maintenance/refreshPraiseworthyMentees.php`)
For testing purposes, configuration can be loaded within the command line:
```
urbanecm@deployment-deploy03:~$ mwscript shell.php eswiki
Psy Shell v0.12.0 (PHP 7.4.33 — cli) by Justin Hileman
# this call is guaranteed to access Community configuration. If the requested key is not available, it might error out, but it will not fall back to non-CommunityConfiguration sources
> \MediaWiki\MediaWikiServices::getInstance()->get('CommunityConfiguration.ProviderFactory')->newProvider('Mentorship')->get('GEMentorshipEnabled')
= false
# when an unrecognized variable is requested, this call fallbacks to GlobalVarConfig
> \MediaWiki\MediaWikiServices::getInstance()->get('CommunityConfiguration.WikiPageConfigReader')->get('GEMentorshipEnabled')
= false
>
```
#### Which code to review
The main code is available as `mediawiki/extensions/CommunityConfiguration` in Wikimedia Gerrit.
GrowthExperiments includes client code that integrates with CommunityConfiguration (see [source](https://github.com/wikimedia/mediawiki-extensions-GrowthExperiments/blob/master/ServiceWiring.php#L169-L180)), but I'd expect any performance concerns related to CommunityConfiguration to exist within the CommunityConfiguration repo.
#### Performance assessment
* What work has been done to ensure the best possible performance of the feature?
We cache the on-wiki JSON pages in Memcached as well as in APCU, lowering the cost-to-load as much as possible.
* What are likely to be the weak areas (e.g. bottlenecks) of the code in terms of performance?
The extension switches the source for certain configuration from PHP globals to on-wiki JSON pages. This can cause the site to generally load more slowly, as on-wiki pages are slower to read. Considering the on-wiki JSON pages storage backend, it can also increase the number of SQL queries performed in a page load context.
* Are there potential optimisations that haven't been performed yet?
No.
* Please list which performance measurements are in place for the feature and/or what you've measured ad-hoc so far. If you are unsure what to measure, ask the MediaWiki Platform Team for advice: [[ mailto:mediawiki-platform-team@wikimedia.org | mediawiki-platform-team@wikimedia.org ]].
We measure the speed of pageload of Special:Homepage (the user of the previous version of Community configuration, which was a part of the #growthexperiments extension). The speed was not negatively affected by the introduction of Community configuration. That said, we do not have dedicated performance measurements in CommunityConfiguration extension itself (it is not super-clear what would we be measuring either).