反向 DNS 查找需要多长时间?
反向查找需要多长时间? 100毫秒? 1秒? 10秒? 30秒?你的经验是什么?
为什么?我们正在讨论向我们的服务器软件添加一项功能,该功能需要在每次客户端连接时进行反向 DNS 查找。查找将同步完成,因此我担心它会大大减慢连接时间。我只是想听听其他人关于反向 DNS 查找时间的经验。
How long should I expect a reverse lookup take? 100 milliseconds? 1 second? 10 second? 30 seconds? What's your experience?
Why? We're debating adding a feature to our server software which would require a reverse DNS lookup each time a client connects. The lookup would be done synchronously, so I'm worried that it could slow connection-times down a lot. I just wanted to hear other people's experience regarding reverse DNS lookup times.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只要需要。很大程度上取决于
* 与您通话的 DNS 服务器在哪里
* DNS服务器是否已经缓存了该值
* 是否反向映射到也可运行的正确 DNS 服务器(或检索超时)。
一般来说,对于最终用户来说,您可以轻松预期 200 毫秒 - 用户可能在世界的另一端。实际上,如果出现 DNS 可达性问题,我会假设任何长达 2 分钟的时间都是可能的。
在局域网内,您通常应该在几毫秒内得到答案。两位数,最大值(10 毫秒左右)。
一般来说,同步在这里可能是一个非常糟糕的主意 - 但很大程度上取决于应用程序实际执行的操作。
As long as it takes. A LOT depends on
* Where the DNS Server is that you talk to
* Whether the DNS server has the value already cached
* Whether ther everse mapping mas to a proper DNS server that is also operational (or the retrieval times out).
In general, for end users, you can expect easily 200ms - the user may be at the other side of the world. I would actually assume anything up to 2minutes to be possible in case of DNS reachability issues.
Within a lan, you should normally have an answer within milliseconds. Two digit, maximum (10ms or so).
In general, synchroneous may be a REALLY bad idea here - but a lot depends on what the application actually DOES.
我没有具体的数字,但如果性能对您来说是一个问题,您可以考虑在单独的线程中进行反向查找。如果反向查找不符合您的标准,您可以中止原始连接并禁止该 IP(可能只是一段时间内)。
这样做的先决条件是在连接开始和反向查找完成之间不会发生真正的丢失。话又说回来,这与您现在在没有反向查找的情况下所处的情况相同。
I don't have a specific number, but if performance turns out to be an issue for you, you could consider doing the reverse lookup in a separate thread. If the reverse lookup doesn't meet your criteria, you can then abort the original connection and ban that IP (possibly just for some duration).
A prerequisite for this is that no real loss can happen between when the connection starts and the reverse lookup completes. Then again, that's the same situation you're in now without the reverse lookup.