Right now I have set the backend as a managed instance group with "N" machines. Where N in 2 to 5
. Inside each machine is installed a ProxySQL.
As persistence layer, I have set up a Master/Slave configuration with CloudSQL where M is the numer of the slaves M in 1 to 3
.
At this point, the requirement is to load balancing queries between the multiple replica that i can spinup for heavy load from the MIG and the MIG ProxySQL need to be reconfigured to bind to new created slaves .
For example, at 5PM i am going to face high traffic for my webservices and i will need to create more SQL slaves to accept more SQL connection. So I will create multiple slave replication. M increasing from 1 to 3, N increasing from 2 to 4.
Now I'm trying to get the best solution for this purpose. One possible solution that I found is to use ProxySQL but with some heavy limitation for the MIG.
The GPC MIG is stateless, and actually doesn't know how many replicas are up and running. Plus when a new MIG instance is created how can it get the new configuration if not all the SQL replicas are yet running?
What is the best implementation for discovery the number of possible healthy SQL replicas and reconfigure the ProxySQL configuration (runtime/disk/memory), maybe with a custom polling of 5 seconds where the VM is asking for new configuration.
Are available already some implementation? What is the best solution? I have found some links but not the best slution for me.
Thanks in advance.