This task calls for several things:
* [] Make the connectivity scaling factor converge faster to avoid connection attempts to downed servers faster. Currently, the logs still get flooded with connection errors. We should both using a higher "moving average ratio" and poll the mysql connected/running/max_connections status variables to see how close a server is too being overloaded.
* [] Make the cache keys per DB-server so that extra query groups do not require separate cache keys (even if they are a subset of the main traffic servers or at least overlap). When checking which servers needs state updates, the order should be shuffled. This makes it easier to keep the data more up-to-date since it no longer requires a for-loop that always has to connect to everything.
* [] Placeholders should liberally be used for a few seconds when there is no stale value and the cache mutex is already held. The tiered (WAN/apcu) cache logic should be careful about saving placeholders into cache.
* [] When checking which servers needs state updates, the order should be shuffled.
* [] Move scaleLoads() logic to LoadBalancer where it better belongs. Leave the DB server state tracking/caching in LoadMonitor.
* [] Improve the situation for CLI scriptsSimplify the tiered apcu/WANCache logic to use either apcu (web mode) or the local cluster cache (CLI mode). Right nowSince both have the BagOStuff interface, HashBagOStuff is used and the server states are all regenerated (connecting to ever server just to find out what server to connect to)this would simplify the code significantly. There is not enough contention for the WANCache to be of much use herePlaceholders should liberally be used for a few seconds when there is no stale value and the cache mutex is already held. Population of the WANCache is done on the regeneration path (even for web requests, incurring overhead)Cluster cache updates from web requests should use WRITE_BACKGROUND to avoid latency.
See T314020 for further tracking of connection failures.