Can you share what your goals of an asynchronous client would be, e.g.,
does your application have some scalability limit?  Does profiling or
measurement reveal that the new client would address this?

Can you provide details on 4?  I briefly looked at the Apache
HttpAsyncClient -- from the examples[1] it appears to execute
onCharReceived callbacks for HTTP entities and onResponseReceived for
headers.  What internally runs select/epoll and issues the callbacks?

Returning to 1, can you provide this functionality without requiring
Java 8?  HttpAsyncClient only requires Java 6 and Guava provides
ListenableFuture, analogous to Java 8 CompletableFuture.  Requiring a
newer Java version will impact or block a subset of jclouds users.

For 3, will we make all methods async, or just the subset of putBlob and
getBlob methods?  If the latter, can you accomplish your S3Proxy goal
with something simpler?  For example, getBlob returns a (wrapped)
InputStream; can you hook this up to some reactor implementation to copy
it to the S3Proxy OutputStream?  Unfortunately this does not help with
putBlob and jclouds needs some more work for the equivalent.

Overall proposal would be useful to jclouds and its users.  This is a
big undertaking and it might help to hack out a proof of concept for
more discussion before embarking on the whole implementation.

[1] https://hc.apache.org/httpcomponents-asyncclient-dev/examples.html

On Thu, Mar 02, 2017 at 09:06:40AM -0000, Spandan Thakur wrote:
> Hi,
> 
> We are thinking and planning to add proper multiplexing Async behaviour in 
> jClouds. We plan to use the apache async httpClient library to achieve the 
> same.
> 
> We are still thinking about how to implement this in jClouds and s3 proxy but 
> below are are initial thoughts.
> 1. Move to Java 1.8 so we can start using CompletableFutures. (Let us know if 
> you feel there are any issue in upgrading JAVA version)
> 2. Add a new annotation like @async which can be used in the client 
> interfaces like AzureBlobClient.java, S3Client.java.
> 3. Add new methods for async in BlobStore and implement then in the specific 
> stores. The methods will return completableFutures.
> 4. In the core http package add the apache async httpClient based class. 
> Which will execute async http requests and return completable futures. (We 
> are not sure if we can just add a implementation of 
> BaseHttpCommandExecutorService.java for the same)
> 5. Make some changes in the DelegatesToInvocationFunction.java to see if 
> async annotation is present and then using the Async client http executor.
> 6. The S3 proxy use jetty continuations to suspend the thread and then 
> continue after the async method is done (using thenAccept in the Completable 
> Future).
> 
> Please do let me know your thoughts on this. Do you feel like this feature 
> would be something useful for jClouds? Do you think we are on the right track 
> on the way we plan to implement it? Any suggestions from your side?
> 
> Regards,
> Spandan Thakur

-- 
Andrew Gaul
http://gaul.org/

Reply via email to