- Newest
- Most votes
- Most comments
Are you scheduling all the 5000 schedules for the exact same time? Are you setting a FlexibleTimeWindow? If you are, this means that EventBridge will not trigger the events exactly at the time specified, but will distribute the invocations.
Why are you scheduling 5000 schedules for the same time? What are you doing there? Why not distribute them all over the hour?
Based on your observations, there are a few key factors that could explain why your Lambda functions consistently take 50 seconds to complete execution regardless of the number of invocations:
-
EventBridge Scheduler precision: EventBridge Scheduler does not provide second-level accuracy. It invokes targets with 60-second precision, which means there's inherent variability in when your functions actually start executing.
-
Lambda execution environment behavior: Each Lambda execution environment processes one event per invocation. When your Lambda function receives a batch of events, it processes them sequentially within that single environment. This means that even if you have high concurrency available, the actual processing might still be sequential within each Lambda instance.
-
Concurrency utilization: You mentioned that with 5000 schedulers, you're only seeing about 60 concurrent executions, and with 100 schedulers, you're seeing about 6. This suggests that your Lambda functions are scaling proportionally to the workload (roughly 1% of the total invocations are running concurrently), but they're not utilizing your full available concurrency of 1000.
-
Batch processing limitations: Even though your individual function execution time is very fast (10ms average duration), when processing multiple invocations, Lambda might be waiting for the batch window to complete before finalizing all executions. This could explain the consistent 50-second completion time regardless of batch size.
-
Post-processing phase: Lambda increases the concurrency counter when a function is invoked and decreases it only when the function returns a response. There's also a post-processing phase that counts toward total concurrency. This could be contributing to the consistent execution time.
To improve performance, you could:
- Consider implementing parallel processing within your Lambda functions to better utilize resources
- Adjust batch window settings if you're using batching
- Investigate if there are any bottlenecks in your MSK cluster that might be limiting throughput
- Monitor the PostRuntimeExtensionsDuration metric to see if extensions are causing delays
The fact that you're seeing similar execution times regardless of invocation count suggests there might be a fixed overhead or constraint in your processing pipeline that's independent of the number of events being processed.
Sources
Why does my AWS Lambda function, triggered by an Event Bridge scheduler at 9:15 AM daily, consistently start processing 43 seconds late, despite similar functions executing almost instantly? | AWS re:Post
SQS Lambda Batching | AWS re:Post
Troubleshoot high concurrency on a Lambda event source | AWS re:Post
Efficiently processing batched data using parallelization in AWS Lambda | AWS Compute Blog
answered a year ago
Relevant content
asked 10 months ago
- AWS OFFICIALUpdated 4 years ago
- AWS OFFICIALUpdated 4 years ago
- AWS OFFICIALUpdated 8 months ago

Hi Uri
Are you scheduling all the 5000 schedules for the exact same time? Are you setting a FlexibleTimeWindow?
Yes, I am scheduling 5000 schedules at the same time and with FlexibleTimeWindow off
Why are you scheduling 5000 schedules for the same time? What are you doing there? Why not distribute them all over the hour?
Each of the 5,000 schedules carries a custom message payload that must be processed and sent to its specific user. The architecture handles 5,000 unique events, not a single event fanned out 5,000 times. The requirement explicitly prohibits distributing the workload over a wider time frame. All messages must be processed and sent at the same designated time to meet user expectations. To enforce this precision, the FlexibleTimeWindow feature in AWS EventBridge Scheduler is intentionally disabled.