System Design: Distributed Locking — Redis Redlock, ZooKeeper, and Database Locks
Why Distributed Locks? A mutex works within a single process. A database row lock works within a single database. When […]
Learn to design scalable, reliable systems that handle millions of users. System design interviews test your ability to architect real-world applications, considering tradeoffs, scalability, and best practices.
Core Topics:
Scalability: Load balancing, horizontal vs vertical scaling
Storage: Databases (SQL vs NoSQL), caching (Redis, Memcached)
Reliability: Replication, failover, disaster recovery
Performance: CDNs, caching strategies, database indexing
Common Design Questions:
Design URL shortener (bit.ly)
Design rate limiter
Design Twitter/Instagram feed
Design messaging system (WhatsApp)
Design file storage (Dropbox)
Interview Level: Senior engineers (L5+) at FAANG companies. Requires 3-5+ years experience to tackle effectively.
Preparation: Study system design patterns, understand distributed systems fundamentals, and practice mock interviews.
Why Distributed Locks? A mutex works within a single process. A database row lock works within a single database. When […]
Core Entities Order: order_id, customer_id, restaurant_id, driver_id, items[], total_cents, status, placed_at, estimated_delivery_at. OrderStatus (state machine): PLACED -> CONFIRMED -> PREPARING
The Problem with Distributed Transactions In a monolith with a single database, ACID transactions guarantee atomicity: either all operations succeed
What Is a Config Management Service? A configuration management service stores application settings that need to change without a code
The Core Challenge A flash sale sells a limited quantity (e.g., 1000 units) at a discounted price for a short
What Is a Geo-Proximity Service? A geo-proximity service finds entities (businesses, drivers, users) near a given location. Core operations: store
Core Entities Provider: provider_id, name, timezone, working_hours (JSONB: {“MON”: [“09:00″,”17:00”], …}), slot_duration_minutes (e.g., 30). Appointment: appointment_id, provider_id, client_id, start_time (UTC),
Core Entities Content: content_id, type (TEXT, IMAGE, VIDEO), author_id, platform, raw_content / storage_url, created_at. ModerationDecision: decision_id, content_id, verdict (APPROVED, REMOVED,
What Is Event-Driven Architecture? Event-Driven Architecture (EDA) decouples services by having them communicate through events rather than direct API calls.
Core Entities Driver: driver_id, current_location (lat/lng), status (AVAILABLE, ON_TRIP, OFFLINE), vehicle_type, rating. Rider: rider_id, payment_method_id, rating. Trip: trip_id, rider_id, driver_id,
The Video Upload and Processing Problem YouTube processes 500 hours of video every minute. Each uploaded video must be transcoded
Requirements Functional: send notifications via multiple channels (push, email, SMS, in-app), support notification templates with variable substitution, allow users to
Requirements Functional: place orders (cart checkout → payment → fulfillment), track order status through lifecycle, handle partial fulfillment (items shipped
Requirements Functional: record expenses with amount, category, date, and notes; support multiple currencies with conversion; tag and categorize expenses; view
Requirements Functional: 1-on-1 and group messaging, real-time message delivery, message persistence and history, read receipts (sent/delivered/read), user presence (online/offline/last seen),