[英]How to solve Vertx blocking DNS issue
TL;DR: is it possible to overcome blocking DNS issues with Vertx? TL;DR:是否有可能克服 Vertx 的 DNS 阻塞问题? Preferably with Vertx HttpClient?
最好使用 Vertx HttpClient?
I'm trying to use Vertx to scrape some URLs with different hosts.我正在尝试使用 Vertx 来抓取不同主机的一些 URL。 I'm currently using Vertx HttpClient to do so, I've recently encountered an issue with a blocking DNS call which sometimes blocks my HttpClient requests (and therefore also blocking the event loop).
我目前正在使用 Vertx HttpClient 来执行此操作,我最近遇到了阻塞 DNS 调用的问题,该调用有时会阻塞我的 HttpClient 请求(因此也会阻塞事件循环)。 This issue is described here .
此处描述了此问题。
I can't use a blocking http client in an "executeBlocking" function since I went for the Vertx solution because it is asynchronous and should be able to handle the loads I'm expecting.我无法在“executeBlocking”函数中使用阻塞 http 客户端,因为我选择了 Vertx 解决方案,因为它是异步的,应该能够处理我期望的负载。 Also I can't resolve the IP address myself because it only solves it for a specific host while I'm trying to fetch many different hosts
此外,我自己无法解析 IP 地址,因为它只能在我尝试获取许多不同主机时为特定主机解析它
So my question is: is there any (relatively) elegant solution to this issue that doesn't require me to wait for future Netty versions?所以我的问题是:是否有任何(相对)优雅的解决方案来解决这个问题,不需要我等待未来的 Netty 版本? Preferably something that uses the native Vertx HttpClient.
最好是使用本机 Vertx HttpClient 的东西。
Thanks in advance提前致谢
其他选项是通过将-Dvertx.disableDnsResolver
添加到命令行来禁用dns 解析器。
Ok so after digging about this issue for several days I found several possible solutions to this issue.好吧,在研究这个问题几天后,我找到了几个可能的解决方案。 I hope this might help someone
我希望这可以帮助某人
These are the possible solutions这些是可能的解决方案
All of these solutions are from the Vertx mailing list.所有这些解决方案都来自 Vertx 邮件列表。 You can see the full correspondence here (including some code examples)
您可以在此处查看完整的对应关系(包括一些代码示例)
Currently I'm running the program in a cluster and I didn't encounter this issue on it.目前我正在集群中运行该程序,我没有遇到这个问题。 If I will later need to solve this I will probably aim for the 1st solution (unless Netty 4.1 is released by then)
如果我以后需要解决这个问题,我可能会瞄准第一个解决方案(除非那时 Netty 4.1 发布)
I hope I got all the solutions right, if someone sees this and has better ideas or corrections I'll highly appreciate it我希望我的所有解决方案都是正确的,如果有人看到这个并且有更好的想法或更正,我将不胜感激
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.