I'm curious about how AWS Lambda functions handle load balancing when they have multiple triggers, like two different SQS queues. For instance, if Queue A has a batch size of 10 and Queue B has a batch size of 5, will the events from Queue A be processed faster than those from Queue B? Does anyone have insights into how the polling for events is balanced in such cases?
2 Answers
Each SQS queue has its own set of pollers, meaning their operations are independent. What happens in one queue won't affect the other unless your function is limited by concurrency. So, you should see Queue A and Queue B processing without impacting each other's performance.
There's a listener that operates in the background and uses long polling to check for events. When it finds something, it triggers the Lambda function. There’s a slight delay with invoking the Lambda, but it’s pretty minimal—just a few milliseconds. The overall timing includes polling, invoking, processing the events, and reporting back, which means that if processing a batch takes a significant amount of time, the overhead from polling becomes less critical. But honestly, it's essential to assess whether these overheads significantly affect your system's performance. If your workload is manageable, sometimes keeping the batch size to 1 is better for simplicity and reliability.
Related Questions
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically
[Centos] Delete All Files And Folders That Contain a String