System Design की नींव
बार-बार काम आने वाला छह-चरण इंटरव्यू फ़्रेमवर्क और वे दस बिल्डिंग ब्लॉक जिनसे हर बड़ा सिस्टम बनता है।
प्रॉब्लम और केस स्टडी के नाम, कोड और तकनीकी कीवर्ड अंग्रेज़ी में ही रखे गए हैं।
छह चरणों वाला फ़्रेमवर्क
Requirements स्पष्ट करें
Functional दायरा (3–4 मुख्य use cases) और non-functional लक्ष्य: scale, latency, availability, consistency, durability। इन्हें लिख लें; आगे का हर trade-off इन्हीं से तय होता है।
Envelope का अनुमान लगाएँ
DAU → QPS (औसत और peak), read/write अनुपात, प्रति वर्ष storage, bandwidth। खुलकर round करें; आप orders of magnitude खोज रहे हैं जो डिज़ाइन को शामिल या बाहर करें।
API और data model तय करें
Endpoints या events और मुख्य entities को उनकी keys के साथ नाम दें। Access pattern store तय करता है: key-value, wide-column, relational, search या blob।
High-level design बनाएँ
Clients → edge (CDN, LB, gateway) → stateless services → caches, queues, stores। एक read और एक write को शुरू से अंत तक चलाकर दिखाएँ।
कठिन हिस्सों में गहराई से जाएँ
वे 2–3 components चुनें जो scale पर सबसे पहले टूटते हैं: hot keys, fan-out, पैसे की consistency, ordering, exactly-once। दो विकल्पों की तुलना करें और कारण सहित चुनें।
मज़बूत करें और आगे बढ़ाएँ
Failure modes, multi-region, observability, back-pressure, security और लागत। बताएँ कि पहले क्या बनाएँगे और क्या बाद के लिए छोड़ेंगे।
बिल्डिंग ब्लॉक
Load balancer & API gateway
Traffic फैलाएँ, TLS समाप्त करें, authenticate करें, rate-limit और route करें।
ध्यान दें: L4 बनाम L7, sticky sessions, health checks।CDN & edge cache
Static और cache होने योग्य content users के पास से परोसें।
ध्यान दें: Cache keys, invalidation, signed URLs।Cache (Redis / Memcached)
Read load सोखें और hot data की latency घटाएँ।
ध्यान दें: Cache-aside बनाम write-through, stampedes, TTLs, hot keys।Message queue / log (Kafka, SQS)
Producers को consumers से अलग करें, spikes को buffer करें, events replay करें।
ध्यान दें: हर partition में ordering, consumer lag, DLQs, at-least-once।Relational database
Transactions और मज़बूत invariants (orders, ledgers, inventory)।
ध्यान दें: Indexes, isolation levels, read replicas, sharding keys।Wide-column / key-value store
सरल access paths के साथ भारी write throughput।
ध्यान दें: Partition key डिज़ाइन, tunable consistency, compaction।Search index (Elasticsearch)
Full-text, faceted और geo queries।
ध्यान दें: Indexing lag, shard का आकार, relevance tuning।Object storage (S3)
Blobs: media, backups, data-lake files।
ध्यान दें: Multipart upload, lifecycle tiers, eventual listing।Stream processor (Flink / Spark)
Windowed aggregation, enrichment और real-time analytics।
ध्यान दें: Watermarks, state का आकार, checkpointing।Coordination service (etcd / ZooKeeper)
Leader election, config, locks और membership।
ध्यान दें: इसे छोटा रखें; यह consensus सिस्टम है, database नहीं।