使用 NIO2 的 HTTP 客户端

发布于 2024-12-05 12:31:15 字数 320 浏览 1 评论 0原文

有熟悉基于JDK7和NIO2的HTTP Client的人, 使用的实现:AsynchronousSocketChannel

我正在寻找基于 NIO2 的实现,并且可以同时扩展无限的、数千个 HTTP 请求。

注意:

  1. 请不要向我建议基于 NIO1 的实现,例如 Apache::AsyncHTTPClient 和 JBOSS::Netty 框架

  2. 请不要向我建议基于分布式解决方案的解决方案,我正在寻找一个可以有效处理所有 HTTP 请求的客户端。

谢谢!

Have someone familiar with HTTP Client that based on JDK7 and NIO2,
Implementation that use: AsynchronousSocketChannel

I am looking for implementation that based on NIO2 and can scale out unlimited, thousands of HTTP requests concurrently.

NOTES:

  1. please do not suggest me an implementation that based on NIO1 like Apache::AsyncHTTPClient and JBOSS::Netty framework

  2. Please do not suggest me a solution that based on distribute solution, I am looking for one client that can handle all the HTTP requests efficiently.

THANKS!

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

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

发布评论

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

评论(2

热情消退 2024-12-12 12:31:15

我建议查看 AsyncHttpClient。它是由为 Sun 编写 Grizzly 的人编写的,现在为 Sonatype 工作。

I would recommend checking out AsyncHttpClient. It was written by the guy that wrote Grizzy for Sun and now works for Sonatype.

后知后觉 2024-12-12 12:31:15

我相信您认为必须使用 NIO2 来扩展的假设是错误的。请听!

NIO2 是 Java IO 的非阻塞版本。这意味着在 NIO2 中编写高性能 io 更容易,因为您不需要启动和管理线程,因为大多数线程只是等待 IO。多线程编程很棘手,因此任何让它变得更容易的功能都是一个功能,因此出现了 NIO2。

但是,作为库用户,库的编写难度不是您所关心的。现代 JVM 可以处理大量线程,而旧的 io API 在由熟练的程序员使用时应该非常强大。既然你是图书馆的用户,我建议你找到最快的图书馆。

Apache 的 HTTPClient 是一个非常流行的库。我建议您与这方面的专家联系并向他们询问您的性能问题。我不是这个领域的专家,所以我并不是告诉你 HTTPClient 是最好的,我只是说暂时不要指望它,与 HTTPClient 人员交谈将是一个很好的起点。

祝你好运

I believe you are mistaken in your assumption that you must use NIO2 to scale up. Please listen!

NIO2 is the non-blocking version of Java's IO. This means it's easier to write high performance io in NIO2 because you need not start and manage threads, because most of your threads are just going to be waiting on IO. Multi-threaded programming is tricky, so anything to make it easier is a feature, hence NIO2.

However, as a library user how hard the library was to write isn't your concern. Modern JVMs can handle a lot of threads and the old io API should be powerful when used by skilled programmers. Since you are a user of the library, I suggest that you just find the fastest library.

HTTPClient from Apache is a very popular library. I suggest you get in contact with the experts on that and ask them your performance questions. I'm not an expert in this area, so I'm not telling you HTTPClient is the best, I'm just saying not to count it out yet and that talking to the HTTPClient people would be a good place to start.

Good Luck

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