← Back to Bookshelf

The Accidental CTO cover
The Accidental CTO
Free download

The Accidental CTO — Subhash Choudhary

Read: December 2026

Subhash Choudhary’s account of scaling Dukaan from a scrappy MVP to a million online stores. Each chapter is a story about a crisis, with the system design lesson attached. It opens with a 3 AM phone call and a server on fire, and every fix finds the next bottleneck waiting behind it.

It’s easy to follow without a computer science background. I’d recommend it to anyone curious about how a scalable e-commerce platform is built, and to technology students most of all.

🔗Stabilise first, then build

The first rule of firefighting, the book says, is to not become part of the fire. “The database is slow” is an observation, not a diagnosis, like a doctor saying the patient is sick.

An MVP is an experiment, and its job is to test your most critical hypothesis with the least effort, so you pick the stack you know and the one that ships fastest. For Dukaan that meant Python and Django.

The analogies make the rest stick. The server is a restaurant kitchen: the CPU is the chef’s speed, RAM is the countertop, and disk is the pantry. The first crisis is a one-armed chef working on a cutting-board counter. The fix is to give the database its own library and librarian.

🔗SQL over NoSQL, and the 95/5 split

The database choice gets a clear argument too. Dukaan’s data was structured (orders, customers, inventory) and integrity was non-negotiable, so Postgres made sense, with its ACID guarantees (atomicity, consistency, isolation, durability: a transaction is all-or-nothing and correct). The real pressure was reads, not writes, and Postgres handles that with read replicas. In the book’s words, they had a classic transaction problem, not a big data problem, so NoSQL would have been a sledgehammer for a nut.

The discovery came from looking at what the database was actually doing. Of every 100 queries, about 95 were reads and 5 were writes. The 95 casual readers were blocking the 5 authors who needed to register a book, so each got a separate entrance.

🔗Nginx, and why horizontal scaling wins

Nginx turns up everywhere, which I enjoyed. It starts as the waiter serving static files and passing orders to Gunicorn. It becomes the load balancer once the single chef maxes out. Later it acts as the router that moves traffic from the old monolith to a new service.

That load balancer came with a line I’d underline: horizontal scaling is the only long-term path to high availability and scale. A bigger server is still a single point of failure, while a fleet keeps cooking when one chef goes home sick.

🔗Choosing availability over consistency

Every fix creates the next problem, though. Replicas bring CAP (consistency, availability, partition tolerance). When the network between nodes breaks, as it eventually will, you have to choose between consistency and availability.

Dukaan chose availability, which means eventual consistency. The cost showed up when a seller changed a price and then saw the old one on refresh. The fix was a “VIP pass”: for a minute after a seller writes, their reads go to the master, while everyone else keeps reading from replicas. The public gets scale, and the seller gets the feeling of strong consistency.

🔗Don’t test on prod

The staging chapter, “Don’t Test on Prod, Bro!”, starts with a junior developer’s sort-by-price feature. It worked on his test store of 15 products. Five minutes after it shipped, it took down the biggest sellers, who had thousands. That is where the team built a staging environment, a dress rehearsal with the same software and a sanitised copy of production data, and a deployment pipeline to move code through it.

The strangler fig pattern follows the same instinct: move traffic to a new service gradually, 1% then 10% then everything, instead of rewriting in one go. Dukaan began with the storefront. The resulting communication mess was answered with Kafka as a central nervous system, and containers (the apartments) shrank the application fleet by more than 60%. Then the orchestra needed a conductor, and the author locks himself in a room for a week to learn Kubernetes.

🔗Search beyond ILIKE

The chapter on search was an eye-opener. The first version was a database query like ILIKE ‘%running shoes%’. It can’t use a normal index, it scans every product name, and it finds nothing if a shopper types “runing”.

Elasticsearch’s inverted index, which maps every word to the documents containing it, and its text analysis, the part that makes search feel intelligent, were new to me in this much detail.

It pushed me to upgrade the search on this blog, which until then only matched titles and descriptions. A server like Elasticsearch would be overkill for a static site, so I used MiniSearch, a small library that builds the same kind of inverted index in the browser.

The index is built from the full text of every post, book note, the resume and the About page, and it loads only when someone opens the search box. Title matches rank first, word beginnings match, and small typos are tolerated.

I first tried Pagefind, but it doesn’t forgive typos, so searching “pshycho” found nothing. I added a fallback that suggests the closest word used on the site, and now it finds The Psychology of Money. Nowhere near Elasticsearch scale, but the same ideas.

🔗Digital postage

A seller in São Paulo had a slow store because every image travelled 14,000 km from Mumbai and back. The same traffic explained the AWS (Amazon Web Services) bill: the “Data Transfer Out” line item is digital postage, the fee for sending data from AWS to the internet, and serving millions of large images meant paying a fortune in it. Putting a CDN (content delivery network) in front cut those bandwidth costs by over 70%.

🔗The war on Shopify

This is the part of the book I found most striking. Shopify’s stores, served mostly from North America, took three to four seconds to load in India, so the founders made speed the feature to win on. The answer was a global edge network: regional clusters, data synced between them over Kafka, and one Anycast IP announced from every region so each user lands at the nearest one.

The decision I admired most was owning their own IP address range. Because the address belonged to Dukaan and not to AWS, they could announce it from anywhere. Months later, that made leaving AWS possible.

🔗Escaping the golden cage

The “golden cage” chapter is the payoff. It starts with an $80,000 AWS bill and the economics of cloud versus bare metal. Renting AWS was a fully furnished apartment: right while the company was finding product-market fit, wrong once the workload was predictable.

The migration then announced the same IP from both AWS and the new bare-metal cluster, so traffic moved across region by region with no downtime and nobody noticing. I loved the bare-metal move.

🔗Where this meets my own path

Much of this mirrors my own path. My DevOps journey started with trying to dockerize an enterprise product that was new to containers. The book’s advice fits how that went: pick the piece that is easiest to carve out, get it running in a container, and build outward from there.

From there I moved the CI/CD (continuous integration and delivery) pipelines from Jenkins to Azure DevOps, and later came AKS (Azure Kubernetes Service), multi-stage pipelines, Helm, monitoring and failover setups. The chapters on environments, deployment pipelines and regional failure read like a tidier version of lessons I learned one incident at a time. The microservices architecture, with RabbitMQ doing the messaging, felt familiar too, and the Kafka chapters read like the same story one size up.

One thing has changed since then: AI. When the book was written, and when I started out, it wasn’t mainstream, so every review was a human one. Today an automated pull request reviewer gives almost any team a first pass on every change, catching obvious bugs, risky queries and security slips before a person looks at it. That makes everyday development safer, but the book’s lessons are about systems, and an assistant still can’t tell you which bottleneck to trade for.

The book is free on GitHub, with the PDF and the source.