Identifying Weaknesses in a Simple Web Service Architecture
System DesignModel answerLast updated
Analyze a basic web application topology and recommend architectural improvements for scalability, reliability, and fault tolerance.
You're reviewing the architecture for a web service that currently has this topology:
Users → DNS → Load Balancer → App Server → Database
↓
Third-Party API
Your task is to critique this design and suggest improvements. Consider:
- What happens when traffic spikes or components fail?
- Where are the single points of failure?
- How will this system behave under load?
- What issues arise from the external API dependency?
- What's missing for production operations?
Walk through each layer systematically. For each weakness you identify, explain the failure mode and propose a specific remedy. Prioritize improvements that address the most critical risks first.
Context to establish:
- Daily active users: ~10 million
- Average request rate: ~2,000 RPS, peaking at ~10,000 RPS
- Read-to-write ratio: approximately 10:1
- Target latency: p99 < 300ms
- Target availability: 99.9% (roughly 43 min/month downtime budget)
- External API rate limit: 100 requests/second
- External API availability: 99.5%
Hints
Hint 1
Start by identifying all single points of failure in the current architecture
Hint 2
The external API's 99.5% availability is lower than your 99.9% target—what does that mean if every request depends on it?
Hint 3
Consider both horizontal scaling (adding instances) and vertical concerns (caching, connection pooling) for the database
Model answer
Easy Try it yourself first — then compare your approach, complexity and edge cases.
Model Answer: Architecture Review and Recommendations
A strong answer walks through each component methodically, identifies concrete failure scenarios, and proposes targeted fixes ranked by impact.
Step 1: Establish Context (1–2 minutes)
Before diving into critique, confirm key parameters. Note the critical observation: the external API's 99.5% SLA cannot support our 99.9% availability target if it's on the critical path for every request. This constraint shapes much of the design.
Step 2: Systematic Component Analysis
DNS Layer
Issues:
- Single DNS provider creates regional failure risk
- Long TTL values delay failover during incidents
- No mention of DDoS protection
Recommendations:
- Deploy managed DNS with multi-region presence
- Set TTLs to 30-60 seconds for faster failover
- Configure health-based routing that automatically removes unhealthy endpoints
Load Balancer
Issues:
- Single instance represents a failure point
- No health checking mentioned—dead backends stay in rotation
- Missing TLS termination strategy
- No protection against abusive clients
Recommendations:
- Use managed multi-AZ load balancing with automatic failover
- Implement health checks (probe
/healthevery 5s, remove after 3 consecutive failures) - Add per-client rate limiting and connection throttling
- Enable connection draining during deployments
Application Tier
Issues:
- Single server caps throughput and creates failure point
- Stateful sessions prevent horizontal scaling
- No autoscaling means either waste during low traffic or crashes during peaks
- Thread exhaustion from slow external API calls affects unrelated endpoints
Recommendations:
- Make service stateless (move sessions to Redis or use signed tokens)
- Run N+2 instances across 3+ availability zones (need ~20 instances at 500 RPS each for 10K peak)
- Configure autoscaling based on CPU or request rate with minimum floor
- Isolate external API calls in separate thread pools (bulkheading) so slowdowns don't cascade
- Implement aggressive timeouts (1-2s) and circuit breakers for the external dependency
Database Layer
Issues:
- Single primary is both a bottleneck and failure point
- 10K peak RPS means ~9K reads/sec + writes will overwhelm one database
- Connection exhaustion likely (multiple app instances × connection pool size)
- No caching means every read hits the database
- No backup/recovery strategy shown
Recommendations:
- Add Redis cache layer with cache-aside pattern—an 80-90% hit rate reduces DB load by 5-10×
- Deploy read replicas for cache misses; route critical read-after-write flows to primary
- Use connection pooler (PgBouncer or RDS Proxy) to manage connections efficiently
- Configure multi-AZ primary with synchronous standby and automated failover
- Enable automated backups with point-in-time recovery and test restore procedures
- Shard by user ID only when write throughput exceeds single-node capacity (defer until needed)
External API Dependency (Most Critical)
Issues:
- 10K RPS exceeds 100 RPS limit by 100×—guaranteed rate limit failures
- Synchronous calls create blocking behavior during slowdowns
- No retry logic or idempotency handling
- API downtime directly causes service downtime despite better internal SLA
Recommendations:
- Decouple non-critical paths: If results aren't needed in the response, publish to a message queue (SQS, Kafka) and process asynchronously with workers that respect rate limits
- Client-side rate limiting: Implement distributed token bucket in Redis shared across all instances, set below vendor quota
- Circuit breaker: After threshold failures, fail fast during cooldown, then probe with limited requests
- Retries: Use exponential backoff with jitter, cap attempts, ensure idempotency
- Caching: Cache API responses where data permits; serve stale data during outages rather than failing
- Graceful degradation: Return degraded responses when external dependency unavailable
Step 3: Cross-Cutting Concerns
Static Content
- Serve assets through CDN to reduce application load and improve global latency
- Implement cache control headers appropriately
Observability (Often overlooked but critical)
- Metrics: Track request rate, error rate, duration (RED) per endpoint; monitor connection pool usage, cache hit rates, circuit breaker state, API rate limit consumption
- Distributed tracing: Implement correlation IDs that flow through all components
- Structured logging with appropriate retention
- Define SLOs and alert on error budget burn rate
- Deploy synthetic monitors from multiple regions
Operational Safety
- Use canary or blue-green deployments with automated rollback
- Store API credentials in secrets management system (not in code)
- Implement proper separation between environments
Priority Ranking
- Critical (blocking production): External API decoupling, basic autoscaling, database read replicas
- High (reliability risks): Multi-AZ redundancy, health checks, caching layer, observability foundation
- Medium (operational improvements): CDN, connection pooling, deployment safety
- Lower (optimization): Advanced monitoring, multi-region failover
Common Mistakes to Avoid
- Listing technologies without connecting them to specific problems
- Recommending sharding before exhausting simpler scaling options
- Ignoring the external dependency entirely
- Forgetting to discuss trade-offs (consistency vs. availability, cost vs. performance)
- Missing the SLA math that makes synchronous external calls problematic
A strong candidate demonstrates systematic thinking, ties each recommendation to a failure scenario, acknowledges trade-offs, and sequences improvements logically rather than proposing everything simultaneously.