Bird
0
0
LLDsystem_design~10 mins

Parking strategy pattern in LLD - Scalability & System Analysis

Choose your learning style9 modes available
Scalability Analysis - Parking strategy pattern
Growth Table: Parking Strategy Pattern
Users / VehiclesParking RequestsStrategy ComplexityStorage & DataResponse Time
100 vehicles~10 requests/minSimple: single strategy, few rulesSmall in-memory dataFast, negligible delay
10,000 vehicles~1,000 requests/minMultiple strategies, moderate rulesDatabase for parking spots, vehicle infoNeeds caching for speed
1,000,000 vehicles~100,000 requests/minComplex strategies, dynamic rulesDistributed DB, real-time updatesLoad balancing, caching essential
100,000,000 vehicles~10,000,000 requests/minHighly complex, AI-assisted strategiesSharded DB, geo-partitioningMulti-region load balancing, CDN for static data
First Bottleneck

At small scale, the database becomes the first bottleneck because it handles all parking spot availability and vehicle data queries. As requests grow, the DB query load increases beyond a single instance's capacity.

Scaling Solutions
  • Read Replicas: Use read replicas to distribute read queries for parking spot availability.
  • Caching: Cache frequently accessed data like parking spot status to reduce DB load.
  • Horizontal Scaling: Add more application servers behind a load balancer to handle increased requests.
  • Sharding: Partition the database by geographic zones or parking lot IDs to reduce single DB load.
  • Asynchronous Processing: Use message queues for non-critical updates to smooth spikes.
  • Geo-Distributed Systems: Deploy services closer to users to reduce latency.
Back-of-Envelope Cost Analysis
  • At 10,000 vehicles: ~1,000 requests/min = ~17 requests/sec.
  • At 1,000,000 vehicles: ~100,000 requests/min = ~1,666 requests/sec.
  • Storage: Each parking spot record ~1KB; 1M spots = ~1GB storage.
  • Bandwidth: Assuming 1KB per request/response, 1,666 req/sec = ~1.6MB/s bandwidth.
  • Network: 1 Gbps network can handle up to ~125MB/s, sufficient for this scale.
Interview Tip

Start by explaining the basic parking strategy pattern and its components. Then discuss how load grows with users and what breaks first. Propose clear, stepwise scaling solutions tied to bottlenecks. Use real numbers and simple analogies like parking lots filling up and needing more attendants or zones.

Self Check

Your database handles 1000 QPS. Traffic grows 10x to 10,000 QPS. What do you do first?

Answer: Add read replicas and implement caching to reduce direct DB load before scaling vertically or sharding.

Key Result
The database is the first bottleneck as parking requests grow; scaling requires caching, read replicas, and sharding by zones to maintain performance.