# SIDDHARTH PANIGRAHI | R2 | 8 yrs exp
-
# Question 1: Current System
Eatsure - website, android and ios application
User -> type his location / provide the access
Apps -> WAF -> Public ALBs -> Apigateway -> private ALBs -> AWS ECS -> Geo, d2c_storefront (3, 5 to 8/15 (6GB RAM)) :: Elasticache Redis
Airbrake, Datadog, ELK
CMS -> MySQL (AWS aurora - 3R:1W) (S3 - static JSON menus)
api gateway ->
geo service -> google/ map my india apis -> get a lat long for this user
# Question 2: HLD
click -> events.
Clevertap -
- low latency
- high traffic
Functional reqmts -
onbaording clients and storing info
Capturing events (client id, user_id, EVENT_Tag, timestamp) -> store
Assumptions
Clients = 1000
End_users = 1000 M -> DAUs = 25M
Events -> 2500M = 2.5B events
each event => 100 bytes
storage = 2.5 * 100 * 365 * 3 = 273750 B bytes = 273750 GB = 275 TBs
write-heavy = unstructured, append only => no SQL -> cassandra
Qps ->
Active users per second = 25M/ 86400 = ~300 users
3 events per second -> 900 events ps
QPS = 900;
3.2 M users/hour
Load balancers -> gateway service (ECS, 5-10 servers) (auth, data cleaning) -> Queue (Kafka) -> storage service (write data to DB)
-> analytics service (perform queries) -> read from DB
Gateway -> Redis (token storage)
3.2m * 10 * 3 = 96 million events per minute
10 Queues - replication of 3
1 consumer (6gb ram) -> in a minute 1000 MB => 10000 events/minute
no of servers - 9000 -> distribute geographically :: zones in which users lie
client wise partition :: client - user distribution -> allot a zone
async replicate data to read DB (partition by client zone)