- Newest
- Most votes
- Most comments
This sounds like a timeout issue related to how long the connection stays open during large downloads. Even with increased read_timeout, AWS Batch jobs may still hit retries if there’s network variability or if the connection is throttled.
You might try increasing both read_timeout and connect_timeout further, or use TransferConfig with multipart download.
Also, double-check if the batch job role has limits on outbound bandwidth.
When downloading large files (>4GB) in AWS Batch jobs, several factors could be causing your "Max Retries Exceeded" error:
-
Timeout settings: Your current configuration has a read_timeout of 60 seconds, which is likely insufficient for downloading files larger than 4GB. For large files, consider increasing this value significantly (to several minutes) to accommodate the longer download time.
-
Network throughput: Large file transfers can be impacted by network constraints. The r4.8xlarge instance should have good network performance, but there could still be bandwidth limitations when transferring from Cloudflare R2.
-
Connection stability: When downloading large files, the connection needs to remain stable for a longer period. Any network fluctuation can cause the download to fail.
-
Chunking approach: For files larger than 4GB, consider implementing a chunking strategy where you download the file in smaller segments and then reassemble them. This can help manage memory usage and reduce the impact of potential failures.
-
Retry strategy: Your current configuration only attempts 3 retries. For large files, you might want to increase this and implement an exponential backoff strategy.
Try modifying your configuration with these settings:
config = Config(
signature_version='s3v4',
retries={'max_attempts': 10, 'mode': 'adaptive'},
connect_timeout=30,
read_timeout=600, # 10 minutes
)
Additionally, you could implement a multipart download approach using the boto3 S3 transfer manager, which is designed to handle large file transfers more reliably by breaking them into smaller chunks.
Sources
AWS Batch job, FFmpeg video encoding issues. | AWS re:Post
Downloading multiple images | AWS re:Post
Accessing S3 Objects takes time | AWS re:Post
Relevant content
- asked 6 months ago
- asked a year ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 3 years ago
I fixed the problem by using chunks download. Thanks for your answer