0% found this document useful (0 votes)
22 views24 pages

Notification System Design Guide

Uploaded by

Tanisha Jaiswal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views24 pages

Notification System Design Guide

Uploaded by

Tanisha Jaiswal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Notifilation Systems

DSA optimization
System Design
Coherent E R
Low Level Design
microseerias
dataflow
fault folinara

man

5
step approach to any design problem

Problem Statement

d
mints
Non functional Requirements pungusing
Scale Estimation

Design
Problem

Notification System generic notifications Ehotsopp

email
app

Scaler Toy Store


Edulation Company E Commerce
Company

notification is NOT
their com business
com business
something else

notifinations
just a feature

SAAS
Notification.com

com offering Notification SAAS

tons of clients
clients have users
v
high user count

v
high volume

lotsof features
functional Requirements MVP features
Minimal Viable Product

Notification
any sitall content that we wish to
send to a user via some means
text
fishing
sms whatsapp
appt
flexible

clients can send


notification to
company Efface
person
bankend Seth
Notification SAAS
0
client

Post
notify t
sin id
Film
f

scheduling
System should
support multiple channels
Whatsapp sms email in app
Must be
pluggaber extensible seamlessly add
mom channels
slack call
without changing
the architecture

clients should be able to BROADCAST


to Notifications
multiph users
scam
Masterclass 100
uses

Twitter
ElonMusk 100m
Tweets
1
using

Post
notify Pi key client id success 2
fittings fair

Note providing
list of use ids in API call is bad design
Client should be able to manage their user list
Hidden
Feature
Scaler

Notification SAAS

Ip uses
managent service

iiify.in I
Ola

Rate Limiting

Notifiratie SAAS

Ola
clients sens

client limits Quota limits


based on the purchase
type
fro 500
notification day
basic 50 000
team
50,000
additional than
Enterprise unlimited
User side limits

no user
should reciene too many notifications

users should be able to


customize their
notifiction subscriptions
sensitive critical OTP emergency
alerts
marketing

channel email

app
push notifiction

SAAS

Observability

detect something 2020 4 10M


is
wrong servers
diagnose the issue google

fix Observability

verify the fix is


working

notifications sent client day


type channel
exceptions how
logs
Search
analytics

Non functional Requirements DesignGoals

Compliance

TRAI

Very strict rules on what Sms phone calls we


can send

email providers SMTP own rules

Priority should be considered


OTPs v high priority notify
3
promotions
lowest
priority

4m
High Availability
fault tolerant
Reliable
backups retry mechanism

Low latency

Single delivery Idempotency


we have an auto
retry mechanism
7S.it r
difficult
leave it to
to do
tonnectly
a
security expert

Seals Estimation

100 users
only no need
8 MLD
Scale natters

Total It uses a 2B B 109


cross all clients

avg notifications usu 10


day
Aug notifications see 2 10 uts t t

200,000 s

2 109 to

24 60 60
seconds
86,400seconds
1 105seconds

seconds

2x 105notifiction
sec
Iii
Peak 10 M notifications sec
f
Ii

50

hour

2 105 avg notifiction see 50

10 M notifications our
see system should be
able to handle
this
System Design

multiple concepts Auth


API
gateway
Bokes

Scaler HLD Curriculum

How backend
systems work
DNS ventral
vs horizontalscaling load balancing
Shanding

Load
Balancing Consistent
Hashing
Healthcheck
Heartbeat Roll over
Dns as loadbalancer
Untrusted
Consistent Layer
hashing deepdive

Caching
Browser
CDN Backend
Local vs
Global Single vs Distributed
Redis
Cache
Invalidation through

Write
back
Write Around
Cache Eviction
FIFO
LRU

Caching Case
Studies
Scaler Code ScalesLeaderboard
Judge
Facebook
News feed

CAP theorem
Replication
Availability Consistency Partition Tolerance
immediate
Trentual
CAP theorem PACELC
Master slave

vegan
Tunable Consistency Quorum

SQL vs
NoSQL
Pros Cons
Shanding
key
N 502 Types
ÉÉhhfmm
YTemory
Search
timestries
File store

Database
Internals
Orchestrator
ConfigManagement
Reserved fevers
Shand Creation
Multi master
Database Internals

LSM Trees Bloom


Filths Sparse Index
Compaction Mentaber WAL

Case
Study Google Typeahead
Aries Redis
Recency Sampling
Batching Personalization
Case
Study Messaging
apps
Slack
groups Whatsapp Facebook messenger

Case
Study Kafka 700keeper
event driven
architecture Pub
Sub
topics partitions
Msg order
Case
Study Elastin Search
Invented Index
TF IDF
Shanding Tunable
Lotenig
Case
Study File Storage
upload download
chunking

Case
Study Uber
Quad True
traffic patterns meanestdriver

Case
Study Rate
Limiting
DDos Token
bucket
Leaky Bucket Slidingwindow

Case Id
Study generation
idempotency Unique incremental

Case
Study Video Streaming

Netflix Youtube Hotstar


concurrency
ABS
chunking DNS

Microseevius

Monolith vs Microseering
vs Service
Oriented
Breaking a
Monolith
Observability Distributed
Tracing
Logging
Thundering herd
Cascading
failure Circuit
Breaker
Distributed
Transactions

TwoPhan Commit
Saga CARS
Orchestration
Choreography
Event
Sourcing
g
SDE 3 60 LPA 1.2in base
googa
stocks Perforce bonus
Heath benefit
India Pune
Hyd Bangalore

Senior Architect
Principer Engineer
g of
1 n
Ber base

8 57 9 15 Break
System Architeture

clients should be able to send notifications


notify api key usn.in
soso.tt
system should support
multh channels

Sms msg hello iron info


email subject Hi body Hello attachff
Hello action
3 app msg open rewards

Notification SAAS
Firewall
Eating notify
clients Produces

senders

in
s
I

ITT.IT
Louda

users Lq D
feciepients Sms Email Whatsapp

Then Trusted VPC


layer
virtualPrivatCloud
Authentication
untrustedlager
Auth
only
Authorization
at every service

Shaitan
Msg Queue
IServin Dision
Event driven JANNO
1
Shock absorbers

and

Users should be able to customize their


notification preferences

system must respect the Usn


settings

Notification SAAS
user
clients finewI.EEg
preference mgmt

Authentication
too

I'mL
4ada
gz
users
Seciepients
Ideal DB for user preferences

Strengths weaknesses

1 thigh
Etf
Postger MySQL don't scan
well
B2 RDS hanud shanding

Key value simper


fast No relations
Redis had complex datamodeling
Mensache is
notpossible
Dynamo DB no search
No transaction
simple queries

document nested
no
globalindex
Mongo firebase slow writes
flastinSearch Conna
misstYffham
search
no
joins relations
cockroach A
powerful index D transaction
Iguen

wich column aggregat no relations


analytics
Cassandra v
fast curity
Paginandbytime
no ALID
scylla
Hbase reading wide now is
BigTable slow

file Story vector db


graph
db
2B
of 1 Kb to 2B this data
pfy
ITB
Can be stand on a

single server
mad v
high 10m21s
write low

Too much data Shard

700 Cache
many reads
Read Replicas improves reads
but worsens
writes
Too Shand
many curites you have write
Sample Batch mon than once

Prevent data loss


Replicate
Notification SAAS
Firewall
Eating notify
clients
sender
i.ci ENtEnaiEnpntm
If
db

EE ing
IFT.IT
Loada
fatty
users D
Seciepients Sms Email Whatsapp

fan out notification service

for each notification


mg tan
Read the channels from

request payload
0 out
get user id
fetch preferences
for user pref db

filth out channels based on user


pref
broadcast messages on
fo ead channel
to Msg Q
To separate user db
for prefmanagent service use
notification service
Opg
Message Queue

Persistent store notifinations on disk


temporarily

to ensure
notifination delivery

support offsets to ensure


single delivery

Scale
partition
partition
key
partitiokey
client id chain

consumers
msg by on channel
same client based
maintain under
client should be able to broadcast
msgs

client managent service

00
of
IX
broadiast notifiction

to filter Elastic
Search

fviam.gg
notificot

Ratelimiting

generic DDoS protection untrusted


lay
client
don't exceed purchased
Quota

User
don't spann
user
Notification Saas
a
clients
and
fi EfE.iIfTEin
Load
giant
users
clientdb
recipients

Observability

aggregate logs from all stevers

Search on logs

analytics alerts dashboards monitor

ELK stack

analytics

search
Elastic Search

Log Stash
Kibana

Design Problems an open ended

Rate limiting
algos
Event Driver and't

Celebrity Problem

Elon Musk 200m


follow
Mr Deast 300M
subscribe

separate infra for celebrities

Twitter

Bypass the issue

Subscribe
Motifination
Bell iron
fit
not

You might also like