-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Cache piercing for discovery and async-dns #32260
feat: Cache piercing for discovery and async-dns #32260
Conversation
@@ -74,12 +74,18 @@ class SimpleDnsCache extends Dns with PeriodicCacheCleanup with NoSerializationV | |||
} | |||
|
|||
@tailrec | |||
private[io] final def put(key: (String, RequestType), records: Resolved, ttl: CachePolicy): Unit = { | |||
private[akka] final def put(key: (String, RequestType), records: Resolved, ttl: CachePolicy): Unit = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened up slightly to be able to write test in discovery
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, after minor
I'm wondering if an alternative approach of setting a maximum DNS TTL would be conceptually cleaner than exposing a drop operation on the cache through service discovery? |
This is not intended as general purpose but a means for a specific downstream feature in Akka gRPC for discovering updated sets of services to load balance over. Forcing all cache to be dropped for that purpose seems wasteful and would also not be enough for that feature since we also need the drop to trigger a refreshed list to push into the gRPC client. |
For the record, this is the Akka gRPC functionality PR: akka/akka-grpc#1886 |
This makes it possible to programatically force re-resolution even if TTL is long, needed downstream in Akka gRPC for periodic refresh of nodes used for client side load balancing.