티스토리 뷰

WEB2.0/프로그래밍

sqs+lambda maximum concurrency

나를찾는아이 2025. 4. 10. 14:07
728x90
반응형

https://aws.amazon.com/ko/blogs/compute/introducing-maximum-concurrency-of-aws-lambda-functions-when-using-amazon-sqs-as-an-event-source/

 

Introducing maximum concurrency of AWS Lambda functions when using Amazon SQS as an event source | Amazon Web Services

This blog post is written by Solutions Architects John Lee and Jeetendra Vaidya. AWS Lambda now provides a way to control the maximum number of concurrent functions invoked by Amazon SQS as an event source. You can use this feature to control the concurren

aws.amazon.com

 

 

 

 

sqs와 lambda의 조합은 엄청난 양의 작업도 빠르게 병렬로 수행시키는 좋은 방법입니다.

 

sqs에 메시지를 발행하기만 하면 메시지를 수신하여 lambda 함수가 실행되기 때문에 매우 직관적입니다

 

 

하지만 너무 많은 lambda 함수가 실행되어서 실제 서비스에 부정적인 영향을 주는 경우가 발생할수 있습니다

 

lambda 함수는 해당 함수에서 호출하는 대상 서비스의 허용량을 알지 못하기 때문에

 

메시지 만큼 무한정 증가할 뿐입니다

 

 

이때 maximum concurrency 를 사용하면 lambda 함수의 동시 실행 갯수를 조정할수 있습니다

 

 

 

지정한 갯수를 넘어가지 않기 때문에 좀더 안정적으로 메시지를 소비할수 있습니다

 

 

 

2~1,000까지 값을 지정가능하며

 

비활성화하려면 값을 비워두면 됩니다

 

 

serverless의 설정으로는 이렇게 설정할 수 있습니다

 

functions:
  onlyOneOrTwo:
    handler: handler.preprocess
    events:
      - sqs:
          arn: arn:aws:sqs:region:XXXXXX:myQueue
          maximumConcurrency: 250
728x90
반응형
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2026/10   »
일 월 화 수 목 금 토
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함