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

Set a timeout value for the AmazonS3Client #163

Merged
merged 3 commits into from
Sep 6, 2022

Conversation

rmt2021
Copy link
Contributor

@rmt2021 rmt2021 commented Sep 4, 2022

I found this in the AWS S3 document https://docs.aws.amazon.com/sdk-for-net/v3/developer-guide/retries-timeouts.html:

The AWS SDK for .NET enables you to configure the request timeout and socket read/write timeout values at the service client level. These values are specified in the Timeout and the ReadWriteTimeout properties of the abstract Amazon.Runtime.ClientConfig class. These values are passed on as the Timeout and ReadWriteTimeout properties of the HttpWebRequest objects created by the AWS service client object. By default, the Timeout value is 100 seconds and the ReadWriteTimeout value is 300 seconds...
The versions of the AWS SDK for .NET that target the portable class library (PCL) and .NET Core set Timeout to the maximum value for all AmazonS3Client and AmazonGlacierClient objects.

So the AWS SDK will set the largest integer as the timeout by default. Currently, we will always wait for the response to come, which will make the SDK API unresponsive and decrease the efficiency. Even worse, if the response is lost during its delivery, we will wait there forever. In this regard, I manually set the timeout of AmazonS3Client as 10 seconds.

@emgarten
Copy link
Owner

emgarten commented Sep 6, 2022

Good catch on the SDK, these calls need to timeout.

I'm worried that 10 seconds will be too low for someone running this from a slow network.

When running within the same AWS region 10 seconds should be more than enough.

Let's try to find a balance on this. How about setting it to 100 (similar to .NET desktop) and/or making the timeout a config value so it can be adjusted if needed?

@rmt2021
Copy link
Contributor Author

rmt2021 commented Sep 6, 2022

Thanks for the suggestion @emgarten ! I think it makes a lot of sense.

I have enlarged the timeout to 100 seconds.

Copy link
Owner

@emgarten emgarten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks the improvements! 💯

@emgarten emgarten merged commit 4daf3f3 into emgarten:main Sep 6, 2022
@emgarten
Copy link
Owner

emgarten commented Sep 6, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants