Ravish Mallya
07/16/2025, 7:58 AMMarvin
07/16/2025, 7:58 AMMarvin
07/16/2025, 8:01 AMbash
prefect work-pool create "my-ecs-pool" \
--type ecs \
--concurrency-limit 7
b. Queue Level: You can also create multiple queues within your work pool and set concurrency limits per queue:
bash
prefect work-pool queue create "my-queue" \
--pool "my-ecs-pool" \
--concurrency-limit 7
2. ECS Task Definition Settings:
Make sure your ECS task definitions accurately reflect your resource requirements:
- CPU: 0.25 vCPU = 256 CPU units
- Memory: 400MB = 400 MiB
3. Worker Settings:
When starting your worker, you can specify how many jobs it should process concurrently:
bash
prefect worker start --pool "my-ecs-pool" --limit 7
The key points to remember:
- Jobs that exceed the concurrency limit will automatically queue up and wait for resources to become available
- Failed jobs due to resource constraints will be retried according to your retry policy
- You can monitor queued runs in the Prefect UI or using the CLI
- Consider using auto-scaling policies in your ECS cluster to handle increased load
To verify the current status of your work pool and queues:
bash
prefect work-pool ls
prefect work-pool queue ls "my-ecs-pool"
Additional Recommendations:
1. Monitor your worker logs to ensure it's not getting overwhelmed
2. Consider implementing flow-level concurrency limits for specific flows that might be resource-intensive
3. Use tags to route different types of jobs to different queues based on their resource requirements
Would you like me to provide more specific details about any of these approaches or help you implement a particular solution?Ravish Mallya
07/16/2025, 8:05 AMMarvin
07/16/2025, 8:05 AMMarvin
07/16/2025, 8:06 AM--limit
flag when starting the worker:
bash
prefect worker start -p "your-pool-name" --limit 7
This ensures the worker won't process more than 7 jobs concurrently.
b. Using work pool concurrency limits:
bash
prefect work-pool create "your-pool-name" --type ecs --concurrency-limit 7
This limits the entire work pool to 7 concurrent jobs.
c. Using queue-specific limits:
bash
prefect work-pool queue create "your-queue" \
--pool "your-pool-name" \
--concurrency-limit 7
3. Best Practice:
For your t3.medium scenario, you should:
- Set a worker limit to 7 jobs (matching your calculated capacity)
- Set a work pool concurrency limit as a backup safety measure
- Monitor the worker's resource usage to ensure the limits are appropriate
Without these limits, yes, the worker will keep accepting new jobs as they come in, which explains why you're seeing crashes when submitting more jobs than the instance can handle.
Would you like me to explain how to implement any of these limiting approaches in more detail?