- Newest
- Most votes
- Most comments
Hi,
The 1 minute mentioned here is really close to the default boto3 connection timeout which is 60 seconds. I think what's happening here is that the client which is using boto3 tries to connect to the Polly endpoint but is unable to do so due to intermittent/transient networking issues. These are normally resolved by retrying the request. In the case of Boto3, it has to wait for 60 seconds before retrying the request again.
You can enable boto3 debug logs and follow the steps here in this documentation to check if all of the instances that are taking more than 1 minute is due to retries -> https://boto3.amazonaws.com/v1/documentation/api/latest/guide/retries.html#validating-retry-attempts
Please read this page for more information about this -> https://aws.amazon.com/premiumsupport/knowledge-center/lambda-function-retry-timeout-sdk/. This mentions Lambda but it can occur to any client which is invoking any AWS API via the SDK.
You can update the default boto3 settings by following the example in the above article
# max_attempts: retry count / read_timeout: socket timeout / connect_timeout: new connection timeout
from botocore.session import Session
from botocore.config import Config
s = Session()
c = s.create_client('s3', config=Config(connect_timeout=5, read_timeout=60, retries={'max_attempts': 2}))
The idea here is to "fail fast" and ensure that boto3 times out quickly and retries the request immediately instead of waiting for the default timeout. Please make sure that the connection timeout is around 3x your expected or normal timeout to ensure healthy requests are not considered as timeouts.
That said, this behavior should only happen for a small number of requests. If a large number of your requests are experiencing timeouts or if the requests are taking more than 60 seconds without any retries then I would recommend logging the RequestID's and creating a support case with us so that a log dive can be performed on these requests.
Relevant content
- Accepted Answerasked 2 years ago
- asked 2 months ago
- asked a year ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 3 months ago
Thank you Ryan. It makes sense. will definitely do as you propose . Thank You