Looking at connections opened in a typical request (e.g. logged out view of a page from ParserCache). I see a lot of connections being opened (around twenty). Looking at processlist of any replicas also show a lot of "sleeping" connections doing nothing. I also have seen connections being opened and closed without doing anything a lot.
This clearly needs fixing.
Suggested approaches:
- Phase out ILoadBalancer::getConnectionRef in favour of ILoadBalancer::getLazyConnectionRef (T255493)
- Make maintenance scripts close connections after querying.