D
DevPrepSystematic Prep
DEVPREP CODEX · #25

System Design · HLD Interview Questions

150 curated questions graded from Foundations (Easy) to Practical Patterns (Medium) and Internals & Architecture (Hard).

TOTAL QUESTIONS

150

THEORY QUESTIONS

150

IMPLEMENTATION FOLIOS

0

FREE QUESTIONS

5 / Level

Easy Level·50 Questions Total

Foundations & Core Concepts

Open Full Easy List
Q1Define Scalability, Availability, Reliability, and Latency vs. Throughput.

Answer: These represent the core non-functional metrics (NFRs) used to evaluate distributed system health and capacity.

graph TD
    Metrics[NFR Metrics] --> Scalability[Scalability: Horiz/Vert]
    Metrics --> Availability[Availability: SLA Nines]
    Metrics --> Reliability[Reliability: MTTF/MTBF]
    Metrics --> LatencyThroughput[Latency vs Throughput]
  • Scalability: The system's ability to handle growing volume of traffic/work by adding computing resources.
    • Vertical (Scale Up): Adding more power (CPU, RAM, SSD) to a single machine. bounded by hardware ceilings and acts as a Single Point of Failure (SPOF).
    • Horizontal (Scale Out): Adding more machines to the resource pool. Requires a Load Balancer (LB) and distributed coordination, but supports infinite growth.
  • Availability: The percentage of time a system remains fully functional and accessible.
    • SLA (Service Level Agreement): Measured in "nines". 99.9% ("three nines") allows ~8.76 hours of downtime/year; 99.999% ("five nines") allows only ~5.26 minutes/year.
    • Active-Passive: One active server handles traffic; passive standby replicates state and takes over via failover on active node failure.
    • Active-Active: All nodes handle traffic concurrently, maximizing resource utility.
  • Reliability: The probability that a system performs its function without failure over time. While availability is "is it up?", reliability is "does it perform correctly without error when used?". Measured via MTBF (Mean Time Between Failures) and MTTF (Mean Time To Failure).
  • Latency vs. Throughput:
    • Latency: Time taken for a single request to travel from sender to receiver and back (measured in ms).
    • Throughput: Number of requests or data units processed per unit of time (e.g., Transactions Per Second - TPS, or Queries per Second - QPS).

Q2Explain Load Balancing. Contrast Layer 4 and Layer 7 Load Balancing, and list core routing algorithms.

Answer: A Load Balancer (LB) routes client requests across a pool of servers to optimize resource utilization, maximize throughput, and prevent server bottlenecks.

  • Layer 4 (L4) Load Balancing:
    • Operates at the transport layer (TCP/UDP).
    • Routes traffic based on IP address and port numbers.
    • Does not inspect request content (cannot read HTTP headers, cookies, or payloads).
    • Pros: Extremely fast, low CPU usage, highly secure (no SSL/TLS termination needed).
  • Layer 7 (L7) Load Balancing:
    • Operates at the application layer (HTTP/HTTPS/FTP).
    • Routes traffic based on headers, cookies, URL paths, and query parameters.
    • Requires terminating and decrypting SSL/TLS traffic.
    • Pros: Intelligent routing (e.g., /images to CDN, /api to microservice), allows cookie-based sticky sessions.
  • Core Routing Algorithms:
    • Round Robin: Cycles through servers sequentially. Assumes uniform server capacity.
    • Weighted Round Robin: Assigns traffic proportionally based on server capability weights.
    • Least Connections: Directs traffic to the server with the fewest active connections. Best for long-lived sessions.
    • IP Hash: Hashes client IP to assign a dedicated server. Guarantees session persistence (sticky sessions).

Q3Explain Caching Strategies, eviction policies, and cache-consistency patterns.

Answer: A Cache is a high-speed, temporary, in-memory data store (e.g., Redis, Memcached) used to shield databases and serve data fast.

  • Cache-Consistency Write Strategies:
    • Cache-Aside (Lazy Loading): Read checks cache first. On miss, reads from DB, writes back to cache, and returns. Writes go directly to DB, then invalidates cache key.
    • Write-Through: Writes update cache and DB synchronously in a single transaction. Guarantees consistency but increases write latency.
    • Write-Back (Write-Behind): Writes update cache immediately; async background worker batch-updates DB. High write performance, but risks data loss on cache crash.
  • Eviction Policies:
    • LRU (Least Recently Used): Evicts keys unaccessed for the longest duration.
    • LFU (Least Frequently Used): Evicts keys with the lowest access count.
    • FIFO (First-In, First-Out): Evicts keys in order of creation.
  • Cache Failures:
    • Cache Penetration: Client requests keys existing in neither cache nor DB. Mitigation: Cache null values with low TTL, or use Bloom Filters.
    • Cache Avalanche: Multiple keys expire simultaneously or cache crashes, flooding DB. Mitigation: Add random TTL jitter, use highly available cache clusters.
    • Cache Stampede: A highly popular key expires and concurrent requests miss cache, hitting DB to recalculate simultaneously. Mitigation: Implement distributed locks or background pre-warming.

Q4What is a CDN (Content Delivery Network)? Contrast Push vs. Pull CDNs.

Answer: A CDN is a globally distributed network of edge servers designed to cache static and dynamic assets close to users, reducing physical network latency.

graph LR
    User[User] -->|Lowest Latency| Edge[CDN Edge Server]
    Edge -->|Cache Miss| Origin[Origin Server]
  • Pull CDN:
    • Edge servers fetch content from the origin server on the first cache miss.
    • Use case: High-traffic sites with standard static assets (images, CSS, JS). Low maintenance.
  • Push CDN:
    • Origin server explicitly uploads/pushes content to CDN storage.
    • Use case: Large, rarely updated files (software downloads, video files). Content is guaranteed to be on the CDN before the first request.

Q5Contrast SQL vs. NoSQL databases. When would you use one over the other?

Answer:

  • SQL (Relational):
    • Structured schema with strict tables, columns, and foreign keys.
    • Supports ACID (Atomicity, Consistency, Isolation, Durability) guarantees.
    • Scales vertically (horizontal scaling via sharding is complex).
    • Use Case: Financial systems, order management, user profiles requiring transactional safety.
  • NoSQL (Non-Relational):
    • Flexible schema (Document, Key-Value, Column-family, Graph).
    • Prioritizes BASE (Basically Available, Soft-state, Eventual consistency).
    • Scales horizontally by default.
    • Use Case: Real-time analytics, catalog systems, high-volume sensor data, unstructured logs.

45 More Easy Questions Locked

Unlock the complete System Design · HLD Easy question bank

Get instant access to all 50 questions, in-depth model answers, code sandboxes, and all 27+ technologies for a single one-time payment.

Unlock All — One-time payment · Lifetime access
DEDICATED LEVEL PAGES

Browse All System Design · HLD Questions by Difficulty

INTERNAL LINKING & DEPENDENCIES

Related Technologies to System Design · HLD

CAREER PATHWAYS

System Design · HLD is a key requirement for these engineering roles:

System Design · HLD Interview Questions — Easy, Medium & Hard | DevPrep | DevPrep