📥 Download Complete 2026 Printable PDF Notes, Architecture Diagrams & GitHub Code
Get instant free access to the 2026 printable PDF cheat-sheet, runnable lab repositories, interview evaluation rubric, and AI Campus 6-Month Paid Corporate Internship roadmap.
Download Free PDF & Syllabus Roadmap →Top 12 Senior System Design (HLD & Distributed Systems) Technical Interview Questions & Answers (2026)
Enterprise-grade distributed systems architectural questions, trade-offs, and production scenarios asked during System Design and High-Level Design (HLD) rounds at FAANG, Tier-1 MNCs, and AI unicorns:
Q1 Explain the CAP Theorem and how modern distributed databases (e.g. Cassandra vs PostgreSQL/Spanner) make trade-offs.
Q2 How does Consistent Hashing work and why is it preferred over simple modulo hashing (hash(key) % N) in distributed caches?
N, which remaps virtually all cached keys (specifically (N-1)/N keys), triggering a massive cache avalanche against backend databases. Consistent Hashing maps both server nodes and data keys to positions on a 360-degree virtual circular ring (e.g., using SHA-256). A key is assigned to the first server found moving clockwise. When a node joins or fails, only keys in its immediate segment (an average of K/N keys) must be migrated. Modern systems use Virtual Nodes (vnodes) (e.g., 256 virtual positions per physical server) to prevent hash hotspots and ensure uniform data distribution.
Q3 What is the difference between Database Sharding and Horizontal Partitioning, and how do you handle cross-shard queries?
tenant_id or user_id) so 99% of transactions hit a single shard.
Q4 Compare Redis Caching Strategies: Cache-Aside (Lazy Loading) vs Write-Through vs Write-Back (Write-Behind).
Q5 How does Apache Kafka achieve horizontal scalability and high throughput, and how do Consumer Groups manage partitions?
sendfile() syscall to stream data from OS page cache directly to network sockets without user-space buffer copies, 3) Batching & Compression (Snappy, zstd) across network packets, and 4) Partitioning. A Kafka topic is split into independent partitions distributed across cluster brokers. Within a Consumer Group, each partition is consumed exclusively by a single consumer instance, allowing parallel linear consumption up to the partition count.
Q6 Design a Distributed Rate Limiter: Compare Token Bucket vs Leaky Bucket vs Sliding Window Counter algorithms in Redis.
ZADD, ZREMRANGEBYSCORE, ZCARD) wrapped inside an atomic Lua script to eliminate race conditions across distributed API gateway instances.
Q7 What is the Circuit Breaker pattern (Resilience4j / Envoy) and how does it prevent cascading failures in Microservices?
Q8 Compare Layer 4 (Transport) vs Layer 7 (Application) Load Balancing with NGINX, HAProxy, and AWS ALB.
/api/v1/payments vs /api/v1/search), SSL/TLS offloading, gRPC multiplexing, sticky sessions, and JWT validation.
Q9 How do you implement Distributed Locks in Redis, and what are the limitations of the Redlock algorithm?
SET resource_name my_random_value NX PX 30000 and released using an atomic Lua script verifying ownership (if redis.call('get',KEYS[1]) == ARGV[1] then return redis.call('del',KEYS[1]) else return 0 end). To handle Redis node failover where asynchronous replication might release a lock prematurely, Salvatore Sanfilippo created Redlock, which acquires locks across N independent masters (e.g., 5 nodes) and requires a quorum (3/5) within a strict time bound. However, as Martin Kleppmann proved, distributed locks without fencing tokens can fail under prolonged GC pauses, VM clock jumps, or asynchronous network unresponsiveness.
Q10 Compare Database Indexing internals: B-Tree / B+ Tree vs LSM-Tree (Log-Structured Merge-Tree).
O(log N) point lookups and efficient sequential range scans. However, random writes cause in-place updates and page splits, leading to write amplification. LSM-Tree (Cassandra, RocksDB, Bigtable): Optimizes for high-velocity writes by buffering writes in an in-memory sorted MemTable and append-only commit log. When full, it flushes sequentially to disk as immutable SSTables. Reads check MemTable, Bloom filters, and SSTables via a multi-way merge, trading slower reads for near-zero write amplification.
Q11 How does Content Delivery Network (CDN) edge caching work and how do you handle stale cache invalidation globally?
Cache-Control: public, max-age=3600, s-maxage=86400, stale-while-revalidate=60. For immediate invalidation of updated product or course data, CDNs support Cache-Tag (Surrogate-Key) purging. Instead of purging by URL regex, the origin server tags responses with IDs (e.g., Surrogate-Key: course-101 catalog). When a record updates, the backend triggers an instant API purge on that specific surrogate key across all global edge nodes within ~150 milliseconds.
Q12 How do you generate Globally Unique Distributed IDs at Scale without database auto-increment bottlenecks (Twitter Snowflake ID)?
Q1 Explain the 4 fundamental pillars of OOPs (Encapsulation, Abstraction, Inheritance, Polymorphism) with production examples.
Encapsulation bundles data and methods while restricting direct access via private fields and public accessors.
Abstraction hides implementation complexity behind interfaces or abstract classes.
Inheritance enables code reuse and hierarchical categorization.
Polymorphism allows objects to take multiple forms through Compile-time method overloading and Runtime method overriding.
Q2 What is the difference between SOLID design principles in Low-Level Design (LLD)?
Single Responsibility: A class should have one reason to change.
Open/Closed: Open for extension, closed for modification.
Liskov Substitution: Subclasses must be substitutable for base classes.
Interface Segregation: Clients shouldn't be forced to depend on unused interfaces.
Dependency Inversion: Depend on abstractions, not concretions.
Q3 How do you detect a cycle in a Directed Graph vs an Undirected Graph?
For Undirected Graphs, use BFS/DFS with a visited set and parent tracking, or Disjoint Set Union (DSU).
For Directed Graphs, use DFS with a 3-color state (Unvisited=0, Visiting=1, Visited=2) or Kahn's Algorithm (Topological Sort with in-degrees). If topological sort order doesn't include all vertices, a cycle exists.
Q4 Explain the 0/1 Knapsack Problem and how to optimize space complexity from O(N*W) to O(W).
Standard 2D dynamic programming builds a table dp[i][w] representing max value considering first i items with weight limit w.
Because each state dp[i][w] depends only on the previous row dp[i-1][w] and dp[i-1][w - weight[i]], we can compress the table into a single 1D array by iterating weights backwards from W down to weight[i].
Q5 How do you design a distributed URL Shortener (TinyURL) at FAANG scale in System Design (HLD)?
Key requirements: 100M URLs/month, low-latency redirection (<20ms), high availability (99.999%).
Architecture: Base62 encoding on unique 64-bit integer IDs generated by Twitter Snowflake or ZooKeeper range counters. Store in Cassandra/DynamoDB (key-value schema) with Redis caching tier and LRU eviction.
Q6 Explain the CAP Theorem and PACELC Theorem in Distributed Systems.
CAP Theorem states a distributed store can guarantee at most 2 out of Consistency, Availability, and Partition Tolerance.
PACELC extends CAP: If there is a Partition (P), trade off Availability (A) and Consistency (C); Else (E), trade off Latency (L) and Consistency (C). Example: DynamoDB/Cassandra choose PA/EL; Spanner chooses PC/EC.
Q7 How does Consistent Hashing prevent cache stampedes in distributed cache clusters?
Consistent hashing maps both servers and cache keys onto a virtual 360-degree hash ring. When a server node is added or removed, only K/N keys need remapping (where K is total keys and N is servers), preventing mass cache invalidation.
Q8 Explain LRU Cache implementation with O(1) get() and put() operations.
An LRU cache combines a Doubly Linked List (for O(1) node removal and head-insertion) and a Hash Map (for O(1) key-to-node pointer lookup).
Q9 How does Rate Limiting work (Token Bucket vs Leaky Bucket vs Sliding Window Counter)?
Token Bucket allows bursty traffic: tokens accumulate up to capacity; each request consumes a token.
Leaky Bucket processes requests at a strictly constant rate.
Sliding Window Counter in Redis tracks timestamps using Sorted Sets (ZADD, ZREMRANGEBYSCORE, ZCARD) for precise rolling rate limits.
Q10 What is Database Sharding (Horizontal Partitioning) and how do you handle cross-shard queries?
Sharding splits large tables across separate database instances using a shard key (hash-based or range-based). Cross-shard queries are handled via scatter-gather proxies or by denormalizing common lookup tables across all shards.
Accelerate Your Career with Guaranteed Paid Internship*
Transparent ₹1,20,000 Fee (Inclusive of GST) • ₹10,000/month No-Cost EMI • 6-Month Corporate Paid Internship (₹15,000 – ₹35,000/mo stipend) with official IBM & Microsoft Credly credentials.
