I currently have a problem with properly load balance open TCP sessions (created by the RoR application) to dynamically created Aurora Postgresql read-replicas.
The issue with this is when TCP connections are already established to one read-replica, another read-replica is created. After that traffic from the first replica will not be distributed evenly to second one, since TCP connections are already established with first replica.
Attached chart represents current infrastructure setup. Please note that between read-replicas (servers) and application (client) there is a load balancer, provided by the Aurora service, which is based on DNS round-robin.
I've tried pgbouncer, pgpool and multiple Ruby gems (makara, fresh_connection), but none of them were able to load balance nor eliminate long lived TCP connections..
I went through many articles and they helped investigate and confirm the issue; however none of them present a solution.
So... as you can see I've tried obey this problem from application and network perspective, unfortunately without luck. Has anyone had the same problem?
