Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an async I/O based Aws java client?

1) Is there an implementation of the aws sdk which uses asynchronous I/O instead of thread pools? I am working on a highly scalable web service and profiling shows that the CPU is wasting a lot of cycles managing network I/O to and from amazon.

2)The current client uses Apache Http Client, if I cannot find an asynch implementation I will fork my own version to implement it. I was thinking of using the Jetty Http Client. Is it bad form to mix Jetty and Apache libraries? Is there a better alternative?

like image 999
Usman Ismail Avatar asked Feb 12 '12 18:02

Usman Ismail


1 Answers

1) Is there an implementation of the aws sdk which uses asynchronous I/O instead of thread pools?

Not that I know of, and I'd be surprised this to be difficult to find, if it would exist already.

2) The current client uses Apache Http Client, if I cannot find an asynch implementation I will fork my own version to implement it. [...] Is there a better alternative?

There is a better alternative indeed - the AWS SDK for Java currently uses the Http Client version 4.x (you linked to the legacy 3.1 version JavaDocs instead) from Apache HttpComponents, which conveniently provides a Async HttpClient as well:

Async HttpClient is a HTTP/1.1 compliant HTTP agent implementation based on HttpCore NIO and HttpClient components. It is a complementary module to Apache HttpClient intended for special cases where ability to handle a great number of concurrent connections is more important than performance in terms of a raw data throughput. [emphasis mine]

As emphasized, it should only be facilitated for respective uses cases, but (as per your comment) you are sending thousands of requests to AWs which means that open requests tend to pile up, so this might help indeed.

like image 174
Steffen Opel Avatar answered Oct 03 '22 20:10

Steffen Opel