SYSTEM-DESIGN
    beginner

    Client-Server Model

    Software Engineer path · lesson 62 of 99
    Ready to begin request flow
    Client
    (Browser)
    Web Server
    (Nginx/Apache)
    App Server
    (Node/Python/Java)
    Database
    (Postgres/MySQL)

    Production Architectures

    E-commerce Platform (Amazon-style)

    Massive scale with microservices architecture handling millions of concurrent users.

    CDN → Load Balancer → API Gateway → Microservices (User, Product, Order, Payment) → Database Cluster
    Latency goal: <200ms for page loads, <100ms for API calls

    Social Media Platform (Twitter-style)

    High-throughput system optimized for real-time updates and timeline generation.

    Mobile/Web → CDN → Load Balancer → Timeline Service → Tweet Storage + User Graph
    Scale: 500M+ tweets/day, 6,000 tweets/second peak

    Banking System

    High-security, ACID-compliant system with strict consistency requirements.

    Mobile App → API Gateway → Core Banking System → Mainframe/Database
    Requirements: 99.99% uptime, strong consistency, audit logging

    Content Streaming (Netflix-style)

    Global CDN architecture optimized for high-bandwidth video delivery.

    Client → Edge CDN → Origin Servers → Content Management → Metadata Database
    Optimization: 95% of traffic served from CDN edge locations

    Scaling Strategies

    StrategyApproachProsCons
    Vertical (Scale Up)Add more power to existing machinesSimple, no code changesHardware limits, single point of failure
    Horizontal (Scale Out)Add more machinesUnlimited scaling, fault toleranceComplex, data consistency challenges
    CachingStore frequently accessed dataReduced latency, lower database loadCache invalidation, memory costs
    Load BalancingDistribute requests across serversBetter utilization, fault toleranceSession management, complexity

    Little's Law for Capacity Planning

    L=λ×WL = \lambda \times W
    L = Average number of requests in system
    λ = Average request arrival rate
    W = Average time a request spends in system
    Used to determine how many servers needed for target latency

    Security & Best Practices

    Security Best Practices

    • • HTTPS everywhere with TLS 1.3+
    • • Input validation and sanitization
    • • Authentication & authorization (OAuth, JWT)
    • • Rate limiting and DDoS protection
    • • Regular security audits and updates

    Common Vulnerabilities

    • • SQL injection attacks
    • • Cross-site scripting (XSS)
    • • Cross-site request forgery (CSRF)
    • • Man-in-the-middle attacks
    • • Privilege escalation

    Defense in Depth

    Network Layer: Firewalls, VPNs, network segmentation
    Application Layer: WAF, input validation, secure coding practices
    Data Layer: Encryption at rest, access controls, audit logging
    Infrastructure: Regular patching, intrusion detection, monitoring

    Follow one request

    Sequence

    Order the path of a request from the browser to the database and back.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    1. 1Drop a step here
    2. 2Drop a step here
    3. 3Drop a step here
    4. 4Drop a step here
    5. 5Drop a step here
    5 pieces left to place

    Test your knowledge

    21 questions
    Question 1 of 21
    Score: 0

    In a standard 3-tier architecture, which tier is responsible for executing business rules?

    The short version

    Think of a restaurant: The Client is the customer ordering, the Web Server is the waiter taking the order, the App Server is the chef cooking, and the Database is the pantry where ingredients are stored.

    In more depth

    The Client-Server Model

    The fundamental architecture of the web, separating requestors (clients) from providers (servers).

    The 3-Tier Architecture

    1.Presentation Tier (Client): The user interface (browser, mobile app).
    2.Logic Tier (App Server): The core business rules and API endpoints.
    3.Data Tier (Database): Where the information is durably stored.

    Separating these tiers allows each to scale independently based on their unique resource demands.

    Interview Questions

    Google
    Microsoft
    Amazon
    Netflix
    Uber
    Meta
    Slack
    Airbnb
    Twitter
    LinkedIn
    Microsoft

    Love this visualization?

    Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.

    100% free • No credit card required