Piyush
Piyush

Reputation: 321

Refreshing DNS cache in twitter finagle library

Does twitter finagle library does DNS caching on its own? I ask this because we removed some of the hosts behind the vip but they were still getting requests from our client.

If there is such a cache, how do I set a time out for it ?

Upvotes: 2

Views: 1653

Answers (1)

Wildfire
Wildfire

Reputation: 6418

Yes, Finagle caches DNS internally. The details might be found in com.twitter.finagle.AsyncInetResolver class in Resolver.scala.

Finagle uses networkaddress.cache.ttl system property, so it's only possible to change TTL for whole JVM.

I'd recommend to use following code snippet to work with services with frequently changing hosts: https://gist.github.com/agleyzer/6909056. It allows to specify TTL on per-service basis. This is especially useful when working with services that use Amazon Route 53 failover routing policy.

Upvotes: 7

Related Questions