aws / aws-sdk-java-v2

The official AWS SDK for Java - Version 2
Apache License 2.0
2.21k stars 853 forks source link

AWS Java 2.x SDK (sync vs async) Client Documentation #4698

Open decoursin opened 1 year ago

decoursin commented 1 year ago

Describe the issue

The documenation here seems very confusing.

The AWS Java 2.x SDK offers many different http client alternatives. Two of which are the:

To help me understand the difference between the Sync and Async, I was trying to understand the differences described in the AWS documentation, as linked above.

When browsing their recommendations as to which to use, I found the following very peculiar:

The Apache-based sync HTTP client is recommended for "low latency over high throughput", while the AWS CRT-based async HTTP client is recommended for "high throughput over low latency".

How on earth could the Apache-based sync HTTP client have a lower latency than one of the Async HTTP clients? I would expect the latency to be based on network latency and for that it's completely irrelevant which client (whether sync or async) you use.

Also, how could an Async client have a higher throughput than a sync HTTP client, that also doesn't make sense to me? I would expect the opposite because the sync client will busy wait until the response is available, while the async will go run off do something else in the meantime, and therefore might not be ready to handle the response right when it arrives.

I've also asked this on stackoverflow, and I haven't any responses to my question yet.

Links

https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/http-configuration.html

debora-ito commented 1 month ago

@decoursin appreciate your feedback, we'll add more details on latency and throughput to the HTTP clients docs.

decoursin commented 1 month ago

@debora-ito thanks!