The tuning months
Before this platform earned its Redis layer, it had to earn its database. The reporting layer predated any business-intelligence team — and one stretch of growth broke it visibly: operational reports stopped coming back at all, and on the busiest collection a query couldn't return even a single day's records without timing out.
The months that followed were unglamorous: reading the slow-query log like a newspaper, matching covering indexes to the query shapes people actually ran (and deleting the indexes nobody did — on write-heavy collections an unused index is pure tax), rebuilding aggregation pipelines stage by stage, and moving text search off regex scans onto a proper search index.
Thirty-day report windows came back comfortably on collections where one day used to time out. That work never made a release announcement — but every feature shipped since stands on it.
Measure first, then argue
Push notifications were arriving late, and the room's instinct was to tune the WebSocket layer — it was the visible component. Before touching anything I measured where the time actually went, and the cost wasn't in the sockets at all: it was the fan-out loop behind them, delivering to every connection from one place. We moved fan-out to pub/sub so each instance delivers to its own connections, and pushes went sub-second. The loudest component is rarely the bottleneck; the profile decides, not the intuition.
The revert that came back stronger
The fan-out migration shipped — and production surprised us, so we reverted. The second landing looked different: instead of one big change, a series of small, individually revertible steps, each one hardened by what the first attempt had taught us. Nothing about the design was wrong; the delivery was. On a live transaction platform the unit of change has to equal the unit of rollback — that rule came out of this war and never left.
A billion-ID head start
ID generation had to move from a database counter to atomic increments in Redis — with users online and no maintenance window. Instead of choreographing a precise cutover between two live generators, we made collision impossible: the new range started one billion above the old counter, so both could run at once and never meet. Rollback was equally boring — point back at the old counter. When transactions are on the line, the clever solution is the one with nothing left to go wrong.