'Does AWS load-balance connections between master and read-replica DB
I created a read-replica for an RDS instance, Does AWS handles the load-balancing automatically or it needs another configuration or implementation in the code ? and if so Is there a reference for that ?
Edit for more clarification When I create a read-replica how it's going to work and handle requests ? I'm asking because it gives me an endpoint, so there must be a sort of implementation for it work properly right? (alongside the master RDS)
Solution 1:[1]
Unfortunately, load balancing of Aurora cluster is quite limited. First of all, it balances connection at the moment of connection being established and does not re-balance them under any circumstances, unless the connection is dropped and re-opened (but that has limitations too, see below).
Second, when Aurora does distribute the connections, it, however, does not take into account the number of connections already established to each read-replica.
Third, it does it using DNS switch process with TTL of 1 second. As result of all of the above, it is, unfortunately, very common case, when some replicas receive MUCH more connections, than others. Not to mention absence of mechanism of drying out instances for switching off etc.
Because all of the above limitations and highly unbalanced load, we've developed a fairlink JDBC driver (or rather envelop-driver) for MySQL and PostgreSQL. You can find it here: https://github.com/DiceTechnology/dice-fairlink
Solution 2:[2]
AWS handles RDS failover automatically, not load balancing on replication. You can configure how the load balancing between your read replicas should work using:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Gordon Gustafson |
| Solution 2 | John Rotenstein |
