Skip to content
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

EC2MetadataUtils is very slow after 1.11.678 #2276

Closed
kliakos opened this issue Mar 25, 2020 · 9 comments
Closed

EC2MetadataUtils is very slow after 1.11.678 #2276

kliakos opened this issue Mar 25, 2020 · 9 comments
Labels
service-api This issue is due to a problem in a service API, not the SDK implementation.

Comments

@kliakos
Copy link

kliakos commented Mar 25, 2020

On 1.11.678 release, the EC2CredentialsUtils was replaced with InstanceMetadataServiceResourceFetcher.

A call to EC2MetadataUtils.getInstanceInfo() which used to last a few milliseconds, now takes a few seconds! On 1.11.678 it takes 10 seconds to respond, while on 1.11.749 it is quite better, but still it takes 2 seconds.

Is this something related to Metadata Service Version 2, or the SDK itself? If this is by design the way it works and the latency issue can not be fixed, we should at least be given the option to use the v1 service via the SDK.

@kliakos
Copy link
Author

kliakos commented Mar 25, 2020

Moreover, nothing was mentioned about this modification on the 1.11.678 release notes.

https://github.com/aws/aws-sdk-java/blob/master/CHANGELOG.md#111678-2019-11-19

@kliakos
Copy link
Author

kliakos commented Mar 25, 2020

Tried aws-sdk-java-v2, but with no luck. Still the EC2MetadataUtils.getInstanceInfo() takes a second at least.

@debora-ito
Copy link
Member

Hi @kliakos yes, this is related to the Instance Metadata Service V2 change, we have multiple reports of increased latency when calling the new service. We've opened an internal ticket to the EC2 team behind the Metadata Service and they are investigating.

Not mentioning this change in the CHANGELOG was a miss in our part.

I'll update here when we hear back from the EC2 team.

@debora-ito debora-ito added the service-api This issue is due to a problem in a service API, not the SDK implementation. label Mar 25, 2020
@ffeltrinelli
Copy link

Hi! Any updates on this one? I'm also having intermittent latency issues (sometimes reaching the non-configurable 1sec read timeout) while the SDK is fetching credentials from IMDS.

@kliakos
Copy link
Author

kliakos commented Mar 31, 2022

Has there been any improvement with this issue? I tried 1.12.189 and the latency seems to be around the area of ~1sec.

@ffeltrinelli
Copy link

Hi! I talked about this issue and described our custom solution in this article.

@kliakos
Copy link
Author

kliakos commented Apr 16, 2022

Hi! I talked about this issue and described our custom solution in this article.

EC2MetadataUtils is just a getter-only util class with static methods. It doesn't accept an AWSCredentialsProvider, thus the solution of overriding it is not possible.

@debora-ito
Copy link
Member

There's no recent reports of IMDSv2 high latency, so I'll go ahead and close this.

If you are still seeing intermittent latency issues, please test a more recent version of the SDK 1.12.x, and then open a new fresh issue with repro steps.

Copy link

This issue is now closed.

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-api This issue is due to a problem in a service API, not the SDK implementation.
Projects
None yet
Development

No branches or pull requests

3 participants