Skip to content

Category

software development

Practical software engineering from a team lead: clean code, SOLID, refactoring, debugging, backend design and system architecture with Laravel and React.

Four steps to stop a Redis cache stampede: confirm database calls spike when the key expires, let one request rebuild with SET NX PX, serve stale data with Cache::flexible while one refresh runs, and add TTL jitter so many keys do not expire together

10/30/2026

Redis Cache Stampede: TTL and Prevention

A school ERP dashboard froze every five minutes when one hot Redis key expired. Measured on a real Redis: a single-flight lock, stale-while-revalidate, TTL jitter and safe unlocks.

By Muhammad Wilayat Shah

Read
Four steps of scalable system design in order of cost: measure the real peak with a load test and p95 latency, fix the database with indexes and then a cache, check that app instances times pool size stays below max_connections, and only then scale out with stateless servers and queues

10/29/2026

Scalable System Design for Millions of Users

Our school ERP results page went down on results day, and adding a server made it worse. Here is the order I scale a system in, with lab numbers: index, cache, connection math, precompute, then scale out.

By Muhammad Wilayat Shah

Read
Understanding PostgreSQL LWLock Wait Events

10/29/2026

Understanding PostgreSQL LWLock Wait Events

Understand postgresql lwlock wait events: what WALInsert and BufferContent mean, how to query pg_stat_activity, and how to cut contention with batching, config and pooling.

By Muhammad Wilayat Shah

Read
Four steps to fix PostgreSQL WAL size increasing: measure pg_wal with pg_ls_waldir against max_wal_size, find inactive replication slots retaining WAL, check pg_stat_archiver for archive failures, and cap retention with max_slot_wal_keep_size and alerts

10/29/2026

PostgreSQL WAL Size Increasing? How to Fix It

Our HMS database disk hit 91% because a replaced replica's replication slot was never dropped. Here is how to see what holds WAL, drop stale slots, fix failing archiving, cap slot retention and let PostgreSQL clean pg_wal itself, with real PostgreSQL 17 output.

By Muhammad Wilayat Shah

Read