Register Now


Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Add question

You must login to ask a question.


Register Now

Lorem ipsum dolor sit amet, consectetur adipiscing elit.Morbi adipiscing gravdio, sit amet suscipit risus ultrices eu.Fusce viverra neque at purus laoreet consequa.Vivamus vulputate posuere nisl quis consequat.

What configuration options can be adjusted to reduce the latency?

# Reducing AWS Lambda Triggered by SQS Latency

There are a few configuration options that can help reduce latency when using an Amazon SQS queue as a trigger for an AWS Lambda function:

  1. Increase the batch size – The default batch size is 10 messages. Increasing the batch size can reduce the number of Lambda invocations, which in turn reduces latency. You can configure a batch size of up to 10,000 messages for standard queues and 10 messages for FIFO queues.
--batch-size 100
  1. Increase the batch window – The default batch window is 0 seconds. Increasing the batch window allows Lambda to collect more messages before invoking your function. This can reduce the number of invocations and latency. You can configure a batch window of up to 20 seconds.
--maximum-batching-window-in-seconds 20
  1. Use long polling – Configure long polling on the SQS queue to reduce empty receives. Lambda will wait up to 20 seconds for a message before timing out. This avoids unnecessary latency from empty receives.
  2. Increase the queue’s visibility timeout – The visibility timeout should be at least 6 times your function’s timeout plus the batch window. This gives Lambda enough time to process batches and retry on errors.
  3. Reduce the function’s timeout – A shorter timeout can help reduce latency for each invocation. However, you’ll need to balance this with having enough time to process large batches.
  4. Configure maximum concurrency – Setting a maximum concurrency limit can help limit the number of concurrent Lambda invocations from an SQS trigger, which may reduce latency.
  5. Enable partial batch responses – Partial responses allow your function to report specific failures in a batch. This can avoid reprocessing the entire batch and reduce latency.
ALSO READ  How to Set Up an EKS Cluster with eksctl command line

Hope this helps! Let me know if you have any other questions. I tried to cover the main configuration options that can impact latency when using SQS as a Lambda trigger.



About Abhay Singh

I'm Abhay Singh, an Architect with 9 Years of It experience. AWS Certified Solutions Architect.

Follow Me

Leave a reply