Investigate how well the Database loadbalancer works with a Patroni cluster

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Our documentation for the Database load-balancer feature : https://docs.gitlab.com/ee/administration/database_load_balancing.html while technically should work fine with Patroni, because they have different goals in mind (performance vs availability and disaster-recovery), there are scenarios where the load balancer may direct the query to a host that is unhealthy from the point of view of patroni.

My understanding is that we rely solely on lag measurements taken from the database itself in the database load balacing solution, which is unaware of the existence of something like repmgr or patroni. In the case of patroni, as it exposes a REST API, we could probably leverage that to improve how the database load balancing works.

One possible improvement is relying on patroni's API to gather existing hosts. Another is use the API to validate health status when deciding whether or not to route a query to a specific host.

As part of this issue, we should consider validating whether the assumptions above make sense, if they are feasible and create following issues for that.

Edited by 🤖 GitLab Bot 🤖