-
Notifications
You must be signed in to change notification settings - Fork 924
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
Use AsyncCache
for RefreshingAddressResolver
#3547
Comments
There are 2 concerns IMO.
So maybe create new Resolver and let user can choose? |
Thanks for the insight @kojilin. I figured there had to be a good reason when mentioning I don't think variable refresh is a difficult feature to implement, but I probably won't get around to it soon. I think a doc comment would satisfy my review comment and close this ticket. |
I'm also have interest in using AsyncCache. But just have concern about behavior change and if there is some latency increase in less frequent use of host after change. So if it's tolerable I will ^^. The original design looks like cache as much as possible & try to refresh automatically even there is no usage. And if we have Expiry with variable refresh, we won't have such latency increase problem for frequently used host I think. (even dns query is quite fast, if we can refresh during TTL, we will make many request waiting for first query after TTL(?)). |
RefreshingAddressResolver
caches a DNS result withCompletableFuture
. The result is expired by a custom scheduler.The implementation of async resolving and expiration in
RefreshingAddressResolver
is pretty complex.armeria/core/src/main/java/com/linecorp/armeria/client/RefreshingAddressResolver.java
Lines 305 to 310 in 38c9f56
It'd better delegate the expiration to Caffeine's
AsyncCache
for separation of concerns.The text was updated successfully, but these errors were encountered: