简体   繁体   English

请求模块中的dns缓存-node.js

[英]dns caching in request module - node.js

In my project I do a big amount of request to the same url using the 'request' module. 在我的项目中,我使用“请求”模块对相同的网址进行了大量的请求。 For some reason a lot of the request go to the dns server in order to resolve the url address instead of having some sort of caching for this. 由于某种原因,许多请求都发送到dns服务器以解析url地址,而不是为此进行某种形式的缓存。 Is there some kind of built-in mechanism in the 'request' module to resolve this? “请求”模块中是否存在某种内置机制来解决此问题? Or any other solution? 或其他解决方案?

Thanks! 谢谢!

This question is a little old so you may have already found an answer, but I just had this problem and used the dnscache module to handle it. 这个问题有点老了,所以您可能已经找到了答案,但是我只是遇到了这个问题,并使用dnscache模块来处理它。 We had a high amount of IO (Node reading /etc/resolv.conf ), and this module seemed to handle the problem. 我们有大量的IO(Node读取/etc/resolv.conf ),并且此模块似乎可以解决该问题。 I couldn't find anything in Request's or Node's source to handle that problem, but did find this related issue . 我无法在Request或Node的源代码中找到任何可解决该问题的东西,但确实找到了相关问题

Use https://www.npmjs.com/package/lookup-dns-cache 使用https://www.npmjs.com/package/lookup-dns-cache

Have encountered the same problem, so have created a package to solve it. 遇到相同的问题,因此创建了一个程序包来解决它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM