0

I'm having a Microservice Architecture completely build around AWS Lambda, also including a producer/listener which is loosely-coupled via SQS to the business lambda functions. It's working nicely via following approach:

  • lambda has a reserved concurrency of 1
  • gets triggered every 1 minute via CloudWatch Events: as the max concurrency is 1, if one instance is running, there won't be a parallel invocation if a function is already provisioned
  • if the function approaches the timeout of 15 minutes, it will shutdown itself gracefully

I did not experience any troubles yet & the solution is really cost-efficient but as you probably already noticed, there's at least one major downside: the consumer/producer will be "offline" for up to 1.x minutes (next CloudWatch invocation could take up to 59s + bootstrapping the producer/listener) every ~15 minutes (max execution time for Lambda).

I'm not having any hard real-time requirements, but I'm sure there's a better approach or improvements without switching to running a container in ECS, what I really want to avoid.

What are my options?

tpschmidt
  • 2,479
  • 2
  • 17
  • 30

2 Answers2

0

I can recommend from your SQS you can subscribe to SNS topic and from your SNS you can subscribe your lambdas, this was you can leverage SNS capabilities of 30k transactions per second.

Dharman
  • 30,962
  • 25
  • 85
  • 135
0

Why do you want to implement your own consumer/listener for SQS? One of the best parts of FaaS is its native integration with event sources like SQS. So just hook up your function with SQS.

https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#events-sqs-eventsource

If you want to use lambda to consume Kafka, the integration is also available, https://aws.amazon.com/blogs/compute/using-self-hosted-apache-kafka-as-an-event-source-for-aws-lambda/ .

wanghq
  • 1,336
  • 9
  • 17