🐾Most frequently used Lambda anti-patterns🐾
🤓 While designing your event-driven workloads, you should take into account some anti-patterns that can spoil all the joy. I frequently see the following anti-patterns used in workloads.
Anti-pattern: Event generator + Lambda
Sometimes you use S3 events, EventBridge rules or SNS to trigger your Lambda function. If you don’t want to lose some of the events -- add SQS between them. You can lose events in case of Lambda throttling or failure.
Anti-pattern: Deduplication logic in Lambda
Instead of incorporating deduplication logic into Lambda function, use the FIFO SQS queue. It has only once delivery enabled, so it guarantees that you won’t have duplicates. Lambda function, on the other hand, can ensure that there is no duplicates in each batch it processes.
The other way to resolve the problem is to make Lambda function idempotent, so it can handle duplicate events.
Anti-pattern: SNS topic + one SQS queue
Sometimes fan-out pattern is slightly overused and SNS topics are used even if topic has only one subscriber. In case you don’t anticipate that you would have more subscribers in the future, it doesn’t make sense to use fanout pattern.
Thank you for reading, let’s chat 💬
💬 Do you encounter any other Lambda anti-patterns in your practice?
💬 Do you use Lambda functions in your data and ML workloads?
💬 Is there anything you don’t like about Lambda and want to change it?
I love hearing from readers 🫶🏻 Please feel free to drop comments, questions, and opinions below👇🏻