<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Cloud Tech by Devang]]></title><description><![CDATA[Cloud, DevOps and AI made simple — system design, real incidents and interview prep from 14+ years of experience.]]></description><link>https://cloudtechbydevang.hashnode.dev</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1593680282896/kNC7E8IR4.png</url><title>Cloud Tech by Devang</title><link>https://cloudtechbydevang.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Mon, 19 Oct 2026 12:23:23 GMT</lastBuildDate><atom:link href="https://cloudtechbydevang.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Vertical vs Horizontal Scaling: How Instagram Scaled With a Tiny Team]]></title><description><![CDATA[By Devang Pandya · Cloud Tech by Devang · Cloud • DevOps • AI — Made Simple
In April 2012, Facebook agreed to buy Instagram for about $1 billion. At that time Instagram had around 30 million users and]]></description><link>https://cloudtechbydevang.hashnode.dev/vertical-vs-horizontal-scaling-how-instagram-scaled-with-a-tiny-team</link><guid isPermaLink="true">https://cloudtechbydevang.hashnode.dev/vertical-vs-horizontal-scaling-how-instagram-scaled-with-a-tiny-team</guid><category><![CDATA[System Design]]></category><category><![CDATA[PostgreSQL]]></category><category><![CDATA[sharding]]></category><category><![CDATA[Django]]></category><category><![CDATA[scalability]]></category><category><![CDATA[AWS]]></category><dc:creator><![CDATA[Devang Pandya]]></dc:creator><pubDate>Sun, 18 Oct 2026 14:03:15 GMT</pubDate><content:encoded><![CDATA[<p><em>By Devang Pandya · Cloud Tech by Devang · Cloud • DevOps • AI — Made Simple</em></p>
<p>In April 2012, Facebook agreed to buy Instagram for about $1 billion. At that time Instagram had around <strong>30 million users</strong> and only <strong>13 employees</strong>. A few months earlier, in December 2011, Instagram's engineering blog said the app was serving <strong>14 million+ users</strong> with just <strong>3 engineers</strong>.</p>
<p>How does a team that small keep an app that big running? A large part of the answer is one of the most basic ideas in system design: <strong>scaling out instead of only scaling up</strong>, and doing it in the right places.</p>
<p>In this post I will explain vertical and horizontal scaling in simple English, show how Instagram used them, and give you a clean answer to the interview question: <em>"How do you scale a stateful service versus a stateless one?"</em> I have spent 14+ years in cloud, DevOps and SRE, and this question still comes up in almost every system design round I see.</p>
<hr />
<h2>1. What does "scaling" mean?</h2>
<p><strong>Scaling</strong> means handling more work (more users, more requests, more data) without the system getting slow or falling over.</p>
<p>There are two basic ways to do it:</p>
<ul>
<li><p><strong>Vertical scaling (scale up):</strong> make one machine <strong>bigger</strong>.</p>
</li>
<li><p><strong>Horizontal scaling (scale out):</strong> add <strong>more machines</strong>.</p>
</li>
</ul>
<p>Let's look at each.</p>
<hr />
<h2>2. Vertical scaling: a bigger machine</h2>
<p>Vertical scaling means giving your server more CPU, more memory, faster disks or a faster network. On AWS, that is changing an instance from a small type to a larger one.</p>
<p><strong>Why people like it:</strong></p>
<ul>
<li><p><strong>Simple.</strong> No code changes. The app does not need to know anything changed.</p>
</li>
<li><p><strong>Good for stateful systems.</strong> A single database on a bigger machine is still a single database: one place for data, easy transactions.</p>
</li>
<li><p><strong>Quick fix.</strong> When a server is overloaded today, moving to a bigger size can buy you time.</p>
</li>
</ul>
<p><strong>The problems:</strong></p>
<ul>
<li><p><strong>There is a ceiling.</strong> The biggest machine you can buy is still one machine. At some point there is no bigger size.</p>
</li>
<li><p><strong>Cost grows fast.</strong> The largest machines are expensive, and you pay for that size even at quiet hours.</p>
</li>
<li><p><strong>Single point of failure.</strong> If that one big machine fails, everything on it fails.</p>
</li>
<li><p><strong>Downtime to resize.</strong> Changing instance size often means a restart.</p>
</li>
</ul>
<p>Vertical scaling is not bad. It is often the <strong>right first step</strong>, especially for databases. It just cannot be your only plan.</p>
<hr />
<h2>3. Horizontal scaling: more machines</h2>
<p>Horizontal scaling means running <strong>many copies</strong> of your service on many machines, and putting a <strong>load balancer</strong> in front to spread requests across them.</p>
<p><strong>Why it is powerful:</strong></p>
<ul>
<li><p><strong>No hard ceiling.</strong> Need more capacity? Add more machines.</p>
</li>
<li><p><strong>Better availability.</strong> If one machine dies, the others keep serving. The load balancer stops sending traffic to the dead one.</p>
</li>
<li><p><strong>Pay for what you use.</strong> With <strong>auto scaling</strong> (for example AWS Auto Scaling groups or Kubernetes Horizontal Pod Autoscaler), you add machines at peak and remove them at night.</p>
</li>
</ul>
<p><strong>The catch:</strong> horizontal scaling only works smoothly if any copy can handle any request. That leads to the most important word in this post: <strong>stateless</strong>.</p>
<hr />
<h2>4. Stateless vs stateful: the key idea</h2>
<p>A <strong>stateless</strong> server keeps <strong>no important data in its own memory or disk</strong> between requests. Everything it needs comes from the request itself, or from shared systems like a database or a cache.</p>
<p>A <strong>stateful</strong> server keeps important data locally. Examples: a database server, or an app server that keeps your login session in its own memory.</p>
<p>Why does this matter?</p>
<ul>
<li><p>If app servers are <strong>stateless</strong>, request 1 can go to server A and request 2 to server C, and nothing breaks. You can add or remove servers at any time.</p>
</li>
<li><p>If app servers are <strong>stateful</strong> (for example sessions stored in local memory), then a user must keep going to the same server ("sticky sessions"). If that server dies, the user loses their session. Scaling becomes painful.</p>
</li>
</ul>
<p>The usual fix: <strong>move the state out</strong>. Store sessions in Redis or a database, files in object storage like S3, and keep the app servers stateless.</p>
<p>Then you have two different scaling problems:</p>
<ol>
<li><p><strong>Stateless tier (app servers):</strong> easy. Scale out horizontally behind a load balancer.</p>
</li>
<li><p><strong>Stateful tier (databases):</strong> hard. Scale up first, add read replicas, and when that is not enough, <strong>shard</strong>.</p>
</li>
</ol>
<hr />
<h2>5. How Instagram did it</h2>
<p>Instagram's December 2011 engineering post ("What Powers Instagram") described their stack. Their core rules were to keep things very simple, not reinvent the wheel, and use proven technologies. Here is the shape of it, simplified:</p>
<h3>The front door: load balancing</h3>
<p>Every request first hit <strong>load balancers</strong>. Instagram used to run two NGINX machines with <strong>DNS round robin</strong> between them. The problem was that DNS changes take time to spread when a machine had to be removed. So they moved to <strong>Amazon's Elastic Load Balancer (ELB)</strong>, with three NGINX instances behind it. NGINX machines that failed a <strong>health check</strong> were taken out of rotation automatically. They also <strong>terminated SSL at the ELB</strong> to save CPU on NGINX, and used <strong>Route 53</strong> for DNS.</p>
<h3>The app tier: stateless Django servers</h3>
<p>Behind that ran <strong>Django</strong> application servers on AWS EC2 (High-CPU Extra-Large instances at the time). As usage grew, they went from a few app servers to <strong>more than 25</strong>. The post says this tier was easy to scale horizontally <strong>because the servers were stateless</strong>. That is the exact pattern from section 4.</p>
<h3>The data tier: PostgreSQL, then sharding</h3>
<p>Most of Instagram's data (users, photo metadata, tags and so on) lived in <strong>PostgreSQL</strong>. One database server could not hold it all, so they <strong>sharded</strong> it.</p>
<p>Their "Sharding &amp; IDs at Instagram" post explains how:</p>
<ul>
<li><p>They created <strong>several thousand "logical" shards</strong>, mapped in code to <strong>far fewer physical</strong> database servers.</p>
</li>
<li><p>Each logical shard was a <strong>PostgreSQL schema</strong> (a named group of tables inside one database).</p>
</li>
<li><p>To grow, they could <strong>move logical shards</strong> from one physical server to another, without re-bucketing their data.</p>
</li>
<li><p>They generated unique <strong>64-bit IDs</strong> inside PostgreSQL itself: time-based bits, the shard ID, and a sequence number. That way IDs were unique across all shards and roughly sorted by time.</p>
</li>
</ul>
<p>They also used <strong>streaming replication</strong> (replicas in another availability zone) and <strong>PgBouncer</strong> to pool database connections.</p>
<p>So Instagram used <strong>both</strong> kinds of scaling:</p>
<ul>
<li><p><strong>Horizontal</strong> for the stateless app servers: just add more.</p>
</li>
<li><p><strong>Vertical, then sharded</strong> for the stateful database: big memory-heavy instances, and data split across many of them.</p>
</li>
</ul>
<p><strong>Lesson for us:</strong> Instagram did not invent new technology. It used boring, proven parts (load balancers, stateless app servers, PostgreSQL) and scaled each tier in the way that fits that tier.</p>
<hr />
<h2>6. What is sharding, simply?</h2>
<p><strong>Sharding</strong> means splitting one big dataset into smaller pieces called <strong>shards</strong>, and putting them on different database servers. Each shard holds a subset of the data, for example all data for users whose ID falls in a certain bucket.</p>
<pre><code class="language-plaintext">user_id % number_of_logical_shards  → logical shard (schema)
logical shard                       → physical database server
</code></pre>
<p><strong>Benefits:</strong> each server handles less data and fewer queries, so you can grow almost without limit.</p>
<p><strong>Costs:</strong></p>
<ul>
<li><p>Queries across shards are harder (for example "top photos across all users").</p>
</li>
<li><p>Transactions across shards are hard.</p>
</li>
<li><p>You must choose a good <strong>shard key</strong>. A bad key creates "hot" shards that get most of the traffic.</p>
</li>
<li><p>Moving data between shards needs planning. Instagram's logical-shard trick exists exactly to make this easier.</p>
</li>
</ul>
<p>That is why the interview line is "<strong>shard stateful parts carefully</strong>". Sharding is powerful, but it is a one-way door for many designs.</p>
<hr />
<h2>7. The example visuals</h2>
<p>The "4 CPU vs 64 CPU" servers and the "App 1–4" and "Shard 1–4" boxes in the Reel are <strong>examples</strong> to show the idea. They are not Instagram's real instance sizes or counts. The real numbers from the 2011 post were 25+ Django app servers and a main shard cluster of 12 large PostgreSQL instances (plus 12 replicas in another zone).</p>
<hr />
<h2>8. A quick comparison table</h2>
<table>
<thead>
<tr>
<th></th>
<th>Vertical (scale up)</th>
<th>Horizontal (scale out)</th>
</tr>
</thead>
<tbody><tr>
<td>How</td>
<td>Bigger machine</td>
<td>More machines + load balancer</td>
</tr>
<tr>
<td>Code changes</td>
<td>Usually none</td>
<td>App must be stateless</td>
</tr>
<tr>
<td>Limit</td>
<td>Biggest machine available</td>
<td>Very high</td>
</tr>
<tr>
<td>Failure</td>
<td>Single point of failure</td>
<td>One machine can fail safely</td>
</tr>
<tr>
<td>Best for</td>
<td>Databases (first step), legacy apps</td>
<td>Web/app servers, workers</td>
</tr>
<tr>
<td>Cloud tools</td>
<td>Change instance type</td>
<td>Auto Scaling groups, Kubernetes HPA</td>
</tr>
</tbody></table>
<hr />
<h2>9. How to answer this in an interview</h2>
<p><strong>Question:</strong> <em>"How do you scale a stateful vs a stateless service?"</em></p>
<p><strong>Strong answer:</strong></p>
<blockquote>
<p>"For stateless services, I scale horizontally: run many copies behind a load balancer with health checks, and use auto scaling. To make that work I keep state out of the app servers, with sessions in Redis or a database and files in S3. For stateful services like databases, I scale up first, add read replicas for read traffic, add caching, and when one primary isn't enough, I shard by a good key. Instagram is a classic example: stateless Django app servers that were easy to scale out, behind an ELB, and PostgreSQL sharded into thousands of logical shards on fewer physical servers. That let a very small team run a very large app."</p>
</blockquote>
<p><strong>Follow-ups to expect:</strong></p>
<ul>
<li><p><em>What are sticky sessions and why avoid them?</em> They tie a user to one server, which breaks even load spreading and loses sessions when that server dies.</p>
</li>
<li><p><em>Read replicas vs sharding?</em> Replicas copy all the data to scale reads. Shards split the data to scale reads and writes.</p>
</li>
<li><p><em>How do you pick a shard key?</em> High cardinality, even spread, and matching your main access pattern (for Instagram, mostly by user).</p>
</li>
<li><p><em>When is vertical scaling the right answer?</em> When it's cheap enough, the ceiling is far away, and simplicity matters more than unlimited growth.</p>
</li>
</ul>
<hr />
<h3>Sources</h3>
<ul>
<li><p>Los Angeles Times, "Facebook to snap up Instagram photo-sharing app for $1 billion" (10 Apr 2012): 13 employees, about 30 million users: <a href="https://www.latimes.com/business/la-xpm-2012-apr-10-la-fi-facebook-instagram-20120410-story.html">https://www.latimes.com/business/la-xpm-2012-apr-10-la-fi-facebook-instagram-20120410-story.html</a></p>
</li>
<li><p>The Atlantic, "Instagram Is Now Worth $77 Million Per Employee" (Apr 2012): 13 employees, 30M+ users: <a href="https://www.theatlantic.com/business/archive/2012/04/instagram-is-now-worth-77-million-per-employee/255640/">https://www.theatlantic.com/business/archive/2012/04/instagram-is-now-worth-77-million-per-employee/255640/</a></p>
</li>
<li><p>Instagram Engineering, "What Powers Instagram: Hundreds of Instances, Dozens of Technologies" (Dec 2011): 14M+ users, 3 engineers, ELB + NGINX, stateless Django app servers, PostgreSQL: <a href="https://instagram-engineering.com/what-powers-instagram-hundreds-of-instances-dozens-of-technologies-adf2e22da2ad">https://instagram-engineering.com/what-powers-instagram-hundreds-of-instances-dozens-of-technologies-adf2e22da2ad</a></p>
</li>
<li><p>Instagram Engineering, "Sharding &amp; IDs at Instagram": thousands of logical shards as PostgreSQL schemas, 64-bit IDs: <a href="https://instagram-engineering.com/sharding-ids-at-instagram-1cf5a71e5a5c">https://instagram-engineering.com/sharding-ids-at-instagram-1cf5a71e5a5c</a></p>
</li>
<li><p>High Scalability summary of the Instagram architecture (2011): <a href="https://highscalability.com/instagram-architecture-14-million-users-terabytes-of-photos/">https://highscalability.com/instagram-architecture-14-million-users-terabytes-of-photos/</a></p>
</li>
</ul>
<p><strong>Preparing for a Cloud, DevOps or SRE interview?</strong> Book a <strong>Free 15-min Cloud &amp; DevOps Interview Guidance Call</strong> with me: what to study, how to answer system-design and on-call questions, plus a CV and roadmap check 👉 <a href="https://topmate.io/cloudtechbydevang/2358399">https://topmate.io/cloudtechbydevang/2358399</a></p>
]]></content:encoded></item><item><title><![CDATA[Monolith vs Microservices: Why Amazon Split (and Prime Video Merged Back)]]></title><description><![CDATA[By Devang Pandya · Cloud Tech by Devang · Cloud • DevOps • AI — Made Simple
For about ten years, the loudest advice in software was: "Break your monolith into microservices." Then, in March 2023, a te]]></description><link>https://cloudtechbydevang.hashnode.dev/monolith-vs-microservices-why-amazon-split-and-prime-video-merged-back</link><guid isPermaLink="true">https://cloudtechbydevang.hashnode.dev/monolith-vs-microservices-why-amazon-split-and-prime-video-merged-back</guid><category><![CDATA[Microservices]]></category><category><![CDATA[monolith]]></category><category><![CDATA[System Design]]></category><category><![CDATA[AWS]]></category><category><![CDATA[serverless]]></category><category><![CDATA[software architecture]]></category><dc:creator><![CDATA[Devang Pandya]]></dc:creator><pubDate>Sat, 17 Oct 2026 13:59:13 GMT</pubDate><content:encoded><![CDATA[<p><em>By Devang Pandya · Cloud Tech by Devang · Cloud • DevOps • AI — Made Simple</em></p>
<p>For about ten years, the loudest advice in software was: "Break your monolith into microservices." Then, in March 2023, a team inside Amazon, the company most famous for microservices, published a blog post saying they had moved one service <em>back</em> into a single process and <strong>cut its infrastructure cost by over 90%</strong>.</p>
<p>The internet went wild. "Microservices are dead!" "Monoliths are back!" Both reactions were wrong.</p>
<p>In this post I will explain, in simple English, what a monolith is, what microservices are, why Amazon split its monolith in the early 2000s, and what the Prime Video team actually did in 2023. Then I'll give you a clear answer for the interview question: <em>"When would you choose a monolith over microservices?"</em> I have spent 14+ years in cloud, DevOps and SRE, and I have seen teams win and lose with both styles. The style is never the point. Fit is.</p>
<hr />
<h2>1. First, the basics</h2>
<h3>What is a monolith?</h3>
<p>A <strong>monolith</strong> is one application, built and deployed as <strong>one unit</strong>. All the features live in one codebase: login, product pages, cart, payments, emails. You build it once and deploy it once. Usually it talks to one main database.</p>
<p>Good things about a monolith:</p>
<ul>
<li><p><strong>Simple to start.</strong> One repo, one build, one deploy.</p>
</li>
<li><p><strong>Fast calls.</strong> One part of the code calls another as a normal function call, in memory. No network.</p>
</li>
<li><p><strong>Easy to debug.</strong> One process, one log stream, one stack trace.</p>
</li>
<li><p><strong>Easy transactions.</strong> One database means one place to keep data consistent.</p>
</li>
</ul>
<p>Problems as it grows:</p>
<ul>
<li><p><strong>Everyone shares everything.</strong> A small change by one team needs a full redeploy of the whole app.</p>
</li>
<li><p><strong>Scaling is all-or-nothing.</strong> If only search is busy, you still scale the whole app.</p>
</li>
<li><p><strong>One bug can take everything down.</strong> A memory leak in one feature can crash the whole process.</p>
</li>
<li><p><strong>Unclear ownership.</strong> When 200 engineers touch one codebase, nobody owns anything fully.</p>
</li>
</ul>
<h3>What are microservices?</h3>
<p><strong>Microservices</strong> split the application into <strong>small, separate services</strong>. Each service does one job (for example orders, search, payments), owns its own data, and talks to others over the network through an API. Each service is owned by one team and can be <strong>deployed on its own</strong>.</p>
<p>Good things:</p>
<ul>
<li><p><strong>Independent deploys.</strong> The payments team can ship without waiting for the search team.</p>
</li>
<li><p><strong>Independent scaling.</strong> Scale only the busy service.</p>
</li>
<li><p><strong>Smaller blast radius.</strong> If recommendations fail, checkout can still work.</p>
</li>
<li><p><strong>Clear ownership.</strong> One team, one service, end to end.</p>
</li>
</ul>
<p>Costs:</p>
<ul>
<li><p><strong>Network calls everywhere.</strong> Calls are slower and can fail. You need timeouts, retries and circuit breakers.</p>
</li>
<li><p><strong>Harder debugging.</strong> One user request may touch ten services. You need distributed tracing.</p>
</li>
<li><p><strong>Data is split.</strong> No single database transaction across services.</p>
</li>
<li><p><strong>More infrastructure.</strong> More pipelines, more monitoring, more things to secure and pay for.</p>
</li>
</ul>
<p>Microservices are a trade. You pay in complexity to buy team independence and independent scaling.</p>
<hr />
<h2>2. Why Amazon split its monolith</h2>
<p>In a 2006 interview with ACM Queue, Amazon's CTO Werner Vogels described how Amazon.com started as a <strong>monolithic application</strong>: a web server talking to a database on the back end. That application held all the business logic and display logic.</p>
<p>He explained that by <strong>2001</strong> it was clear the front-end application could not scale any more. The problem was not only performance. Many complex pieces were combined into one system, so it could not evolve. Parts that needed to scale on their own were tied to shared resources, and there was <strong>no isolation and no clear ownership</strong>. The shared databases were also hard to scale.</p>
<p>So Amazon moved to a <strong>service-oriented architecture</strong>. In Amazon's version, each service owns its data together with the business logic, and the only way in is through a published service interface. No other team may read the service's database directly. Over time this grew into <strong>hundreds of services</strong>. In that interview Vogels said that a single Amazon.com page could call more than 100 services to build it.</p>
<p>The team side mattered just as much as the technology. AWS describes Amazon's <strong>two-pizza teams</strong>: a team small enough to be fed by two pizzas, ideally fewer than 10 people, with single-threaded ownership of one service. Vogels' famous line from the same interview sums up the culture: <strong>"You build it, you run it."</strong> The team that writes the service also operates it.</p>
<p><strong>Lesson for us:</strong> Amazon did not split its monolith because microservices were fashionable. (Vogels even said they did it before "service-oriented" was a buzzword.) They split because the monolith was blocking <strong>team speed</strong> and <strong>scaling</strong>, and they had the scale to justify the cost.</p>
<hr />
<h2>3. Prime Video: when distributed was the wrong choice</h2>
<p>Now the 2023 story. It is about one specific tool, not all of Prime Video.</p>
<p>Prime Video's <strong>Video Quality Analysis (VQA)</strong> team owns a tool that checks video streams for quality problems, for example corrupted frames or audio and video going out of sync. They needed it to monitor <strong>thousands of concurrent streams</strong>, and to grow beyond that.</p>
<h3>The original design</h3>
<p>The first version was a <strong>distributed, serverless design</strong>:</p>
<ul>
<li><p><strong>AWS Step Functions</strong> orchestrated the workflow.</p>
</li>
<li><p><strong>AWS Lambda</strong> functions ran the detectors.</p>
</li>
<li><p><strong>Amazon S3</strong> stored video frames between the steps, so each component could pick them up.</p>
</li>
</ul>
<p>On paper this looks perfect: serverless, independently scalable pieces.</p>
<h3>What went wrong</h3>
<p>According to the Prime Video Tech blog (Marcin Kolny, 22 March 2023):</p>
<ul>
<li><p>The design <strong>hit a hard scaling limit at around 5% of the expected load.</strong></p>
</li>
<li><p><strong>Orchestration was the main bottleneck.</strong> The service did several state transitions for every second of every stream, so it quickly hit account limits. And Step Functions charges per state transition.</p>
</li>
<li><p><strong>Passing data between components was expensive.</strong> Every frame went into S3 and was read back out, which cost a lot at this volume.</p>
</li>
</ul>
<h3>The fix</h3>
<p>The team moved all the components into <strong>a single process</strong>. Frames now moved <strong>in memory</strong> instead of through S3, and the orchestration logic ran inside the same instance. They deployed it on <strong>Amazon EC2 and Amazon ECS</strong>, and scaled by running more copies of the whole process.</p>
<p>The result, in their words: moving to a monolith <strong>cut infrastructure cost by over 90%</strong> and <em>increased</em> their ability to scale. They could handle thousands of streams with room to grow, and could also use EC2 compute savings plans to lower costs further.</p>
<h3>What it does NOT mean</h3>
<ul>
<li><p>It does <strong>not</strong> mean Amazon or Prime Video dropped microservices. This was one service.</p>
</li>
<li><p>Some engineers argued the new design is really "one bigger microservice". It still runs as a separate service, just not split into tiny serverless steps. That is a fair point. The real lesson is about <strong>where you draw the boundaries</strong>.</p>
</li>
<li><p>It does <strong>not</strong> mean serverless is bad. Serverless is great for spiky, event-driven work. It was a poor fit here because the workload moved <strong>huge amounts of data</strong> between steps at <strong>high, steady volume</strong>.</p>
</li>
</ul>
<p><strong>Lesson for us:</strong> if two parts of your system exchange large amounts of data all the time, putting a network (or S3) between them is expensive. Keep tightly connected, data-heavy steps together.</p>
<hr />
<h2>4. Putting the two stories side by side</h2>
<table>
<thead>
<tr>
<th></th>
<th>Amazon.com (early 2000s)</th>
<th>Prime Video VQA (2023)</th>
</tr>
</thead>
<tbody><tr>
<td>Starting point</td>
<td>Monolith</td>
<td>Distributed serverless (Step Functions + Lambda + S3)</td>
</tr>
<tr>
<td>Main pain</td>
<td>No isolation, no ownership, shared databases, can't scale</td>
<td>Scaling limit at ~5% of load, high orchestration and data-transfer cost</td>
</tr>
<tr>
<td>Move</td>
<td>Split into services, two-pizza teams</td>
<td>Merged components into one process on EC2/ECS</td>
</tr>
<tr>
<td>Why it worked</td>
<td>Many teams needed to move independently</td>
<td>Components were tightly coupled and moved lots of data</td>
</tr>
</tbody></table>
<p>Both teams made the <strong>right call for their problem</strong>. That's the whole point.</p>
<hr />
<h2>5. A simple decision guide</h2>
<p>These are rules of thumb from my experience, not laws.</p>
<p><strong>Start with a monolith (or a "modular monolith") when:</strong></p>
<ul>
<li><p>You are a small team (one or two teams).</p>
</li>
<li><p>The product is new and the boundaries are not clear yet.</p>
</li>
<li><p>Parts of the system share a lot of data and change together.</p>
</li>
<li><p>You want to move fast with few operational costs.</p>
</li>
</ul>
<p>A <strong>modular monolith</strong> is a good middle path: one deployable app, but with clean internal modules and clear interfaces between them. If a module later needs to scale or move on its own, you can pull it out into a service.</p>
<p><strong>Move to microservices when:</strong></p>
<ul>
<li><p>Many teams are blocked by each other's releases.</p>
</li>
<li><p>Different parts have very different scaling needs (for example search vs. account settings).</p>
</li>
<li><p>You need a smaller blast radius for critical paths like checkout.</p>
</li>
<li><p>You have the platform maturity: CI/CD, monitoring, tracing, on-call.</p>
</li>
</ul>
<p><strong>Warning signs you split too much:</strong></p>
<ul>
<li><p>One user action needs a long chain of synchronous calls.</p>
</li>
<li><p>Services always deploy together ("distributed monolith").</p>
</li>
<li><p>Huge data moves between services on every request.</p>
</li>
<li><p>Your cloud bill is dominated by data transfer and orchestration, not real work.</p>
</li>
</ul>
<hr />
<h2>6. The example visuals</h2>
<p>The service names in the Reel (Orders, Search, Payments, Catalog) are <strong>examples</strong> to show the idea of splitting an app. They are not an official list of Amazon's services. The Prime Video before/after diagram is a simplified version of the architecture the team described.</p>
<hr />
<h2>7. How to answer this in an interview</h2>
<p><strong>Question:</strong> <em>"When would you choose a monolith over microservices?"</em></p>
<p><strong>Strong answer:</strong></p>
<blockquote>
<p>"I'd start with a well-structured monolith when the team is small, the domain isn't clear yet, or the parts share a lot of data, because it's simpler, cheaper and faster to change. I'd split out services when teams are blocking each other or parts need to scale differently. Amazon split its monolith in the early 2000s for exactly those reasons, with two-pizza teams owning services. But the split has costs: network calls, data transfer, and operational overhead. Prime Video's video quality team showed that in 2023. Their Step Functions + Lambda + S3 design hit a limit at about 5% of the expected load, and putting it into one process on ECS cut infrastructure cost by over 90%. So I split when teams and scale need it, not by default."</p>
</blockquote>
<p><strong>Follow-ups to expect:</strong></p>
<ul>
<li><p><em>What is a distributed monolith?</em> Services that are split physically but still must deploy together. You get the costs of both styles and the benefits of neither.</p>
</li>
<li><p><em>How do you split a monolith safely?</em> The strangler fig pattern: put a router in front, move one feature at a time to a new service, and retire the old code path.</p>
</li>
<li><p><em>How do services share data?</em> Through APIs or events, not by reading each other's databases.</p>
</li>
<li><p><em>How do you handle a transaction across services?</em> Sagas: a series of local transactions with compensating actions if something fails.</p>
</li>
</ul>
<hr />
<h3>Sources</h3>
<ul>
<li><p>Marcin Kolny, Prime Video Tech, "Scaling up the Prime Video audio/video monitoring service and reducing costs by 90%" (22 Mar 2023). Archived copy: <a href="https://archive.is/h788m">https://archive.is/h788m</a></p>
</li>
<li><p>The New Stack, "Return of the Monolith: Amazon Dumps Microservices for Video Monitoring" (4 May 2023): <a href="https://thenewstack.io/return-of-the-monolith-amazon-dumps-microservices-for-video-monitoring/">https://thenewstack.io/return-of-the-monolith-amazon-dumps-microservices-for-video-monitoring/</a></p>
</li>
<li><p>The Stack, "Prime Video service dumps microservices, cuts AWS bill 90%" (May 2023): <a href="https://www.thestack.technology/amazon-prime-video-microservices-monolith/">https://www.thestack.technology/amazon-prime-video-microservices-monolith/</a></p>
</li>
<li><p>ACM Queue, "A Conversation with Werner Vogels" (2006): monolith until 2001, service-oriented architecture, 100+ services per page, "you build it, you run it": <a href="https://queue.acm.org/detail.cfm?id=1142065">https://queue.acm.org/detail.cfm?id=1142065</a></p>
</li>
<li><p>AWS Executive Insights, "Powering Innovation and Speed with Amazon's Two-Pizza Teams": <a href="https://aws.amazon.com/executive-insights/content/amazon-two-pizza-team/">https://aws.amazon.com/executive-insights/content/amazon-two-pizza-team/</a></p>
</li>
</ul>
<p><strong>Preparing for a Cloud, DevOps or SRE interview?</strong> Book a <strong>Free 15-min Cloud &amp; DevOps Interview Guidance Call</strong> with me: what to study, how to answer system-design and on-call questions, plus a CV and roadmap check 👉 <a href="https://topmate.io/cloudtechbydevang/2358399">https://topmate.io/cloudtechbydevang/2358399</a></p>
]]></content:encoded></item><item><title><![CDATA[What Actually Happens When You Type google.com and Press Enter]]></title><description><![CDATA[By Devang Pandya · Cloud Tech by Devang · Cloud • DevOps • AI — Made Simple
You type google.com into your browser and press Enter. Less than a second later, the page is on your screen. It feels like n]]></description><link>https://cloudtechbydevang.hashnode.dev/what-actually-happens-when-you-type-google-com-and-press-enter</link><guid isPermaLink="true">https://cloudtechbydevang.hashnode.dev/what-actually-happens-when-you-type-google-com-and-press-enter</guid><dc:creator><![CDATA[Devang Pandya]]></dc:creator><pubDate>Fri, 16 Oct 2026 14:07:19 GMT</pubDate><content:encoded><![CDATA[<p><em>By Devang Pandya · Cloud Tech by Devang · Cloud • DevOps • AI — Made Simple</em></p>
<p>You type <code>google.com</code> into your browser and press Enter. Less than a second later, the page is on your screen. It feels like nothing happened. In fact, a small relay race just ran across the internet: your laptop, your router, your internet provider, a DNS resolver, several name servers, and a Google server near you all took part.</p>
<p>"What happens when you type a URL and press Enter?" is one of the most common warm-up questions in cloud, DevOps and backend interviews. It looks simple. But it tests whether you really understand networking, security and caching, the three things that sit under every system you will ever build.</p>
<p>In this post I will walk through the whole journey in simple English, step by step. At the end I will give you a short answer you can say in an interview. I have spent 14+ years in cloud, DevOps and SRE, and almost every production incident I have debugged touched one of these steps: a stale DNS record, an expired certificate, a load balancer health check, or a missing cache.</p>
<hr />
<h2>The big picture first</h2>
<p>Here is the whole flow in one line:</p>
<p><strong>DNS → TCP → TLS → HTTP → render</strong>, with <strong>caching at every step</strong>.</p>
<ol>
<li><p><strong>DNS</strong> turns the name <code>google.com</code> into an IP address.</p>
</li>
<li><p><strong>TCP</strong> opens a reliable connection to that IP address.</p>
</li>
<li><p><strong>TLS</strong> makes the connection private and proves you are talking to the real Google.</p>
</li>
<li><p><strong>HTTP</strong> sends your request and brings back the page.</p>
</li>
<li><p>Your <strong>browser</strong> draws the page, and fetches more files it needs.</p>
</li>
</ol>
<p>Modern browsers can also use <strong>HTTP/3</strong>, which runs over <strong>QUIC</strong> on UDP instead of TCP. QUIC combines the connection and encryption steps. I will cover that near the end. First, let's take the classic path, step by step.</p>
<hr />
<h2>1. DNS: finding the address</h2>
<p>Computers do not talk to names. They talk to <strong>IP addresses</strong>, such as <code>142.250.x.x</code> (IPv4) or a longer IPv6 address. <strong>DNS</strong> (Domain Name System) is the internet's phone book. It turns a name into an address.</p>
<h3>Step 1a: check the caches close to you</h3>
<p>Before asking anyone on the internet, your computer checks what it already knows:</p>
<ul>
<li><p><strong>Browser cache.</strong> Browsers keep recent DNS answers for a short time. (In Chrome you can see this at <code>chrome://net-internals/#dns</code>.)</p>
</li>
<li><p><strong>Operating system cache.</strong> If the browser does not have it, it asks the OS. The part of the OS that does this is called the <strong>stub resolver</strong>.</p>
</li>
</ul>
<p>Every DNS answer comes with a <strong>TTL</strong> (time to live). The TTL says how many seconds you may keep that answer before you must ask again. If a cached answer is still within its TTL, the lookup ends right here. That is why the second visit to a site is often faster than the first.</p>
<h3>Step 1b: ask the recursive resolver</h3>
<p>If there is no cached answer, your OS sends the question to a <strong>recursive resolver</strong>. This is usually run by your internet provider, or a public resolver like Google Public DNS (<code>8.8.8.8</code>) or Cloudflare (<code>1.1.1.1</code>).</p>
<p>The resolver's job is to find the answer for you. It also has a big cache. Many people use the same resolver, so popular names like <code>google.com</code> are usually already cached there.</p>
<h3>Step 1c: the full walk (when nothing is cached)</h3>
<p>If the resolver has nothing cached, it walks down the DNS tree:</p>
<ol>
<li><p>It asks a <strong>root name server</strong>: "Who handles <code>.com</code>?" The root replies with the addresses of the <code>.com</code> servers.</p>
</li>
<li><p>It asks a <code>.com</code> <strong>TLD (top-level domain) name server</strong>: "Who handles <code>google.com</code>?" The TLD server replies with Google's own name servers.</p>
</li>
<li><p>It asks <strong>Google's authoritative name server</strong>: "What is the IP address of <code>google.com</code>?" This server holds the real record and gives the final answer.</p>
</li>
<li><p>The resolver sends the IP address back to your computer, and caches it for next time.</p>
</li>
</ol>
<p>In real life, most lookups skip some of these steps because of caching. Resolvers keep the <code>.com</code> server list and Google's name server list in cache too, so the full walk is rare for popular sites.</p>
<p>One more thing worth knowing: big companies like Google may return <strong>different IP addresses to different users</strong>, depending on where the user is. This is one way they send you to a nearby server. (I cover this, and anycast, in topic 006 of this series.)</p>
<p><strong>Lesson for us:</strong> DNS is a cache-heavy system. When you change a DNS record in production, the old answer can live on in caches until its TTL runs out. Lower the TTL <em>before</em> a planned migration, not during it.</p>
<hr />
<h2>2. TCP: opening a reliable connection</h2>
<p>Now your browser knows the IP address. Next, it needs a reliable connection to it. The classic way is <strong>TCP</strong> (Transmission Control Protocol), on port <strong>443</strong> for HTTPS.</p>
<p>TCP gives you three promises: data arrives <strong>in order</strong>, <strong>without gaps</strong>, and <strong>without duplicates</strong>. To set this up, both sides first agree on starting sequence numbers. They do this with the famous <strong>three-way handshake</strong>:</p>
<ol>
<li><p><strong>SYN.</strong> Your computer says: "I want to talk. Here is my starting number."</p>
</li>
<li><p><strong>SYN-ACK.</strong> The server says: "OK. I got your number. Here is mine."</p>
</li>
<li><p><strong>ACK.</strong> Your computer says: "Got yours. We are connected."</p>
</li>
</ol>
<p>This costs <strong>one round trip</strong> before any useful data can flow. A round trip (RTT) is the time for a message to go to the server and back. If the server is 100 ms away, the handshake alone costs about 100 ms. That is why physical distance matters so much, and why big companies put servers close to users.</p>
<p><strong>Lesson for us:</strong> reuse connections. Keep-alive connections, connection pooling in your apps, and HTTP/2 multiplexing all exist so you don't pay the handshake cost again and again.</p>
<hr />
<h2>3. TLS: making it private and proving who you are talking to</h2>
<p>The <code>S</code> in <code>HTTPS</code> means the connection is protected by <strong>TLS</strong> (Transport Layer Security). TLS does two jobs:</p>
<ol>
<li><p><strong>Encryption.</strong> Nobody in the middle (your Wi-Fi, your ISP, anyone else) can read or change the data.</p>
</li>
<li><p><strong>Authentication.</strong> The server shows a <strong>certificate</strong>, signed by a trusted certificate authority. Your browser checks that the certificate is valid and really belongs to <code>google.com</code>.</p>
</li>
</ol>
<p>With <strong>TLS 1.3</strong> (RFC 8446, published in 2018), a full handshake takes just <strong>one round trip</strong> (often called <strong>1-RTT</strong>). Older TLS 1.2 handshakes needed two round trips. So TLS 1.3 made every new HTTPS connection faster.</p>
<p>In simple terms, the TLS 1.3 handshake goes like this:</p>
<ul>
<li><p>Your browser sends a "hello" with the encryption options it supports and its share of a key exchange.</p>
</li>
<li><p>The server replies with its choices, its key share, its certificate and a proof that it owns the certificate.</p>
</li>
<li><p>Both sides now compute the same secret keys, and encrypted data can flow.</p>
</li>
</ul>
<p>TLS 1.3 also has a <strong>0-RTT</strong> mode for repeat visits, where the browser can send some data in its very first message. It is faster, but that early data can be replayed by an attacker, so servers only allow it for safe requests.</p>
<p><strong>Lesson for us:</strong> a huge number of real outages are simply <strong>expired certificates</strong>. Automate renewal (for example with ACM on AWS, or cert-manager on Kubernetes) and alert well before expiry.</p>
<hr />
<h2>4. The request reaches Google: the Google Front End</h2>
<p>Now your encrypted connection is open. Who is on the other end? Not the server that builds your search page. You are talking to Google's edge.</p>
<p>Google's own security design paper explains that when a service needs to be on the internet, it registers with an infrastructure service called the <strong>Google Front End (GFE)</strong>. The GFE <strong>terminates TLS</strong> with the correct certificates and best practices, and it adds protection against denial-of-service attacks. Then it forwards your request to the right <strong>backend service</strong> inside Google's network.</p>
<p>This pattern is not special to Google. Almost every large website works the same way:</p>
<ul>
<li><p>A <strong>front end / edge layer</strong> (load balancer, reverse proxy, CDN) that faces the internet.</p>
</li>
<li><p><strong>Backend services</strong> that do the real work, hidden behind it.</p>
</li>
</ul>
<p>On AWS, you would build the same shape with <strong>CloudFront</strong> and an <strong>Application Load Balancer</strong> in front of your services. On Google Cloud, the external Application Load Balancer runs on the same front-end idea.</p>
<p><strong>Lesson for us:</strong> never expose your app servers directly to the internet. Put a load balancer or reverse proxy in front. It terminates TLS, absorbs attacks, and lets you add or remove servers without users noticing.</p>
<hr />
<h2>5. HTTP: the actual request and response</h2>
<p>Inside the encrypted connection, your browser sends an <strong>HTTP request</strong>:</p>
<pre><code class="language-plaintext">GET / HTTP/2
Host: www.google.com
User-Agent: ...
Accept: text/html
Cookie: ...
</code></pre>
<p>The server sends back an <strong>HTTP response</strong>: a status code (for example <code>200 OK</code>, or a <code>301</code> redirect from <code>google.com</code> to <code>www.google.com</code>), some headers, and the HTML of the page.</p>
<p>There are three main versions of HTTP in use today:</p>
<table>
<thead>
<tr>
<th>Version</th>
<th>Runs on</th>
<th>Key idea</th>
</tr>
</thead>
<tbody><tr>
<td>HTTP/1.1</td>
<td>TCP</td>
<td>One request at a time per connection</td>
</tr>
<tr>
<td>HTTP/2</td>
<td>TCP</td>
<td>Many requests at once on one connection (multiplexing)</td>
</tr>
<tr>
<td>HTTP/3</td>
<td><strong>QUIC</strong> (on UDP)</td>
<td>Like HTTP/2, but without TCP's "one lost packet blocks everything" problem</td>
</tr>
</tbody></table>
<p>HTTP/3 is defined in RFC 9114. It uses the <strong>QUIC</strong> transport, which handles reliability, streams and flow control itself, and has TLS 1.3 built in. That is why with QUIC the connection setup and the encryption setup happen together, saving a round trip compared with TCP + TLS.</p>
<p>Google created the early version of QUIC, and Google's services widely support HTTP/3. Your browser and the server agree on which version to use. Older networks or browsers fall back to HTTP/2 or HTTP/1.1 over TCP.</p>
<hr />
<h2>6. The browser draws the page</h2>
<p>The HTML is only the start. The browser reads it and finds more things it needs: CSS, JavaScript, images, fonts. It fetches them too, often from the same connection (thanks to HTTP/2 or HTTP/3) or from CDN servers. Then it builds the page structure (the DOM), applies styles, runs scripts, and paints pixels on your screen.</p>
<p>This part is mostly front-end engineering, but it matters for cloud people too: a slow page is often not a slow server, but too many files, no compression, or no caching headers.</p>
<hr />
<h2>7. Caching at every step</h2>
<p>If you remember one thing from this post, remember this. <strong>Every step has a cache, and caching is why the web feels fast.</strong></p>
<table>
<thead>
<tr>
<th>Step</th>
<th>Where the cache lives</th>
<th>What it saves</th>
</tr>
</thead>
<tbody><tr>
<td>DNS</td>
<td>Browser, OS, recursive resolver</td>
<td>The whole DNS walk</td>
</tr>
<tr>
<td>TCP/TLS</td>
<td>Connection reuse, TLS session resumption</td>
<td>New handshakes</td>
</tr>
<tr>
<td>HTTP</td>
<td>Browser cache, CDN edge, reverse proxy</td>
<td>The trip to the origin server</td>
</tr>
<tr>
<td>Backend</td>
<td>In-memory caches (Redis, Memcached)</td>
<td>Database queries</td>
</tr>
</tbody></table>
<p>The first visit pays the full price. The second visit is cheaper at almost every layer.</p>
<hr />
<h2>8. A simple diagram</h2>
<p>The diagrams in the Reel and here are simplified <strong>examples</strong> for teaching. Real flows have more steps (for example CNAME records, redirects and CDN layers).</p>
<pre><code class="language-plaintext">You type google.com + Enter
   │
   ▼
[Browser cache] → [OS cache] → [Recursive resolver]
                                   │ (if not cached)
                                   ├─► Root server  ("ask .com")
                                   ├─► .com server  ("ask Google's name servers")
                                   └─► Google name server ("here is the IP")
   │
   ▼
TCP handshake (SYN, SYN-ACK, ACK)  ── 1 round trip
   │
   ▼
TLS 1.3 handshake                   ── 1 round trip
   │
   ▼
Google Front End (near you) → backend service → HTML
   │
   ▼
Browser renders the page, fetches CSS/JS/images
</code></pre>
<hr />
<h2>9. How to answer this in an interview</h2>
<p><strong>Short answer (30 seconds):</strong></p>
<blockquote>
<p>"First, DNS turns google.com into an IP address. The browser and OS check their caches, then a recursive resolver asks the root, the .com servers and Google's name servers. Then the browser opens a TCP connection with a three-way handshake, and TLS 1.3 sets up encryption in one round trip. The request reaches a Google Front End near me, which terminates TLS and forwards it to a backend. The response comes back over HTTP/2 or HTTP/3, which runs on QUIC, and the browser renders the page. And there's caching at every step: DNS, connections, CDN and the backend."</p>
</blockquote>
<p><strong>Follow-up questions to expect:</strong></p>
<ul>
<li><p><em>What is a TTL and why does it matter?</em> How long a DNS answer can be cached. It controls how fast DNS changes spread.</p>
</li>
<li><p><em>Why is TLS 1.3 faster than TLS 1.2?</em> One round trip for a full handshake instead of two.</p>
</li>
<li><p><em>Why does HTTP/3 use UDP?</em> QUIC builds its own reliability on UDP, so one lost packet only blocks its own stream, and it combines the transport and TLS handshakes.</p>
</li>
<li><p><em>Where would you put a load balancer?</em> At the edge, terminating TLS, in front of stateless app servers.</p>
</li>
<li><p><em>How would you debug a slow page?</em> Check DNS time, connect time, TLS time and time to first byte separately (for example with <code>curl -w</code> or browser dev tools).</p>
</li>
</ul>
<p><strong>A senior touch:</strong> mention failure points. DNS misconfiguration, an expired certificate, an unhealthy backend behind the load balancer, or a cold cache after a deploy. Interviewers love when you connect the theory to real incidents.</p>
<hr />
<h2>10. Try it yourself</h2>
<p>You can see each step on your own machine:</p>
<pre><code class="language-bash">dig google.com                 # DNS answer and TTL
dig +trace google.com          # the full root → .com → Google walk
curl -so /dev/null -w "dns:%{time_namelookup} connect:%{time_connect} tls:%{time_appconnect} ttfb:%{time_starttransfer}\n" https://www.google.com
</code></pre>
<p>Run the <code>curl</code> command twice and compare. The difference is caching at work.</p>
<hr />
<h3>Sources</h3>
<ul>
<li><p>Cloudflare Learning Center, "What is DNS?" (resolution steps, browser/OS caching, TTL): <a href="https://www.cloudflare.com/learning/dns/what-is-dns/">https://www.cloudflare.com/learning/dns/what-is-dns/</a></p>
</li>
<li><p>RFC 9293, Transmission Control Protocol (TCP), section 3.5 "Establishing a Connection" (three-way handshake): <a href="https://www.rfc-editor.org/rfc/rfc9293">https://www.rfc-editor.org/rfc/rfc9293</a></p>
</li>
<li><p>RFC 8446, The Transport Layer Security (TLS) Protocol Version 1.3 (1-RTT handshake, 0-RTT data and replay): <a href="https://www.rfc-editor.org/rfc/rfc8446">https://www.rfc-editor.org/rfc/rfc8446</a></p>
</li>
<li><p>Google Cloud, "Google infrastructure security design overview" (Google Front End terminates TLS and fronts internet-facing services): <a href="https://cloud.google.com/docs/security/infrastructure/design">https://cloud.google.com/docs/security/infrastructure/design</a></p>
</li>
<li><p>RFC 9114, HTTP/3 (HTTP over the QUIC transport): <a href="https://www.rfc-editor.org/rfc/rfc9114">https://www.rfc-editor.org/rfc/rfc9114</a></p>
</li>
<li><p>Google Public DNS FAQ (anycast resolver): <a href="https://developers.google.com/speed/public-dns/faq">https://developers.google.com/speed/public-dns/faq</a></p>
</li>
</ul>
<p><strong>Preparing for a Cloud, DevOps or SRE interview?</strong> Book a <strong>Free 15-min Cloud &amp; DevOps Interview Guidance Call</strong> with me: what to study, how to answer system-design and on-call questions, plus a CV and roadmap check 👉 <a href="https://topmate.io/cloudtechbydevang/2358399">https://topmate.io/cloudtechbydevang/2358399</a></p>
]]></content:encoded></item><item><title><![CDATA[How Netflix Serves 325M+ Members Without Going Down
]]></title><description><![CDATA[By Devang Pandya · Cloud Tech by Devang · Cloud • DevOps • AI — Made Simple
You open Netflix on a Friday night. You press Play. The video starts in a second or two, in good quality, with no buffering.]]></description><link>https://cloudtechbydevang.hashnode.dev/how-netflix-serves-325m-members-without-going-down</link><guid isPermaLink="true">https://cloudtechbydevang.hashnode.dev/how-netflix-serves-325m-members-without-going-down</guid><category><![CDATA[Cloud]]></category><category><![CDATA[System Design]]></category><category><![CDATA[Devops]]></category><category><![CDATA[netflix]]></category><dc:creator><![CDATA[Devang Pandya]]></dc:creator><pubDate>Thu, 15 Oct 2026 14:16:08 GMT</pubDate><content:encoded><![CDATA[<p><em>By Devang Pandya · Cloud Tech by Devang · Cloud • DevOps • AI — Made Simple</em></p>
<p>You open Netflix on a Friday night. You press Play. The video starts in a second or two, in good quality, with no buffering. Millions of other people around the world are doing the same thing at the same time.</p>
<p>Netflix crossed <strong>325 million paid memberships</strong> in late 2025. That is a huge number of people who expect the app to "just work". So how does Netflix stay up?</p>
<p>There is no single magic tool. It is a set of simple ideas, used with a lot of discipline. In this post I will explain these ideas in simple English. At the end, I will show you how to use them in a system design interview. I have spent 14+ years in cloud, DevOps and SRE, and I see the same patterns in every system that scales well, big or small.</p>
<hr />
<h2>1. It started with an outage</h2>
<p>In August 2008, Netflix had a major database corruption. For three days, it could not ship DVDs to its members.</p>
<p>For a DVD business, that was painful. For a streaming business, it would have been a disaster. If streaming had been down for three days, nobody could watch anything at all.</p>
<p>Netflix took one big lesson from this: <strong>a single, vertically scaled database is a single point of failure.</strong> "Vertically scaled" means you make one machine bigger and bigger. When that one machine breaks, everything breaks.</p>
<p>So Netflix decided to move to <strong>horizontally scalable, distributed systems in the cloud.</strong> "Horizontally scaled" means you add more machines instead of making one machine bigger. If one fails, the others keep working.</p>
<p>They chose <strong>AWS</strong> (Amazon Web Services). Most customer-facing systems were moved before 2015. In <strong>January 2016</strong>, after <strong>seven years</strong> of work, Netflix shut down the last data centre parts used by its streaming service.</p>
<p>The key point: Netflix did not just copy its old systems to the cloud ("lift and shift"). It rebuilt them. In their own words, they moved from a monolithic app to hundreds of microservices, and they changed their data model to use NoSQL databases.</p>
<p><strong>Lesson for us:</strong> moving to the cloud does not make you reliable by itself. Changing the design does.</p>
<hr />
<h2>2. Two paths: the "brain" and the "video"</h2>
<p>This is the most important idea in the whole post, so let's make it simple.</p>
<p>When you use Netflix, two very different kinds of work happen:</p>
<ol>
<li><p><strong>The brain (control plane).</strong> Logging in, choosing a profile, loading your home screen, showing recommendations, checking your plan and licence, and deciding <em>which server should send you the video</em>. This is lots of small requests. It runs on <strong>AWS</strong>.</p>
</li>
<li><p><strong>The video (data plane).</strong> The actual movie file: gigabytes of data flowing to your TV or phone. This comes from <strong>Open Connect</strong>, Netflix's own content delivery network (CDN).</p>
</li>
</ol>
<p>Here is what happens when you press Play:</p>
<ol>
<li><p>Your device sends a request to Netflix's front door on AWS. This front door is an <strong>API gateway</strong> called <strong>Zuul</strong>. It routes requests, helps with authentication, and can shed load when things go wrong.</p>
</li>
<li><p>Zuul sends the request to the right <strong>microservices</strong>: profiles, recommendations, licensing, playback and more.</p>
</li>
<li><p>The playback service looks at which video servers are healthy, which ones have your title, and which ones are closest to you on the network. It sends your device a <strong>ranked list of servers</strong> to stream from.</p>
</li>
<li><p>Your device downloads the video from an <strong>Open Connect server</strong>, often one that sits inside your own internet provider's network.</p>
</li>
</ol>
<p>Why split it like this? Because the two jobs need very different things. The brain needs flexibility, fast changes and lots of compute. The video needs huge bandwidth, close to the user. Putting each job on the right platform is cheaper and more reliable than forcing both into one place.</p>
<hr />
<h2>3. Open Connect: the video comes from near your home</h2>
<p>A <strong>CDN</strong> (content delivery network) is a group of servers spread around the world that keep copies of content close to users. Most companies rent a CDN. Netflix built its own, called <strong>Open Connect</strong>, starting around 2012.</p>
<p>As of December 2022, Netflix said it had <strong>18,000 servers in 6,000 locations across 175 countries.</strong></p>
<p>How it works, in simple steps:</p>
<ul>
<li><p><strong>Servers inside ISPs.</strong> Netflix gives its Open Connect Appliances (OCAs) <strong>free of charge</strong> to qualifying internet service providers. Netflix provides the hardware. The ISP provides rack space, power and network connection.</p>
</li>
<li><p><strong>Servers at internet exchanges.</strong> Netflix also places OCAs at internet exchange points, where many networks connect to each other, and peers with ISPs there.</p>
</li>
<li><p><strong>Filled at night.</strong> Netflix predicts what people will watch and copies those files onto the servers during off-peak hours, when the network is quiet. So when a big new show comes out, it is already sitting near you.</p>
</li>
<li><p><strong>Steered by the control plane.</strong> Each OCA reports its health, the routes it has learned (using BGP, the routing protocol of the internet) and the files it has to the Open Connect control plane, which runs in AWS. The control plane uses this data to point your device to the best server, and gives a list of options in case one fails.</p>
</li>
</ul>
<p>The result: the video travels a short distance. It starts faster, buffers less, and puts less load on the wider internet. Netflix estimated that in 2021 alone the program helped ISPs avoid about $1.25 billion in costs.</p>
<p><strong>Lesson for us:</strong> move heavy, read-only content as close to users as you can. You may not build your own CDN, but CloudFront, Cloud CDN, Akamai or Cloudflare give you the same idea.</p>
<hr />
<h2>4. Microservices: many small teams, many small services</h2>
<p>Netflix runs <strong>hundreds of microservices</strong>. Each one does one job well: one for profiles, one for viewing history, one for recommendations, and so on.</p>
<p>Why does this help reliability?</p>
<ul>
<li><p><strong>Small blast radius.</strong> If the recommendations service has a problem, you might see a simpler home screen, but you can still play a show. One broken part does not take down everything.</p>
</li>
<li><p><strong>Independent scaling.</strong> The playback service can scale up on a Friday night without scaling everything else.</p>
</li>
<li><p><strong>Independent deployments.</strong> Teams can release small changes often, instead of one big risky release.</p>
</li>
</ul>
<p>But microservices bring new problems. When one screen needs many service calls, a slow service can make everything slow. Netflix built (and open-sourced) tools to deal with this:</p>
<ul>
<li><p><strong>Eureka</strong> for service discovery (how services find each other).</p>
</li>
<li><p><strong>Ribbon</strong> for client-side load balancing.</p>
</li>
<li><p><strong>Hystrix</strong> for fault tolerance: it isolated calls between services, stopped one failure from spreading to others ("cascading failure"), and gave <strong>fallbacks</strong>, a simpler answer when a service could not respond.</p>
</li>
</ul>
<p>Netflix later moved to Spring Boot and Spring Cloud as its core Java framework (announced in 2018), and Hystrix is now in maintenance mode. But the ideas are still the base of every good microservice system: <strong>timeouts, retries with limits, circuit breakers, and fallbacks.</strong> Today you will see them in service meshes like Istio and Envoy, and in libraries like Resilience4j.</p>
<p>A key design rule at Netflix: <strong>many services are stateless.</strong> They do not keep important data in their own memory. They keep it in caches or databases. This makes it easy to add or remove servers, and even to serve any member from any AWS region.</p>
<hr />
<h2>5. Caching: don't ask the database every time</h2>
<p>Your home screen needs a lot of data, very fast: what you watched, what you rated, what rows to show. Hitting a database for every one of these would be slow and expensive.</p>
<p>So Netflix uses <strong>EVCache</strong>, a caching service built on <strong>Memcached</strong>. It keeps frequently read data in memory, so reads take milliseconds or less. Netflix's own blog says EVCache is used widely across its microservices and is open source.</p>
<p>Netflix also built <strong>global replication</strong> for EVCache. Its cloud runs in more than one AWS region (their blog named Northern Virginia, Oregon and Ireland). When data changes in one region, the change is sent to the other regions through a Kafka-based replication system. So if traffic moves to another region, the cache there is already warm.</p>
<p>There are really two layers of caching at Netflix:</p>
<ol>
<li><p><strong>Data cache</strong> (EVCache) for the brain.</p>
</li>
<li><p><strong>Content cache</strong> (Open Connect) for the video.</p>
</li>
</ol>
<p><strong>Lesson for us:</strong> find the data that is read often and changes rarely, and cache it. Think about what happens when the cache is empty ("cold"), and how you keep it fresh.</p>
<hr />
<h2>6. Chaos engineering: break things on purpose</h2>
<p>This is the part everyone remembers.</p>
<p>In 2011, Netflix wrote about <strong>Chaos Monkey</strong>, a tool that <strong>randomly shuts down production servers</strong>. Why would anyone do that?</p>
<p>Because in the cloud, servers <em>will</em> fail. Netflix's thinking was simple: if failure is going to happen anyway, make it happen often, in a controlled way, while engineers are awake and watching. Then you find weak spots and build automatic recovery. In their words, the goal was that when an instance fails at 3 AM on a Sunday, they won't even notice.</p>
<p>Chaos Monkey ran during business hours, in a carefully monitored environment, with engineers standing by. In July 2012, Netflix open-sourced it under the Apache License.</p>
<p>Chaos Monkey was the first member of the <strong>Simian Army</strong>:</p>
<ul>
<li><p><strong>Latency Monkey</strong> added artificial delays to test slow services.</p>
</li>
<li><p><strong>Conformity Monkey</strong> found servers that did not follow best practices.</p>
</li>
<li><p><strong>Chaos Gorilla</strong> simulated losing a whole AWS <strong>Availability Zone</strong>.</p>
</li>
<li><p><strong>Chaos Kong</strong> simulated losing a whole AWS <strong>region</strong>.</p>
</li>
</ul>
<p>Netflix practises <strong>region evacuation</strong>: moving all traffic out of one AWS region into the others. With a project called Nimble, which keeps extra capacity ready, Netflix said it cut evacuation time from about 50 minutes to about 8 minutes.</p>
<p><strong>Lesson for us:</strong> you don't need to start with production. Start with a game day in staging. Kill a pod. Block a dependency. Watch your alerts. Write down what surprised you. Make the blast radius small and grow it slowly. Today, tools like AWS Fault Injection Service, Chaos Mesh and LitmusChaos make this easier.</p>
<hr />
<h2>7. Putting it all together</h2>
<p>Here is the full picture in one place:</p>
<table>
<thead>
<tr>
<th>Problem</th>
<th>Netflix answer</th>
<th>What you can use</th>
</tr>
</thead>
<tbody><tr>
<td>One database = single point of failure</td>
<td>Distributed systems on AWS, NoSQL</td>
<td>Managed DBs with replicas, DynamoDB, Cassandra</td>
</tr>
<tr>
<td>Video is heavy and far away</td>
<td>Open Connect CDN inside ISPs</td>
<td>CloudFront, Cloud CDN, Cloudflare</td>
</tr>
<tr>
<td>One big app is hard to scale and change</td>
<td>Hundreds of microservices behind Zuul</td>
<td>API Gateway, Kubernetes, Ingress</td>
</tr>
<tr>
<td>One slow service slows everything</td>
<td>Timeouts, circuit breakers, fallbacks</td>
<td>Istio/Envoy, Resilience4j</td>
</tr>
<tr>
<td>Reads are slow and costly</td>
<td>EVCache, replicated across regions</td>
<td>ElastiCache, Memorystore, Redis</td>
</tr>
<tr>
<td>Failures surprise you at 3 AM</td>
<td>Chaos Monkey, Chaos Kong, region evacuation</td>
<td>AWS FIS, Chaos Mesh, game days</td>
</tr>
</tbody></table>
<p>None of these ideas is new on its own. What makes Netflix strong is that they use <strong>all of them together</strong>, and they practise failure as a normal part of work.</p>
<hr />
<h2>8. How to use this in a system design interview</h2>
<p>A very common interview question is: <strong>"Design a video streaming platform like Netflix."</strong></p>
<p>Here is a simple structure you can follow:</p>
<ol>
<li><p><strong>Clarify.</strong> How many users? Which regions? Live or on-demand? Which devices? What matters most: start time, quality, cost?</p>
</li>
<li><p><strong>Split control plane and data plane.</strong> APIs (login, catalogue, recommendations, playback decisions) on the cloud. Video delivery on a CDN. Say this early. It shows you understand the problem.</p>
</li>
<li><p><strong>Content pipeline.</strong> Upload, encode into many bitrates and formats, store in object storage (like S3), push popular content to the CDN before peak hours.</p>
</li>
<li><p><strong>Playback flow.</strong> Client asks the playback service, which returns a ranked list of CDN servers. The client uses adaptive bitrate streaming, so quality goes down instead of stopping when the network is slow.</p>
</li>
<li><p><strong>Scale and reliability.</strong> Stateless microservices with auto-scaling. Caching for hot data. Multi-AZ always, multi-region for critical services. Timeouts, retries and circuit breakers between services.</p>
</li>
<li><p><strong>Prove it.</strong> Monitoring on key metrics (stream starts per second is a great business metric), alerts, and chaos testing.</p>
</li>
<li><p><strong>Trade-offs.</strong> Own CDN vs rented CDN. Active-active multi-region (more cost, faster recovery) vs active-passive (cheaper, slower recovery). Strong vs eventual consistency for things like viewing history.</p>
</li>
</ol>
<p><strong>Senior tip:</strong> interviewers listen for trade-offs and for real experience. If you can, add one line from your own work, for example: "In my last project we put static content behind a CDN and cut origin load by X%." Numbers and your role make the answer believable.</p>
<hr />
<h2>9. Key takeaways</h2>
<ul>
<li><p>Remove single points of failure. Scale out, not just up.</p>
</li>
<li><p>Split the brain (control plane) from the heavy data (data plane).</p>
</li>
<li><p>Put content close to users with a CDN.</p>
</li>
<li><p>Keep services small and stateless, with timeouts and fallbacks.</p>
</li>
<li><p>Cache what is read often.</p>
</li>
<li><p>Practise failure on purpose, starting small.</p>
</li>
</ul>
<p>If this helped, save it, share it with a friend who is preparing for interviews, and follow <strong>@cloudtechbydevang</strong> for one cloud and DevOps topic a day.</p>
<hr />
<h3>Sources</h3>
<ul>
<li><p>Netflix Q4 2025 shareholder letter (Jan 2026): "crossed the 325M paid memberships milestone". <a href="https://ir.netflix.net/files/doc%5C_financials/2025/q4/FINAL-Q4-25-Shareholder-Letter.pdf">https://ir.netflix.net/files/doc\_financials/2025/q4/FINAL-Q4-25-Shareholder-Letter.pdf</a> · CNBC coverage: <a href="https://www.cnbc.com/2026/01/20/netflix-nflx-earnings-q4-2025.html">https://www.cnbc.com/2026/01/20/netflix-nflx-earnings-q4-2025.html</a></p>
</li>
<li><p>Variety (Apr 2024), Netflix stops quarterly subscriber reporting from Q1 2025: <a href="https://variety.com/2024/tv/news/netflix-stop-reporting-subscriber-numbers-starting-2025-1235975341/">https://variety.com/2024/tv/news/netflix-stop-reporting-subscriber-numbers-starting-2025-1235975341/</a></p>
</li>
<li><p>Netflix, "Completing the Netflix Cloud Migration" (Feb 2016): <a href="https://about.netflix.com/news/completing-the-netflix-cloud-migration">https://about.netflix.com/news/completing-the-netflix-cloud-migration</a></p>
</li>
<li><p>Netflix, "Open Connect: Celebrating a Decade" (Dec 2022): <a href="https://about.netflix.com/news/open-connect-celebrating-a-decade-of-smooth-and-efficient-streaming">https://about.netflix.com/news/open-connect-celebrating-a-decade-of-smooth-and-efficient-streaming</a></p>
</li>
<li><p>Open Connect overview and partner docs: <a href="https://openconnect.netflix.com/en">https://openconnect.netflix.com/en</a> · <a href="https://openconnect.netflix.com/Open-Connect-Overview.pdf">https://openconnect.netflix.com/Open-Connect-Overview.pdf</a></p>
</li>
<li><p>Netflix Tech Blog, "The Netflix Simian Army" (Jul 2011): <a href="https://netflixtechblog.com/the-netflix-simian-army-16e57fbab116">https://netflixtechblog.com/the-netflix-simian-army-16e57fbab116</a></p>
</li>
<li><p>Ars Technica, Chaos Monkey open-sourced (Jul 2012): <a href="https://arstechnica.com/information-technology/2012/07/netflix-attacks-own-network-with-chaos-monkey-and-now-you-can-too/">https://arstechnica.com/information-technology/2012/07/netflix-attacks-own-network-with-chaos-monkey-and-now-you-can-too/</a></p>
</li>
<li><p>Netflix Tech Blog, "Open Sourcing Zuul 2": <a href="https://netflixtechblog.com/open-sourcing-zuul-2-82ea476cb2b3">https://netflixtechblog.com/open-sourcing-zuul-2-82ea476cb2b3</a></p>
</li>
<li><p>Netflix Tech Blog, "Introducing Hystrix for Resilience Engineering": <a href="https://netflixtechblog.com/introducing-hystrix-for-resilience-engineering-13531c1ab362">https://netflixtechblog.com/introducing-hystrix-for-resilience-engineering-13531c1ab362</a></p>
</li>
<li><p>Netflix Tech Blog, "Netflix OSS and Spring Boot — Coming Full Circle": <a href="https://netflixtechblog.com/netflix-oss-and-spring-boot-coming-full-circle-4855947713a0">https://netflixtechblog.com/netflix-oss-and-spring-boot-coming-full-circle-4855947713a0</a></p>
</li>
<li><p>Netflix Tech Blog, "Caching for a Global Netflix" (EVCache): <a href="https://netflixtechblog.com/caching-for-a-global-netflix-7bcc457012f1">https://netflixtechblog.com/caching-for-a-global-netflix-7bcc457012f1</a></p>
</li>
<li><p>Netflix Tech Blog, "Project Nimble: Region Evacuation Reimagined": <a href="https://netflixtechblog.com/project-nimble-region-evacuation-reimagined-d0d0568254d4">https://netflixtechblog.com/project-nimble-region-evacuation-reimagined-d0d0568254d4</a></p>
</li>
</ul>
<p><strong>Preparing for a Cloud, DevOps or SRE interview?</strong> Book a <strong>Free 15-min Cloud &amp; DevOps Interview Guidance Call</strong> with me: what to study, how to answer system-design and on-call questions, plus a CV and roadmap check 👉 <a href="https://topmate.io/cloudtechbydevang/2358399">https://topmate.io/cloudtechbydevang/2358399</a></p>
]]></content:encoded></item></channel></rss>