Sai Umesh

Designing and Scaling Notification Systems

2 min read

Notifications are an integral part of numerous applications, serving a variety of purposes. Now, let’s delve into the diverse system designs available for implementing a robust notification system.

Design - 1

image info

The previous design suffers from limitations such as synchronicity and inadequate scalability, especially when faced with a large number of notifications to process. Now, let’s explore alternative designs that address these challenges and offer improved performance and scalability.

Design - 2

image info

The above design demonstrates commendable scalability and asynchronous functionality. However, it does suffer from a notable issue: the Lambda function carries out two distinct tasks. It is responsible for updating DynamoDB while also pushing data to SQS. In the event of a failure during either of these operations, it can lead to inconsistencies between the two systems, which poses significant challenges for debugging and maintaining data integrity. This problem is commonly referred to as the Transactional Outbox issue.

Design - 3

To address the aforementioned issue effectively, we can implement a solution utilizing DynamoDB Streams. By leveraging DynamoDB Streams, each resource can be assigned a singular task, significantly reducing the chances of inconsistencies between systems. This approach helps ensure a more robust and reliable notification system, enhancing data integrity and simplifying the debugging process.

image info

Sources

  1. Transactional outbox - here
  2. DynamoDB Triggers - here and Handling failures here

Sai Umesh

I’m Sai Umesh, a software engineer based in India. Working as a DevOps engineer.