Skip to content

Performance Degradation because of EC2 Metadata Client #1511

@Benmartin92

Description

@Benmartin92

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug
We were experiencing very slow speeds after upgrading to version v1.8.24. I am aware that the same issue has already been reported in #1440, however I think this still needs to be addressed somehow.

I can confirm that setting AWS_EC2_METADATA_DISABLED=true indeed solves the issue, however we are supporting several authentication methods including EC2 Instance Profile credentials (https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html, method 6) that obtains the credentials through EC2 Metadata Service which is in this case would be blocked. Therefore, we cannot disable this service.

I also understand that setting either AWS_DEFAULT_REGION or AWS_REGION prevents ClientConfiguration constructor from reaching out to the metadata service but these are global settings and for applications that may access multiple buckets in different regions one configuration might not be doable.

Moreover, these are new environment variables introduced in v1.8 so I suppose the region handling are implemented without utilizing these variables in many applications. For me it seems to be a hack to temporarily set AWS_DEFAULT_REGION or AWS_REGION to some region just to avoid a potentially slow EC2 metadata call.

I think it would be nice to not reaching out to the EC2 metadata client to obtain the region just because EC2 metadata is enabled, maybe make it configurable trough a different environment variable?

Thanks,
Ben

SDK version number
1.8.24

Platform/OS/Hardware/Device
Windows Server version 1607

To Reproduce (observed behavior)
Just create an S3Client with a default-constructed ClientConfiguration instance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.closed-for-stalenessp2This is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 10 days.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions