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?