Writing by Imran Younas
Backend, system design, Redis, databases, and production.
- A notification system that survives a traffic spike — Flash sale, millions of orders, SMS and email on the critical path. Why the Order API should stay small, how an outbox and a queue absorb the burst, and what still breaks if workers cannot catch up.
- System design tips that actually matter in production — The habits I actually use on backends: clarify the problem, put numbers on it, name the trade-off, start simple, design for failure, and measure the bottleneck before adding Redis or Kafka.
- If Redis is single-threaded, how does it handle so many requests? — Redis is not fast because it uses many threads. It is fast because it does not wait: one event loop, data in RAM, and no thread-per-request tax.
- Your Redis TTL was one hour. The key is still there a day later. — Expired Redis keys are not always deleted on the second they expire. Lazy expiration, SET without EX, and writers that refresh the key explain most surprises.
- How the server verifies an OTP it never stored — TOTP is not a row in a database. The device and the server share a secret, both compute a code from the current time, and the server checks they match.
- LIKE '%word%' is not how you search a billion messages — A leading-wildcard LIKE scan reads the table. Full-text search uses an inverted index: word → message IDs. Intersect the lists. Skip the common words.
- Redis does not crash when memory is full. You configured what happens next. — Hit maxmemory and Redis evicts or rejects writes. It does not vanish. The process the OS kills is usually the one you never capped.
- The user refreshes mid-payment. Idempotency is how they are not charged twice. — Retries, refreshes, and network blips replay the same intent. An idempotency key lets the server return the first result instead of running the side effect again.
- GET /reports?from=2020&to=2026 on 80 million rows is not a SQL puzzle first — Index the date column. Then ask why six years of data must return in one response. Pagination, streaming, and a product constraint beat a heroic query.
- Why Caching Without TTL is a Silent Killer — Caching without an expiration time creates bugs that never go away. Learn how TTL works in Redis, real-world consequences, and best practices to keep your cache fresh.