I have the following infrastructure:
Infrastructure is N apps that connect into a master-slave replication schema for Postgresql databases located upon amazon RDS. I use rotated weighted DNS using a private zone in Route53 AWS where I use it to direct the connection to either master or slave for load balancing.
What I want though is a more fine-grained control upon connection via using the CPU usage as load balancing weight. What I want is to direct the database query from my applications towards the database that has the least amount of CPU usage.
I found some solutions:
- https://www.pgbouncer.org/
- https://github.com/awslabs/pgbouncer-rr-patch
- https://severalnines.com/blog/postgresql-load-balancing-proxysql-enhancements-clustercontrol-15/
- Haproxy
But I do not know which one suits the best. What I want is to use the CPU usage as a weight where the least amount of CPU usage gets higher priority.