-
Notifications
You must be signed in to change notification settings - Fork 843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Both Apache Client and Netty are included in the runtime scope by default #3040
Comments
Hi @axelfontaine thank you for reaching out. This is by design, Apache and Netty are distributed by default because they provide more robust features that support the SDK as a solution for customers of all types. With the robustness comes the jar size. If you'd like to reduce the size of your project you can exclude both |
I stand by my original comment. The default should be sensible, where in my opinion the current one isn't. Regardless of the choice of default, configuration options as well as the current default should be documented on https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/http-configuration.html instead of random blog posts. It would also be nice if that page could include all available options and how to switch between them, as currently |
Agreed, we can definitely improve the Dev Guide around HTTP client options. |
Hi @axelfontaine, thank you for your feedback. We should definitely improve our Dev Guide. The reason why we include a default sync and async HTTP client in the SDK is that this way, the SDK client works out-of-box; otherwise, users would need to manually add another HTTP client dependency for sync or async client, which, we think, is a bad customer experience. I think the choice of the HTTP client really depends on the use-case. Apache HTTP client offers better connection pooling and more features at the price of JAR size and startup time, and JDK HttpURLConnection is more lightweight with limited features. IMO in most cases, Apache HTTP client should be preferred unless startup latency or JAR size is a concern. In addition, Java SDK v1 also uses Apache HTTP client, so it seems to make sense to continue to use it as the default sync HTTP client in v2 to provide a consistent experience. |
Fair enough. That's good rationale for picking the Apache HTTP client as a default. But don't bundle any additional one! If people want to switch to a different one, they can then simply follow the instructions on your soon to be updated docs page. |
Just had this exact problem.
Indeed. Have you considered letting people decide their own use-cases for themselves? The current approach pulls in a specific version of netty by default, which for our use-case actually caused a conflict because the rest of our code depended on a different version of netty. Manually excluding |
…5713919e4 Pull request: release <- staging/17707c51-925a-4ba8-ba04-e805713919e4
Describe the bug
When simply including a service, say
ec2
in a Gradle build, both the Apache Client and Netty get pulled in as runtime transitive dependencies by default.This is due to
aws-sdk-java-v2/services/pom.xml
Line 381 in 2f4b44d
aws-sdk-java-v2/services/pom.xml
Line 387 in 2f4b44d
This then automatically gets picked up by the Gradle application plugin and needlessly includes tons of jars in the final package.
Expected behavior
Default to a single client, preferably the plain and lightweight
url-connection-client
.Current behavior
Dozens of additional jars are pulled in by default.
Steps to Reproduce
Create a new
build.gradle.kts
file and add the following dependency:implementation("software.amazon.awssdk:ec2:2.17.131")
.Now run
gradle dependencies
and check theruntimeClasspath
section.Possible Solution
Only depend on
url-connection-client
by default.Context
No response
AWS Java SDK version used
2.17.131
JDK version used
17.0.2
Operating System and version
Win11 x64
The text was updated successfully, but these errors were encountered: