AI EducademyAIEducademy
🌳

AI की नींव

🌱
AI Seeds

शून्य से शुरू करें

🌿
AI Sprouts

नींव बनाएं

🌳
AI Branches

व्यवहार में लागू करें

🏕️
AI Canopy

गहराई में जाएं

🌲
AI Forest

AI में महारत हासिल करें

🔨

AI में महारत

✏️
AI Sketch

शून्य से शुरू करें

🪨
AI Chisel

नींव बनाएं

⚒️
AI Craft

व्यवहार में लागू करें

💎
AI Polish

गहराई में जाएं

🏆
AI Masterpiece

AI में महारत हासिल करें

🚀

करियर रेडी

🚀
इंटरव्यू लॉन्चपैड

अपनी यात्रा शुरू करें

🌟
व्यवहारिक इंटरव्यू में महारत

सॉफ्ट स्किल्स में महारत

💻
तकनीकी इंटरव्यू

कोडिंग राउंड में सफल हों

🤖
AI और ML इंटरव्यू

ML इंटरव्यू में महारत

🏆
ऑफर और उससे आगे

सबसे अच्छा ऑफर पाएं

सभी कार्यक्रम देखें→

लैब

7 प्रयोग लोड हुए
🧠न्यूरल नेटवर्क प्लेग्राउंड🤖AI या इंसान?💬प्रॉम्प्ट लैब🎨इमेज जनरेटर😊सेंटिमेंट एनालाइज़र💡चैटबॉट बिल्डर⚖️एथिक्स सिमुलेटर
🎯मॉक इंटरव्यूलैब में जाएँ→
nav.journeyब्लॉग
🎯
हमारे बारे में

हर जगह, हर किसी के लिए AI शिक्षा सुलभ बनाना

❓
nav.faq

Common questions answered

✉️
Contact

Get in touch with us

⭐
ओपन सोर्स

GitHub पर सार्वजनिक रूप से निर्मित

सीखना शुरू करें - यह मुफ्त है
AI EducademyAIEducademy

MIT लाइसेंस - ओपन सोर्स

सीखें

  • कार्यक्रम
  • पाठ
  • लैब

समुदाय

  • GitHub
  • योगदान करें
  • आचार संहिता
  • हमारे बारे में
  • सामान्य प्रश्न

सहायता

  • कॉफ़ी खरीदें ☕
  • footer.terms
  • footer.privacy
  • footer.contact
AI और इंजीनियरिंग प्रोग्राम›⚒️ AI Craft›पाठ›System Design Fundamentals
🏗️
AI Craft • उन्नत⏱️ 20 मिनट पढ़ने का समय

System Design Fundamentals

System Design क्यों ज़रूरी है

हर large-scale application एक जैसे fundamental building blocks से बनती है। Interviewers आपसे नई technology invent करने की उम्मीद नहीं रखते - वो देखना चाहते हैं कि आप किसी problem के लिए सही components को select और combine कर सकते हैं या नहीं। इस lesson में वो toolkit cover होगी जो हर design interview में काम आएगी।

Client-Server Architecture

Web का core model बहुत simple है: clients requests भेजते हैं, servers उन्हें process करते हैं, और responses वापस आते हैं। लेकिन modern systems में scale, reliability और performance handle करने के लिए इन दोनों endpoints के बीच कई layers जुड़ जाती हैं।

एक typical request का path कुछ ऐसा होता है: client → CDN → load balancer → API gateway → application server → cache → database। हर layer एक specific problem solve करती है, और कब कौन सी layer चाहिए - यह समझना ही strong candidates को average से अलग करता है।

💡

Interviews में हमेशा specifics में जाने से पहले high-level client-server flow sketch करें। इससे structured thinking दिखती है।

Load Balancers: Traffic को Distribute करना

एक single server की capacity limited होती है। Load balancers incoming requests को multiple servers में इन strategies से distribute करते हैं:

  • Round-robin - requests बारी-बारी servers पर जाती हैं
  • Least connections - सबसे कम active requests वाले server पर route करता है
  • Consistent hashing - एक key के basis पर requests को specific servers पर map करता है (caching के लिए useful)

Load balancers health checks भी perform करते हैं और unhealthy servers को automatically pool से हटा देते हैं। Cloud environments में AWS ALB या Azure Front Door जैसी services यह transparently handle करती हैं।

🧠त्वरित जांच

एक social media feed service को writes से 10 गुना ज़्यादा reads मिलती हैं। कौन सा load balancing approach ensure करेगा कि users consistently same cache-warm server पर पहुँचें?

Caching: हर Layer पर Speed

Caching frequently accessed data को consumer के करीब store करता है। यह कई levels पर exist करता है:

| Layer | उदाहरण | Latency | |-------|---------|---------| | Browser cache | Static assets, API responses | ~0ms | | CDN | Images, CSS, JS files | ~10-50ms | | Application cache | Redis, Memcached | ~1-5ms | | Database cache | Query result cache | ~5-10ms |

पाठ 1 / 100% पूर्ण
←प्रोग्राम पर वापस

Discussion

Sign in to join the discussion

lessons.suggestEdit

Cache invalidation computing की सबसे मुश्किल problems में से एक मानी जाती है। Common strategies में TTL (time-to-live), write-through (हर write पर cache update करना), और cache-aside (application खुद cache manage करती है) शामिल हैं।

🤯

Phil Karlton की famous quote - "Computer Science में सिर्फ दो hard things हैं: cache invalidation और naming things" - इतनी widely cite होती है कि यह system design interviews में एक rite of passage बन चुकी है।

Databases: SQL vs NoSQL

सही database चुनना सबसे impactful design decisions में से एक है:

SQL databases (PostgreSQL, MySQL) ACID transactions, strong consistency और structured schemas offer करते हैं। जब data में clear relationships हों और complex queries with joins चाहिए, तब ये best हैं।

NoSQL databases कई types में आते हैं:

  • Document stores (MongoDB) - flexible schemas, varied data structures के लिए बढ़िया
  • Key-value stores (DynamoDB, Redis) - key से blazing fast lookups
  • Wide-column stores (Cassandra) - massive write throughput, distributed by design
  • Graph databases (Neo4j) - social networks जैसे relationship-heavy data के लिए
🧠त्वरित जांच

आप एक ऐसा system design कर रहे हैं जो user profiles store करता है जिसमें frequently changing, semi-structured data है (हर user type के अलग fields)। कौन सा database type सबसे अच्छा fit है?

Message Queues: Async Processing

हर operation को immediate response की ज़रूरत नहीं होती। Message queues (RabbitMQ, Apache Kafka, AWS SQS) producers को consumers से decouple करते हैं, जिससे मिलता है:

  • Asynchronous processing - signup के बाद email भेजना response block किए बिना
  • Load levelling - traffic spikes को requests buffer करके absorb करना
  • Fault tolerance - अगर consumer crash हो जाए, तो messages queue में wait करते हैं

Kafka की special बात यह है कि यह सिर्फ queue नहीं बल्कि एक distributed event log है, जो event-driven architectures enable करता है जहाँ multiple consumers independently same stream of events process कर सकते हैं।

Architecture diagram showing client, load balancer, application servers, cache layer, database, and message queue
एक scalable system के fundamental building blocks - हर layer एक specific concern address करती है।

Microservices vs Monolith

| पहलू | Monolith | Microservices | |-------|----------|---------------| | Deployment | Single unit | Independent services | | Scaling | सब कुछ एक साथ scale | Individual services scale | | Complexity | शुरू करना आसान | Operational overhead | | Data | Shared database | Database per service |

Monolith से शुरू करें, ज़रूरत पड़ने पर microservices extract करें। ज़्यादातर interviewers ऐसे candidates को appreciate करते हैं जो यह acknowledge करें कि microservices distributed system complexity (network failures, data consistency, deployment orchestration) लाते हैं और हमेशा सही choice नहीं होते।

🤔
Think about it:

Netflix ने कई सालों में monolith से microservices पर migration किया। लेकिन Shopify - जो billions in transactions handle करता है - अभी भी modular monolith चलाता है। किसी company के लिए कौन सा approach बेहतर है, यह किन factors पर depend करता है?

CAP Theorem आसान भाषा में

CAP theorem कहता है कि एक distributed system एक साथ तीन में से सिर्फ दो properties guarantee कर सकता है:

  • Consistency - हर read सबसे recent write return करे
  • Availability - हर request को response मिले
  • Partition tolerance - network failures के बावजूद system काम करता रहे

चूँकि distributed systems में network partitions inevitable हैं, असली choice CP (consistency over availability) और AP (availability over consistency) के बीच है।

  • CP systems (जैसे HBase, MongoDB with majority reads) - stale data देने की बजाय errors return करते हैं
  • AP systems (जैसे Cassandra, DynamoDB) - हमेशा respond करते हैं, लेकिन data थोड़ा stale हो सकता है
🧠त्वरित जांच

आप एक banking transaction system design कर रहे हैं जहाँ incorrect balances से financial loss हो सकता है। कौन सा CAP trade-off prioritise करना चाहिए?

Interview Framework

System design interview में यह structure follow करें:

  1. Requirements - functional और non-functional requirements clarify करें (5 min)
  2. API design - key endpoints या interfaces define करें (5 min)
  3. Data model - databases choose करें और schemas define करें (5 min)
  4. High-level architecture - आज के building blocks से system sketch करें (10 min)
  5. Deep dives - bottlenecks scale करें, failures handle करें, optimise करें (15 min)
🤔
Think about it:

अपनी daily use की किसी system के बारे में सोचें - Instagram, Uber, या Spotify। क्या आप पहचान सकते हैं कि इस lesson के कौन से building blocks वो use करती होगी? Load balancer कहाँ बैठेगा? क्या cache होगा? कौन सा database type उसके data model पर fit करेगा?

मुख्य बातें

  • हर scalable system same core building blocks use करता है - एक बार सीखो, हर जगह apply करो
  • Load balancers, caches और message queues अलग-अलग scaling challenges solve करते हैं
  • Database choice (SQL vs NoSQL) data shape, consistency needs और access patterns पर depend करती है
  • CAP theorem trade-offs force करता है - जानो कि आपके system को किस side favour करना चाहिए
  • Structured interview framework follow करें: requirements → API → data → architecture → deep dives

अगला lesson: इन fundamentals को apply करके एक URL shortener scratch से design करेंगे।