I would use redis to store the lookup table. Each load balancer will search the redis lookup table to connect to the most accessible / highest priority server. This search will return a single integer, which is the server index. Each application in the client will store the ip server with its corresponding indexes. therefore, this search is very fast and less than 30 ms. No redirection required. Rollback is also provided in case of simultaneous connections, and qouta on the desired server ends by the time the application tries to connect to the search server. In this case, it will again search for the most accessible server, i.e. Start more recursively until it is successfully connected or all resources are completed and the connection request is marked as a dead end.
How about reserving a connection for a few milliseconds for each search? After the connection delay for this search has expired, the file page will be available for use for a new connection. This will reduce the recursive search, but will also block the connection. The delay should be enough to establish a connection, which may vary. On the other hand, new connections will be blocked during this delay, which can lead to poor user experience. You need a compromise between the two: reduce the search and block the connection, so as never to block the connection and endure a recursive search, which is very fast.
source share