DEV Community

Cover image for Building Batching Notifications Using MongoDB, Django, Celery and Sendgrid
Nik L.
Nik L.

Posted on

2 1 1 1

Building Batching Notifications Using MongoDB, Django, Celery and Sendgrid

What are Batched Notifications?

Batch notifications consolidate multiple individual notifications into a single message, delivered within a designated time frame. This approach differs from traditional systems that send a separate notification for each event, helping to reduce notification noise and enhance user engagement.

For instance, in a document collaboration app, rather than sending an email for every single comment, a batch notification system sends one email containing all comments made within the specified time window.

Designing a Batched Notification System

Aspect Batch on Write Batch on Read Our Approach
Method Accumulate notifications into batches as events occur, optimizing lookups. Periodically batch unsent notifications by querying them. Batch on Write
Performance More efficient with better performance and scalability. Can be less efficient as data volume grows. More initial effort required but offers better scalability.
Scalability Higher scalability due to real-time batching. Lower scalability, can be affected by data volume. Higher scalability

Database Design with MongoDB

Collection Description
notifications Tracks individual notifications.
notification_batches Tracks batched notifications.
notification_batch_notifications Links individual notifications to batches.

You can find the codes and implementation in this:
https://www.suprsend.com/post/building-a-batch-notification-system-with-mongodb-django-celery-and-sendgrid-for-developers


Do consider sharing that article on Hackernews, or giving us a star on the Github application.


Give a Star

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more