내용으로 건너뛰기

Lambda too slow for sending sqs messages

0

Hello,

currently we are using a lambda which is triggered by our s3 bucket and goes through each line of a file and sends it via SQS to another lambda to process that data.

Our issue is, that it takes to long. There could be up to millions of data which needs to be send via SQS, but it takes too long to send the sqs messages. We could use batching here but I think it wont help a lot because each data is about 40KB already.

I tried:

  • increasing RAM of lambda

  • running concurrent promises which sends SQS messages

Both approaches did increase the speed but not enough. (We can now process about 500k and then run into a 15min timeout by the lambda)

Is there any other way to increase the speed with aws lambda? or somehow pick up the line where the lambda timed out?

1개 답변
4

I would recommend a different approach. Instead of invoking a Lambda function when you upload a file to S3 and sending messages to SQS, start a Step Functions execution (send the S3 event to EventBridge and set the target to be Step Functions). The state machine will use a Distributed Map state to iterate over the lines in the file (if they are CSV or JSON), and will invoke a Lambda function to process the lines. You can use batches so that the Lambda function will be invoked on a batch of lines.

AWS
전문가

답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.