gomemcache icon indicating copy to clipboard operation
gomemcache copied to clipboard

Re-resolve server names on connection failure

Open EmpireJones opened this issue 5 years ago • 2 comments

Currently the server names are only resolved once, to optimize performance. However, this doesn't support dynamic environments well in which the name should be re-resolved.

I think that I can work around this by wrapping the library calls, and creating a new connection upon error (or maybe creating something which detects name resolution changes), but this doesn't seem ideal.

I considered periodically running SetServers, but I believe the ServerList isn't public in the client.

EmpireJones avatar Mar 14 '19 19:03 EmpireJones

I'm facing this as well. I have some workarounds in place, but it'd be nice to be able to update that server list or have it resolve the name each time it connects and let the OS handle DNS TTLs.

patrickeasters avatar Apr 18 '19 17:04 patrickeasters

Hi, if you run memcache in kubernetes we implemented https://github.com/castai/k8s-memcache-selector It watches memcache k8s endpoints and updates server list.

anjmao avatar Aug 05 '22 07:08 anjmao