Things have moved on a bit since I set up a custom DNS resolver for microservices to enable them to continue to use known successfully resolved addresses when DNS resolution subsequently fails. Since Java 22 we can specify a value in a file in the JDK to have the option of continuing to use successful lookup results even after the TTL expires. The property name is: networkaddress.cache.stale.ttl https://bugs.openjdk.org/browse/JDK-8306653 The compromise A trade-off to consider when applying that approach instead of a customised DNS Resolver is that we would not have the option of detecting when normal DNS resolution has failed. Hypothetical situation Let's suppose that a minor adjustment was applied to the deployment approach for rolling out a new version of microservices within the organisation's VPC. We might start to notice intermittent errors showing in our logs, where some unintended temporary DNS clear out results in continuing to send requests to the old address...
Professional software developer, producing scalable applications on the Internet