Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the TransferManager in AWS SDK for S3 doing Asynchronous I/O?

I've been reading about TransferManager in the Amazon's AWS SDK for doing S3 uploads, the provided API allows for non-blocking usage, however it's unclear to me if the underlying implementation actually does asynchronous I/O.

I did some reading on the source-code of TransferManager and I cannot understand if the threads in the provided ExecutorService are being blocked or not.

My problem is that if this manager actually does asynchronous I/O without blocking that executor, then I could use the application's global thread-pool that is meant for CPU-bound stuff. So is this actually doing asynchronous I/O or not?

like image 1000
Alexandru Nedelcu Avatar asked Sep 29 '14 19:09

Alexandru Nedelcu


People also ask

Is S3 synchronous or asynchronous?

A method is asynchronous if it includes the Async suffix in its name. For example, the Amazon S3 method PutObject is synchronous, while PutObjectAsync is asynchronous. Like all asynchronous operations, an asynchronous SDK method returns before its main task is finished.

How does AWS SDK work?

The AWS SDK for JavaScript simplifies use of AWS Services by providing a set of libraries that are consistent and familiar for JavaScript developers. It provides support for API lifecycle consideration such as credential management, retries, data marshaling, serialization, and deserialization.

What is AWS async?

Several AWS services, such as Amazon Simple Storage Service (Amazon S3) and Amazon Simple Notification Service (Amazon SNS), invoke functions asynchronously to process events. When you invoke a function asynchronously, you don't wait for a response from the function code.

Is DynamoDB asynchronous?

The following is an example of an asynchronous operation that calls a Amazon DynamoDB function to get a list of tables, receiving a CompletableFuture that can hold a ListTablesResponse object. The action defined in the call to whenComplete() is done only when the asynchronous call is complete.


1 Answers

After profiling and trying to understand the SDK's source-code I have come to the conclusion that yes, TransferManager does not work asynchronously, because it piggybacks on AmazonS3Client.putObject and such calls, while not blocking the threads per se, go in a loop until the http requests are finished, thus preventing progress in processing the thread-pool's queue.

like image 127
Alexandru Nedelcu Avatar answered Oct 17 '22 03:10

Alexandru Nedelcu