DEV Community

Nozibul Islam
Nozibul Islam

Posted on

System Design Cheat Sheet: Problem Solution

  1. Slow reads → Add a cache
  2. Write spikes → Buffer with a queue
  3. Too much traffic → Add a load balancer
  4. Read-heavy DB → Add read replicas
  5. Write-heavy DB → Shard the data
  6. Slow queries → Add indexes
  7. Slow file loads → Object storage + CDN
  8. Temporary failures → Retry with backoff
  9. Too many requests → Rate limiting
  10. One service failing → Circuit breaker
  11. Duplicate requests → Idempotency keys
  12. Can't see what broke → Logs, metrics, tracing
  13. One server can't handle the load → Stateless services + horizontal scaling
  14. Slow API due to heavy work → Background jobs (return 202, check status later)
  15. Cache stampede on popular keys → TTL jitter + request coalescing
  16. Stale cache data → TTL + invalidation on write/events
  17. DB connections exhausted → Connection pooling
  18. N+1 queries → Eager loading / batching (DataLoader)
  19. Huge list responses → Cursor-based pagination
  20. Slow text search → Search engine (Elasticsearch/OpenSearch) or full-text index
  21. Analytics slowing the production DB → Separate warehouse/replica (OLAP) fed via CDC
  22. Global users, high latency → CDN + multi-region
  23. Large file uploads → Presigned URLs + multipart upload
  24. Need real-time updates → WebSocket / SSE
  25. Hot key / hot shard → Better shard key, consistent hashing, key salting
  26. Single point of failure → Redundancy + health checks + automatic failover
  27. Slow downstream drags everything down → Timeouts + bulkheads + load shedding
  28. Retry storms → Exponential backoff + jitter + retry budget
  29. Poison messages that keep failing → Dead-letter queue
  30. Data loss risk → Replication + backups + point-in-time recovery (test your restores)
  31. Risky deployments → Canary/blue-green + feature flags + rollback plan
  32. Dependency is down → Graceful degradation / fallback
  33. Transaction across services → Saga pattern
  34. DB write and event publish can diverge → Transactional outbox
  35. Concurrent updates overwrite each other → Optimistic locking (version column)
  36. Duplicate or out-of-order messages → Idempotent consumers + version/sequence numbers
  37. User doesn't see their own write (replica lag) → Read-your-writes (read from primary briefly)
  38. Schema change without downtime → Expand/contract migrations
  39. Need an audit trail → Append-only audit log
  40. Cron job runs twice on multiple instances → Distributed lock / leader election
  41. Unauthorized access → AuthN + AuthZ (OAuth2/OIDC, RBAC), checks always server-side
  42. Bots / DDoS / abuse → WAF + CDN + rate limiting
  43. Leaked secrets → Secrets manager, never in code or repo
  44. Fake webhooks → Signature verification
  45. Injection attacks → Parameterized queries + input validation
  46. One tenant hogs resources (noisy neighbor) → Per-tenant quotas and rate limits
  47. Team blocked by shared deploys → Modular monolith first, microservices only when truly needed
  48. Cloud cost growing → Autoscaling + right-sizing + budget alerts
  49. Config change needs a deploy → Feature flags / config service
  50. LLM doesn't know your private or fresh data → RAG
  51. Answers need citations or per-user permissions → RAG
  52. One small document fits in context → Long context (+ prompt caching)
  53. Need consistent style, format, behavior → Fine-tuning
  54. Hallucinations → Grounding (RAG) + "I don't know" fallback + evals
  55. High LLM cost → Prompt caching + model routing + response caching
  56. Broken output format → Structured output (JSON schema) + validation + retry
  57. LLM provider rate limits or outage → Queue + backoff + fallback model/provider
  58. Quality regressions → Eval set
  59. Prompt injection → Least-privilege tools + human approval for risky actions
  60. Fixed multi-step LLM task → Workflow (chaining, routing)
  61. Unknown steps, needs tool feedback → Agent (with step and cost limits)
  62. Multi-hop questions → Agentic RAG

Top comments (0)