- Newest
- Most votes
- Most comments
Thank you for bringing this issue to our attention. However, this is not a bug, but rather a result of how AWS Fargate allocates resources for containers.
When you specify memory requirements for an AWS Batch job running on Fargate, you're actually setting a minimum memory allocation. Fargate then rounds up this allocation to the nearest supported configuration. In your case, specifying 16384 MB (16 GB) of memory results in Fargate provisioning a task with 32 GB of memory, which is the next available tier.
This behavior is by design and ensures that your container has at least the amount of memory you requested, if not more. However, it can lead to unexpected results when applications like DuckDB automatically scale their resource usage based on available system memory.
To address your specific issue with DuckDB, you have a few options:
-
Adjust your resource requirements: You could lower your memory request to 15 GB, which would result in Fargate allocating 16 GB instead of 32 GB.
-
Configure DuckDB: Instead of relying on DuckDB's default behavior of using 80% of available memory, you can explicitly set DuckDB's memory limit to match your intended usage (e.g., 13 GB if you originally wanted 16 GB).
-
Use container-level memory limits: You can set a memory limit for your container that matches your intended usage, preventing DuckDB from seeing the full 32 GB allocated by Fargate.
Remember, when using Fargate, both memory and vCPU requirements must be specified using supported values in the resourceRequirements section of your job definition. For example:
"resourceRequirements": [ {"type": "MEMORY", "value": "16384"}, {"type": "VCPU", "value": "2"} ]
This approach ensures that you're explicitly defining your resource needs within the constraints of Fargate's supported configurations.
Sources
Job definitions on Fargate - AWS Batch
ContainerProperties - AWS Batch
answered 2 years ago
Relevant content
asked 3 years ago
asked 5 years ago
asked 5 years ago
- AWS OFFICIALUpdated 5 months ago
