Coconote
AI notes
AI voice & video notes
Try for free
Designing a Scalable Notification Service
Sep 3, 2024
System Design: Notification Service
Introduction
Objective
: Design a notification service for web services.
Scenarios
:
Card transaction exceeds a limit.
Service monitoring detects faults.
Publisher
: Produces messages.
Subscribers
: Receives messages.
Challenges
of synchronous communication:
Scalability issues.
Hard to extend.
Proposed Solution
Asynchronous System
: Allows many publishers and subscribers.
Functional Requirements
:
Create a topic.
Publish a message to a topic.
Subscribe to receive messages.
Non-Functional Requirements
:
Scalability, maintainability, testability.
High availability, fast delivery, durability.
Architecture Overview
Load Balancer
: Distributes requests.
Frontend Service
: Initial request processing.
Metadata Service
: Caching layer, separation of concerns.
Message Storage
: Temporary storage for delivery.
Sender Component
: Retrieves from storage and sends to subscribers.
Detailed Component Analysis
Frontend Service
Responsibilities
: Validation, authentication, SSL termination, encryption, caching, throttling, logging.
Reverse Proxy
: Handles SSL, compression, response handling.
Local Cache
: Reduces calls to metadata service.
Logging and Metrics
: Service health, performance monitoring.
Metadata Service
Role
: Stores topics and subscriptions.
Distributed Cache
: Consistent hashing ring, no coordinator or with coordinator.
Temporary Storage Service
Purpose
: Fast, available, scalable message storage.
Options
:
SQL vs NoSQL (e.g., Apache Cassandra, Amazon DynamoDB)
In-memory (e.g., Redis)
Message queues (e.g., Apache Kafka, Amazon Kinesis)
Sender Component
Message Retrieval
: Pool of threads, dynamic scaling with semaphores.
Metadata Calls
: Retrieves subscriber info.
Task Processing
: Splits delivery tasks for parallel processing.
Additional Considerations
Spam Prevention
: Subscriber confirmation, deduplication.
Retry Policies
: Delivery retries, subscriber responsibility for duplicates.
Message Order
: No guaranteed delivery order.
Security
: Authentication, encryption, SSL, monitoring.
Monitoring and Metrics
: Track message state and system health.
Evaluation
Scalable
: Horizontally and vertically scalable components.
High Availability
: No single point of failure, deployed across data centers.
Performance
: Fast processing, efficient task management.
Durability
: Redundant data storage and message retries.
Conclusion
Comprehensive design for a notification service.
Addressed both functional and non-functional requirements.
Encouraged to explore more on monitoring and specific storage solutions.
📄
Full transcript