Closed yangtaoran closed 1 year ago
Hi @yangtaoran could you clarify what you mean by
but others cannot be used?
The current pool design relies on LIFO to ensure that the minimum number of connections is used and that old unused connections are eventually cleaned up.
There is more of a discussion this draft PR #589
In a Redis proxy environment, any Redis connection will pass through the proxy. If one proxy is slow for some reason, the LIFO strategy will cause the slowest proxy to hold more connections. But the FIFO strategy would not cause such a problem. Reference https://github.com/redis/go-redis/issues/2350
That's talking about hooks which is totally different. Not clearing down connections is a much bigger issues.
If you have one proxy is always slower that's an infrastructure issue you should fix. If it's only transitory is should rebalance over time.
If you really need to control over clean up you can use Pool.TestOnBorrow to do that.
Now the redis connection pool strategy is LIFO, popFront and pushFront. This will use less connection to do same thing, but others cannot be used. can support FIFO?