networkaddress.cache.male.ttl 的目的到底是什么?

发布于 2025-01-16 02:56:54 字数 602 浏览 3 评论 0原文

对于 InetAddress 类,它有一个属性“networkaddress.cache.negative.ttl”。 Javadoc 说

networkaddress.cache.negative.ttl (default: 10)

Specified in java.security to indicate the caching policy for un-successful name lookups from the name service.. The value is specified as integer to indicate the number of seconds to cache the failure for un-successful lookups.
A value of 0 indicates "never cache". A value of -1 indicates "cache forever".

请原谅我的愚蠢问题,如果名称查找不成功,有什么可以缓存?名称查找不成功意味着没有 IP 地址返回,因此它无法缓存任何 IP 地址。

这是否意味着该参数将在缓存期间仅返回“未找到主机”返回代码以进行同名查找,而不是执行实际的 DNS 查询?

谢谢

For the class InetAddress, it has a property "networkaddress.cache.negative.ttl". And the Javadoc says

networkaddress.cache.negative.ttl (default: 10)

Specified in java.security to indicate the caching policy for un-successful name lookups from the name service.. The value is specified as integer to indicate the number of seconds to cache the failure for un-successful lookups.
A value of 0 indicates "never cache". A value of -1 indicates "cache forever".

Pardon my dumb question, what is there to cache if a name lookup is unsuccessful? An unsuccessful name lookup means there is no IP address return so it can't be caching any IP address.

Does it mean that this parameter will just simply return "host not found" return-code during the caching period for the same name lookup instead of performing an actual DNS query?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请你别敷衍 2025-01-23 02:56:54

所有(递归)名称服务器都有负 TTL 的概念,即缓存“未找到数据”类型的答案的时间。

这是由权威名称服务器在 SOA 字段中给出的,最后一项是负 TTL。如果域启用了 DNSSEC,它也可以从 NSEC/NSEC3 记录的 TTL 派生。

考虑到这一点,系统就不会过度查询已知不存在的东西。与所有缓存一样,它是本地内存(用于存储缓存)与网络 IO(用于发送和等待回复)之间的性能优化和折衷。

您可以在 https://serverfault 上找到 DNS 级别的更多详细信息。例如,com/questions/426807/how-long-does-negative-dns-caching-典型地-last

Java框架似乎只是继承了这个思想,并且有类似的设置。

All (recursive) nameservers have the concept of negative TTL, that is how long to cache "data not found" type of answers.

This is given by authoritative nameservers in the SOA fields, the last item is the negative TTL. It could also be derived from the TTL of NSEC/NSEC3 records in case the domain has enabled DNSSEC.

Taking that into account allows the system to not over query for something already known not to exist. Like all caches, it is a performance optimization and a compromise between local memory (to store the cache) vs network IO (to send and wait for replies).

You can find more details at the DNS level on https://serverfault.com/questions/426807/how-long-does-negative-dns-caching-typically-last for example.

The Java framework seems to just inherit this idea and has a similar setting.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文