Unconditionally, on all web requests (including api.php, rest.php, load.php, etc.) we create the DBLoadBalancerFactory service in order to inject some request-specific meta data:
MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->setRequestInfo( [ … ] );
To construct the DBLoadBalancerFactory service, it:
- creates LBFactory
- creates WANObjectCache
- creates getStatsdDataFactory
- creates and initialises MemcachedPeclBagOStuff
Let's look at what these constructors are doing and defer what we can so that the instantiation is a cheap as it can be.