Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP Client with NIO2

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!

like image 246
John Avatar asked Sep 19 '11 19:09

John


2 Answers

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

like image 111
jeckhart Avatar answered Oct 15 '22 13:10

jeckhart


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

like image 43
Glen P Avatar answered Oct 15 '22 13:10

Glen P