How to get concurrency up for lambda triggered by MSK serverless?

0

Hi there!

I have a lambda function triggered by a kafka topic from an MSK serverless cluster. I am adding thousands of messages at a time in very short bursts (~7000 messages in each batch) and am noticing that the concurrency of the function stays at basically 3 for a few hours to process the events. Is there any way to increase the concurrency/throughput to have them done in a few minutes?

Thanks!

Bob
asked 7 months ago442 views
2 Answers
0
Accepted Answer

Lambda concurrency with MSK is described here. As you can see, we start with concurrency of 1 and we increase it when the load is higher. To preserve order, we do not go above the number of partitions. This means that if you want to process the messages quicker, you will need to increase the number of partitions in your stream.

You could also increase the batch size and handle the messages in multiple threads, but that may break the order of messages.

profile pictureAWS
EXPERT
Uri
answered 7 months ago
0

Hi Bob, I hope you are doing great today. I understand that you are sending over 7000 messages to an MSK serverless cluster which are then processed by AWS Lambda. Your problem is that it takes up to 3 hours and the concurrency doesn't go above 3.

One of the things you can try is to increase the batch size and batch window from your trigger configuration. A smaller batch size and batch window will cause an increase in the amount of requests going to the lambda. Keep in mind If you go over the default quota for your account, you might need to request the increase or adjust the trigger configuration to get a proper processing time/concurrency that make sense for your business. Please, take a look in the following blog post for MSK and Lambda trigger [1] configuration and explanation.

I hope this information is helpful.

Have a great week!


Introducing AWS Lambda batching controls for message broker services

[1] https://aws.amazon.com/blogs/compute/introducing-aws-lambda-batching-controls-for-message-broker-services/

profile pictureAWS
EXPERT
Sercast
answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions