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:
- Remove simple usages of getConnection and replace them with getConnectionRef
- In long term, we need to simplify this a lot and merge these functions. I get a lot of questions from confused devs on which one they should pick.
- For now, its documentation needs improvements
- Phase out ILoadBalancer::getConnectionRef in favour of ILoadBalancer::getLazyConnectionRef (T255493)
- wfGetDB is using `getMaintenanceConnectionRef`, it should probably migrate to getConnectionRef when it's not CLI
- More?