System design kaise badhta hai: 100 users se 10 lakh tak, monitoring ke saath
System design ek baar mein nahi banta, load ke saath badhta hai. Day 1 par monolith (ek app server + ek database) bilkul sahi hai, bas monitoring pehle din se lagao: OpenTelemetry (traces + metrics), Prometheus (metrics + alert rules), Grafana (dashboards + alerts) aur Jaeger (trace waterfall). Phir har bottleneck alert se pakdo aur sirf uska fix lagao: slow page par Redis cache (cache-aside), traffic badhe toh load balancer ke peeche kai stateless servers (sessions Redis mein), request mein slow kaam ho toh queue (RabbitMQ) aur background workers, database par reads bahut hon toh read replicas aur static files ke liye CDN, aur team badi ho jaaye toh microservices + API gateway. Video ke numbers hamare demo app DemoKart ke hain. Martin Fowler ka MonolithFirst bhi yahi kehta hai: kaamyaab microservices zyadatar ek bade monolith ko todkar bane. Neeche har stage ka checklist hai: symptom, alert, fix aur verify, saath mein pg_stat_statements query, Prometheus alert ideas aur k6 load test.
Links
Aaj ye karo
- Day 1: monolith se start karo, ek app server aur ek database. Kafka, Kubernetes aur microservices tab tak nahi jab tak problem na ho.
- Monitoring Day 1 se: OpenTelemetry SDK app mein, Prometheus metrics ke liye, Grafana dashboards + alerts, Jaeger traces. p95 latency, CPU, error rate aur queue depth par alert.
- Slow page: Jaeger trace mein dekho time kahan gaya, pg_stat_statements se sabse mehngi query nikaalo. Fix: Redis cache (pehle Redis, miss par database, result cache mein).
- Traffic spike: sale se pehle k6 se load test. CPU alert ya failures dikhein toh 3 servers + load balancer. Login session Redis mein rakho taaki koi bhi server request le sake.
- Slow checkout: request ke andar email, SMS, PDF jaisa kaam queue (RabbitMQ) mein daalo, user ko turant confirm dikhao, workers background mein karein. Queue depth par alert, zaroorat ho toh workers badhao.
- Database load: pg_stat_statements se reads vs writes dekho. Zyadatar reads hon toh read replicas, writes primary par, static files CDN se. Replication lag par alert.
- Badi team, ek codebase: ek bug se poori site down ho toh microservices (har service ka apna database) + API gateway. Ye sabse last step hai, iska fayda team ko hai.
- Interview mein yahi flow bolo: simple start, monitoring, alert se bottleneck, sirf uska fix, aur fix ke baad kya verify karoge. Checklist neeche download karo.
curl -O https://howitworksio.com/files/system-design-evolution.mdpsql -c "SELECT calls, round(mean_exec_time) AS mean_ms, left(query, 80) FROM pg_stat_statements ORDER BY total_exec_time DESC LIMIT 5;"k6 run --vus 200 --duration 1m load-test.jsSources
OpenTelemetry, Prometheus, Grafana, Jaeger, k6 aur RabbitMQ ke official repos, PostgreSQL docs (pg_stat_statements), Martin Fowler (MonolithFirst); 11 Nov 2026 ko check kiye. Video ke numbers hamare demo app DemoKart ke hain.
howitworks