<?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" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[System Design Classroom]]></title><description><![CDATA[A System Design Newsletter to help you build better software. ]]></description><link>https://newsletter.systemdesignclassroom.com</link><image><url>https://substackcdn.com/image/fetch/$s_!Mtgs!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdb90e4a-4569-433d-93c4-a4863e3d54ef_69x69.png</url><title>System Design Classroom</title><link>https://newsletter.systemdesignclassroom.com</link></image><generator>Substack</generator><lastBuildDate>Wed, 08 Apr 2026 10:56:05 GMT</lastBuildDate><atom:link href="https://newsletter.systemdesignclassroom.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Raul Junco]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[systemdesignschool@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[systemdesignschool@substack.com]]></itunes:email><itunes:name><![CDATA[Raul Junco]]></itunes:name></itunes:owner><itunes:author><![CDATA[Raul Junco]]></itunes:author><googleplay:owner><![CDATA[systemdesignschool@substack.com]]></googleplay:owner><googleplay:email><![CDATA[systemdesignschool@substack.com]]></googleplay:email><googleplay:author><![CDATA[Raul Junco]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Good System Design Starts With Constraints, Not Diagrams, Not Tools]]></title><description><![CDATA[Most Engineers Learn System Design Backwards]]></description><link>https://newsletter.systemdesignclassroom.com/p/most-engineers-learn-system-design-backwards</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/most-engineers-learn-system-design-backwards</guid><dc:creator><![CDATA[Raul Junco]]></dc:creator><pubDate>Sat, 04 Apr 2026 11:55:22 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!plQD!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9384c356-1bfd-4a76-a355-f9bd76b6a184_2640x1830.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Many engineers study system design from the wrong end.</p><p>They start with Kubernetes. Then microservices. Then queues. Then service meshes. Then they memorize diagrams full of boxes, arrows, and cloud logos.</p><p>But when a real system gets slow, unstable, or expensive, they struggle to explain what is actually going wrong.</p><ul><li><p>Why did latency spike? </p></li><li><p>Why did retries make the outage worse? </p></li><li><p>Why did the database collapse even after adding more app servers? </p></li><li><p>Why does everything look healthy on dashboards while users still get the wrong behavior?</p></li></ul><p>That happens because system design is not really about diagrams or tools.</p><p>It is about constraints.</p><p>If you do not understand the forces underneath the system, the architecture picture gives you confidence without understanding. It helps you describe the system, but not reason about it.</p><div><hr></div><p><strong>The tax you pay to run multiple agents</strong></p><p>If you&#8217;ve spent any time with coding agents, you know the feeling. You start the morning with a clean plan. Spin up a few agents. One is refactoring the auth module. Another is writing tests. A third is scaffolding a new API endpoint. You&#8217;re flying.</p><p>Then, around 10:30 AM, you look up and realize you have 20 terminal windows open. One agent is blocked waiting for a decision you forgot to make. Another finished 40 minutes ago, and you never noticed. A third went sideways three commits back. You&#8217;re no longer flying. You&#8217;re drowning.</p><p>You&#8217;ve shifted from human as driver to human as director. When running coding agents in parallel, the bottleneck isn&#8217;t just context. It&#8217;s your own attention trying to manage 10 agents across 10 terminals. You&#8217;re losing your mind to terminal chaos.</p><p>Meet Cline Kanban, a CLI-agnostic visual orchestration layer that makes multi-agent workflows usable across providers. Multiple agents, one UI. It&#8217;s the air traffic controller for the agents you&#8217;re already running, regardless of where they live.</p><ul><li><p><strong>Interoperable: </strong>Claude Code and Codex compatible, with more coming soon.</p></li><li><p><strong>Full Visibility:</strong> Confidently run multiple agents and work through your backlog faster.</p></li><li><p><strong>Smart Triage:</strong> See which agents are blocked or in review and jump in to unblock them.</p></li><li><p><strong>Chain Tasks:</strong> Set dependencies so Agent B won&#8217;t start until Agent A is complete.</p></li><li><p><strong>Familiar UI:</strong> Everything in a single Kanban view.</p></li></ul><p>Stop tracking agents and start directing them. Get a meaningful edge with the beta release.</p><p><strong>Install Cline Kanban Today: </strong><em> npm i -g cline</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9ePy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9947797b-45e7-429d-8000-16b03e81f926_1999x1125.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9ePy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9947797b-45e7-429d-8000-16b03e81f926_1999x1125.png 424w, https://substackcdn.com/image/fetch/$s_!9ePy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9947797b-45e7-429d-8000-16b03e81f926_1999x1125.png 848w, https://substackcdn.com/image/fetch/$s_!9ePy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9947797b-45e7-429d-8000-16b03e81f926_1999x1125.png 1272w, https://substackcdn.com/image/fetch/$s_!9ePy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9947797b-45e7-429d-8000-16b03e81f926_1999x1125.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9ePy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9947797b-45e7-429d-8000-16b03e81f926_1999x1125.png" width="1456" height="819" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9947797b-45e7-429d-8000-16b03e81f926_1999x1125.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:819,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:935286,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/192603372?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9947797b-45e7-429d-8000-16b03e81f926_1999x1125.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9ePy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9947797b-45e7-429d-8000-16b03e81f926_1999x1125.png 424w, https://substackcdn.com/image/fetch/$s_!9ePy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9947797b-45e7-429d-8000-16b03e81f926_1999x1125.png 848w, https://substackcdn.com/image/fetch/$s_!9ePy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9947797b-45e7-429d-8000-16b03e81f926_1999x1125.png 1272w, https://substackcdn.com/image/fetch/$s_!9ePy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9947797b-45e7-429d-8000-16b03e81f926_1999x1125.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://cline.gg/S4MyIYI&quot;,&quot;text&quot;:&quot;Get Started Today&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://cline.gg/S4MyIYI"><span>Get Started Today</span></a></p><div><hr></div><h3>The real issue with how system design gets studied</h3><p>The problem is not a lack of resources. Engineers have more books, videos, posts, and courses than ever. The real issue is that many people learn solutions before they understand the problems those solutions were built to solve.</p><ul><li><p>They learn microservices before they understand network cost. </p></li><li><p>They learn queues before they understand duplication and ordering. </p></li><li><p>They learn caching before they understand staleness and invalidation. </p></li><li><p>They learn replication before they understand read and write access patterns. </p></li></ul><p>That sequence creates a tool-first mental model. And it sounds sophisticated, but it usually breaks under pressure.</p><p>In practice, systems often fail for much simpler reasons. A service calls too many dependencies. A query is inefficient. An index is missing. A partition key is skewed. A retry policy multiplies traffic. A cache serves stale data. A queue grows without control. A hot path lacks ownership.</p><p>None of those problems looks glamorous, but they shape whether a system survives production. Yes, sophisticated-looking architectures can still fail in predictable ways. The team chose modern components but never built a clear understanding of the forces underlying them.</p><p>That is why the order of learning matters so much.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!plQD!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9384c356-1bfd-4a76-a355-f9bd76b6a184_2640x1830.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!plQD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9384c356-1bfd-4a76-a355-f9bd76b6a184_2640x1830.png 424w, https://substackcdn.com/image/fetch/$s_!plQD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9384c356-1bfd-4a76-a355-f9bd76b6a184_2640x1830.png 848w, https://substackcdn.com/image/fetch/$s_!plQD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9384c356-1bfd-4a76-a355-f9bd76b6a184_2640x1830.png 1272w, https://substackcdn.com/image/fetch/$s_!plQD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9384c356-1bfd-4a76-a355-f9bd76b6a184_2640x1830.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!plQD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9384c356-1bfd-4a76-a355-f9bd76b6a184_2640x1830.png" width="1456" height="1009" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9384c356-1bfd-4a76-a355-f9bd76b6a184_2640x1830.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1009,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:211758,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/192603372?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9384c356-1bfd-4a76-a355-f9bd76b6a184_2640x1830.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!plQD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9384c356-1bfd-4a76-a355-f9bd76b6a184_2640x1830.png 424w, https://substackcdn.com/image/fetch/$s_!plQD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9384c356-1bfd-4a76-a355-f9bd76b6a184_2640x1830.png 848w, https://substackcdn.com/image/fetch/$s_!plQD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9384c356-1bfd-4a76-a355-f9bd76b6a184_2640x1830.png 1272w, https://substackcdn.com/image/fetch/$s_!plQD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9384c356-1bfd-4a76-a355-f9bd76b6a184_2640x1830.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>The order that actually builds intuition</h3><p>If your goal is real system design judgment, the most useful sequence is much more grounded:</p><ul><li><p>Start with networks</p></li><li><p>Then move into databases</p></li><li><p>Then study caching</p></li><li><p>Then queues and streams</p></li><li><p>Then load balancing</p></li><li><p>Then build a few classic systems</p></li><li><p>Then read postmortems and failure reports</p></li></ul><p>This order works because each layer depends on the one below it. If you skip the lower layers, everything above turns into memorization. If you understand the lower layers, the upper layers naturally begin to make sense.</p><p>That order matters, but there is one thing that comes even before it: being clear on what problem you are actually solving.</p><h3>But before all of that, learn to ask for requirements</h3><p>Even the best technical foundation will not help much if you skip the first step: understanding the problem.</p><p>You need to know what matters most, what can bend, and what absolutely cannot fail.</p><p>Good system design starts with questions.</p><p>Is this system read-heavy or write-heavy?<br>Do we care more about latency or consistency?<br>How fresh does the data need to be?<br>Is traffic steady, or does it arrive in bursts?<br>What is the expected scale?<br>What is the budget?<br>What is the recovery expectation when something goes wrong?</p><p>Those questions shape everything that comes after.</p><blockquote><p>And this is the part many engineers miss: every requirement is a trade-off in disguise.</p></blockquote><p>&#8220;The system must be fast&#8221; sounds simple until you realize what it usually means. Speed often competes with consistency. A read that returns stale data is fast. A read that coordinates across multiple replicas is safer, but slower. In real systems, you rarely get everything at once.</p><p>The first skill in system design is deciding what you are willing to sacrifice.</p><p>A read-heavy system pushes you toward caching.<br>A write-heavy system pushes you toward coordination.<br>A bursty workload makes queues and backpressure more important.<br>A low-latency system makes every network hop more expensive.<br>A system with strict consistency requirements changes how safely you can use replicas, async flows, and stale reads.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kjCw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba1a9a21-6491-49dd-9a6b-1302ee570abf_1601x1038.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kjCw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba1a9a21-6491-49dd-9a6b-1302ee570abf_1601x1038.png 424w, https://substackcdn.com/image/fetch/$s_!kjCw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba1a9a21-6491-49dd-9a6b-1302ee570abf_1601x1038.png 848w, https://substackcdn.com/image/fetch/$s_!kjCw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba1a9a21-6491-49dd-9a6b-1302ee570abf_1601x1038.png 1272w, https://substackcdn.com/image/fetch/$s_!kjCw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba1a9a21-6491-49dd-9a6b-1302ee570abf_1601x1038.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kjCw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba1a9a21-6491-49dd-9a6b-1302ee570abf_1601x1038.png" width="1456" height="944" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ba1a9a21-6491-49dd-9a6b-1302ee570abf_1601x1038.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:944,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:141191,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/192603372?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba1a9a21-6491-49dd-9a6b-1302ee570abf_1601x1038.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kjCw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba1a9a21-6491-49dd-9a6b-1302ee570abf_1601x1038.png 424w, https://substackcdn.com/image/fetch/$s_!kjCw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba1a9a21-6491-49dd-9a6b-1302ee570abf_1601x1038.png 848w, https://substackcdn.com/image/fetch/$s_!kjCw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba1a9a21-6491-49dd-9a6b-1302ee570abf_1601x1038.png 1272w, https://substackcdn.com/image/fetch/$s_!kjCw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba1a9a21-6491-49dd-9a6b-1302ee570abf_1601x1038.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is where many system designs go wrong.</p><p>Engineers jump from a vague problem statement to an architecture too quickly. They start suggesting tools before they understand the actual constraints. But requirements are what tell you which constraints matter most.</p><p>That is why asking good questions is part of system design, not something that happens before it.</p><blockquote><p>Requirements tell you what matters.<br>Fundamentals tell you why it matters.<br>Architecture is what you choose because of both.</p></blockquote><p>And once you understand that, the next thing to study is the layer every distributed system depends on first: communication.</p><h3>Networks Explain Everything Else</h3><p>An engineer sets a 30-second timeout on an HTTP call to a payment service.</p><p>What they do not realize is that the load balancer upstream times out after 15 seconds.</p><p>At second 15, the load balancer cuts the connection and retries the request.</p><p>The original call is still running.</p><p>There are now two requests in flight.</p><p>The payment goes through twice.</p><p>No obvious application error.<br>No crash.<br>No red alert on the dashboard.<br>Just a clean wall of 200s and a customer who got charged twice.</p><p>That&#8217;s a networking bug wearing a business logic disguise, and it&#8217;s exactly why networking matters so much in system design.</p><p>This is what an innocent&#8209;looking timeout mismatch really does under the hood.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yk07!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a20d25c-6368-4722-b7ea-31a04c6e095a_2162x2126.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yk07!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a20d25c-6368-4722-b7ea-31a04c6e095a_2162x2126.png 424w, https://substackcdn.com/image/fetch/$s_!yk07!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a20d25c-6368-4722-b7ea-31a04c6e095a_2162x2126.png 848w, https://substackcdn.com/image/fetch/$s_!yk07!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a20d25c-6368-4722-b7ea-31a04c6e095a_2162x2126.png 1272w, https://substackcdn.com/image/fetch/$s_!yk07!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a20d25c-6368-4722-b7ea-31a04c6e095a_2162x2126.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yk07!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a20d25c-6368-4722-b7ea-31a04c6e095a_2162x2126.png" width="1456" height="1432" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6a20d25c-6368-4722-b7ea-31a04c6e095a_2162x2126.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1432,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:465095,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/192603372?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a20d25c-6368-4722-b7ea-31a04c6e095a_2162x2126.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yk07!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a20d25c-6368-4722-b7ea-31a04c6e095a_2162x2126.png 424w, https://substackcdn.com/image/fetch/$s_!yk07!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a20d25c-6368-4722-b7ea-31a04c6e095a_2162x2126.png 848w, https://substackcdn.com/image/fetch/$s_!yk07!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a20d25c-6368-4722-b7ea-31a04c6e095a_2162x2126.png 1272w, https://substackcdn.com/image/fetch/$s_!yk07!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a20d25c-6368-4722-b7ea-31a04c6e095a_2162x2126.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>It is also one of the most neglected topics in how engineers learn distributed systems.</p><p>Every request that leaves one machine and reaches another carries costs and risks. The moment your system crosses a network boundary, latency becomes real, partial failure becomes possible, retries become dangerous, and duplication becomes something you have to design for.</p><p>If you do not understand what happens when bytes leave one machine and travel to another, a lot of your architecture decisions end up resting on assumptions you cannot verify.</p><p>That is why networking should come first.</p><p>A local function call is fast and predictable. A network call is slower, less predictable, and full of edge cases that only show up under pressure. That difference changes everything.</p><p>It changes how you think about service boundaries. It changes how you think about retries. It changes how you think about failure. And it changes how expensive &#8220;just one more network hop&#8221; really is.</p><p>Once you understand the cost of communication, the next question becomes just as important: how the system stores and retrieves data.</p><h3>Then learn databases</h3><p>If networks explain how systems communicate, databases explain how systems remember.</p><p>A huge amount of system design is really about how data is modeled, accessed, coordinated, and maintained under load. The consequence is that shallow database advice creates so much damage. It is easy to say &#8220;use NoSQL for scale&#8221; or &#8220;add replicas,&#8221; but without understanding the fundamentals, those ideas turn into expensive guesses.</p><p>You need to understand relational and non-relational models, indexes, query plans, transactions, isolation, replication, and partitioning. Not because every system needs every one of those concepts, but because these are the things that explain why systems behave the way they do.</p><p>Many systems do not really have a scale problem. They have a data access problem. The query is inefficient. The index does not match the filter pattern. The primary handles too many reads. The write path needs too much coordination. The partition key creates a hotspot. The model fights the access pattern.</p><p>This is also where one of the most important habits in system design begins: thinking separately about reads and writes.</p><p>Reads are often easier to scale. You can cache, replicate, precompute, and sometimes serve them from the edge. Writes are harder. Writes need coordination. Writes need durability. Writes need consistency rules.</p><p>This is also where ideas like the CAP theorem stop feeling abstract.</p><p>A write lands on one node, but replication has not finished yet. A read goes to another node and gets stale data. At that point, the trade-off is no longer theoretical. You can wait for replication and pay the latency cost, or you can serve the stale read and accept temporary inconsistency.</p><p>There is no magical third option.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!g4RG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab0b70c-aa04-49ef-b1e5-034ded853e6c_2640x1440.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!g4RG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab0b70c-aa04-49ef-b1e5-034ded853e6c_2640x1440.png 424w, https://substackcdn.com/image/fetch/$s_!g4RG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab0b70c-aa04-49ef-b1e5-034ded853e6c_2640x1440.png 848w, https://substackcdn.com/image/fetch/$s_!g4RG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab0b70c-aa04-49ef-b1e5-034ded853e6c_2640x1440.png 1272w, https://substackcdn.com/image/fetch/$s_!g4RG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab0b70c-aa04-49ef-b1e5-034ded853e6c_2640x1440.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!g4RG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab0b70c-aa04-49ef-b1e5-034ded853e6c_2640x1440.png" width="1456" height="794" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8ab0b70c-aa04-49ef-b1e5-034ded853e6c_2640x1440.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:794,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:192647,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/192603372?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab0b70c-aa04-49ef-b1e5-034ded853e6c_2640x1440.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!g4RG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab0b70c-aa04-49ef-b1e5-034ded853e6c_2640x1440.png 424w, https://substackcdn.com/image/fetch/$s_!g4RG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab0b70c-aa04-49ef-b1e5-034ded853e6c_2640x1440.png 848w, https://substackcdn.com/image/fetch/$s_!g4RG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab0b70c-aa04-49ef-b1e5-034ded853e6c_2640x1440.png 1272w, https://substackcdn.com/image/fetch/$s_!g4RG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab0b70c-aa04-49ef-b1e5-034ded853e6c_2640x1440.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>That trade-off explains a huge number of system design decisions. It explains why some systems choose replicas and eventual consistency. It explains why others keep reads close to the primary. It explains why low latency and perfect freshness often pull in opposite directions.</p><p>If you cannot reason about the write path, you cannot really reason about the architecture.</p><p>And once you understand how costly repeated reads can become, the next step becomes obvious: avoiding unnecessary work.</p><h3>Then learn caching</h3><p>Caching is probably the clearest example of a system design trade-off.</p><p>You are trading correctness for speed.</p><p>Every cached value is a bet that the underlying data will not change before the cache expires. Sometimes that bet pays off, and the system gets much faster at a very low cost. Sometimes it does not, and a user sees a price that no longer exists, clicks buy, and your support team spends the afternoon apologizing.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nTtO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bcc3ab4-6dea-44a6-9b62-076ce7a5f69c_2640x1380.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nTtO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bcc3ab4-6dea-44a6-9b62-076ce7a5f69c_2640x1380.png 424w, https://substackcdn.com/image/fetch/$s_!nTtO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bcc3ab4-6dea-44a6-9b62-076ce7a5f69c_2640x1380.png 848w, https://substackcdn.com/image/fetch/$s_!nTtO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bcc3ab4-6dea-44a6-9b62-076ce7a5f69c_2640x1380.png 1272w, https://substackcdn.com/image/fetch/$s_!nTtO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bcc3ab4-6dea-44a6-9b62-076ce7a5f69c_2640x1380.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nTtO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bcc3ab4-6dea-44a6-9b62-076ce7a5f69c_2640x1380.png" width="1456" height="761" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1bcc3ab4-6dea-44a6-9b62-076ce7a5f69c_2640x1380.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:761,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:185101,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/192603372?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bcc3ab4-6dea-44a6-9b62-076ce7a5f69c_2640x1380.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nTtO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bcc3ab4-6dea-44a6-9b62-076ce7a5f69c_2640x1380.png 424w, https://substackcdn.com/image/fetch/$s_!nTtO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bcc3ab4-6dea-44a6-9b62-076ce7a5f69c_2640x1380.png 848w, https://substackcdn.com/image/fetch/$s_!nTtO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bcc3ab4-6dea-44a6-9b62-076ce7a5f69c_2640x1380.png 1272w, https://substackcdn.com/image/fetch/$s_!nTtO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bcc3ab4-6dea-44a6-9b62-076ce7a5f69c_2640x1380.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is the reason caching matters so much in system design. It forces you to answer a harder question than &#8220;should we cache?&#8221;</p><p>The real question is: what are we comfortable being wrong about, and for how long?</p><p>That is what makes caching more than a performance trick.</p><p>It is a judgment call.</p><p>A lot of engineers first meet caching as an easy win. Put Redis in front of the database. Add a CDN. Set a TTL. Watch latency drop. And sometimes that really is the right move. Caching can remove repeated work, reduce pressure on the database, and give you some of the cheapest performance improvements in the system.</p><p>But the moment you cache something, you also accept a new kind of risk.</p><p>You accept that the fast answer may not be the latest answer.<br>You accept that invalidation may be harder than storage.<br>You accept that two users may see different realities for a short period of time.</p><p>Caching only works well when you understand the shape of the data and the cost of being wrong.</p><p>Some data is ideal for caching because it changes so little.<br>Some data can tolerate staleness because the business impact is low.<br>Some data looks cacheable until the first bad customer experience makes the trade-off painfully real.</p><p>That is the real lesson.</p><p>Caching is not just about speed. It is about deciding where freshness matters, where it does not, and how much inconsistency the system can tolerate without breaking trust.</p><p>Once you understand that, caching starts to look like what it really is: a trade-off among latency, freshness, and complexity.</p><p>And even after you reduce repeated reads, one big problem remains: what happens when too much work arrives at once?</p><h3>Then learn queues and streams</h3><p>Once you understand request-response systems, the next major shift is learning how to decouple time.</p><p>Queues and streams matter because they let you move work off the critical path. Instead of forcing every piece of work to complete during the user request, they let the system defer non-critical tasks, smooth out spikes, and scale consumers independently. </p><p>This is one of the cleanest ways to protect the application&#8217;s hot path.</p><p>This is why asynchronous systems are so powerful. They help absorb traffic bursts, isolate failures, and prevent slow downstream dependencies from dragging down the user-facing experience. But they do not eliminate complexity. They relocate it.</p><p>That part often gets learned too late. As soon as you introduce asynchronous processing, you also introduce duplicate delivery, out-of-order events, replay behavior, tracing complexity, idempotency requirements, and eventual consistency. </p><p>The system may become more resilient under load, but it also becomes harder to reason about.</p><p>That does not make queues a bad choice. It simply means they are a trade-off. They buy resilience and throughput at the cost of immediacy and simplicity. Once you understand that trade clearly, you can choose async patterns for the right reasons instead of treating them like a default upgrade.</p><p>As traffic spreads across multiple services, consumers, and workers, another challenge becomes unavoidable: deciding how to distribute work across infrastructure without creating new bottlenecks.</p><h3>Then learn load balancing</h3><p>A lot of engineers hear &#8220;the system is overloaded&#8221; and immediately think, &#8220;add more servers.&#8221;</p><p>Sometimes that works. A lot of the time, it does not.</p><p>If the database is already saturated, more app servers will just create more traffic against the same bottleneck. If your workers are slow because downstream writes are struggling, adding more workers may just increase contention faster. If the cache hit rate is poor, spreading requests across more instances does not fix the real problem.</p><p>That is why load balancing is easy to oversimplify.</p><p>Yes, it distributes traffic. But the real lesson is not &#8220;send requests to many servers.&#8221; The real lesson is understanding what kind of load you are distributing, how it should be distributed, and whether the rest of the system can absorb it.</p><p>That is where details start to matter. Round robin, least connections, sticky sessions, health checks, failover behavior, consistent hashing. These are not just implementation details. They shape whether traffic spreads intelligently or whether the system keeps pushing work into the wrong place.</p><p>Load balancing helps you scale horizontally, but only when you understand where the bottleneck actually lives. Otherwise, you are just moving pressure around and hoping it looks like progress.</p><p>That is what makes load balancing a useful learning topic. It teaches you that scaling is not about blindly adding machines. It is about controlling where work goes and knowing which layer actually needs help.</p><p>And once these building blocks start making sense, the best way to make them stick is to build with them yourself.</p><h3>Build classic systems yourself</h3><p>Reading helps. Courses help. Videos help. But building is what forces the ideas to stick. The moment you try to design even a &#8220;simple&#8221; system yourself, you stop thinking in labels and start thinking in constraints.</p><p>Take a rate limiter.</p><p>At first, it sounds easy: allow 100 requests per minute and block the rest. But the moment you try to build it, the real questions show up. </p><ol><li><p>Where do you store the counters? </p></li><li><p>What happens if multiple servers increment the same key at the same time? </p></li><li><p>Do you reset counts with a fixed window, or use a sliding window that is more accurate but more expensive? </p></li><li><p>Do you optimize for speed, or for fairness? </p></li><li><p>What happens if the limiter itself becomes a bottleneck?</p></li></ol><p>Now you are not just building a small feature. You are dealing with atomicity, concurrency, latency, memory growth, and correctness under load. A local in-memory limiter is fast, but breaks across multiple instances. A centralized Redis-based limiter is more consistent, but adds a network hop and a dependency on another system. Even here, the design is still about trade-offs.</p><p>Building these kinds of systems matters. They force you to apply the exact lessons that look abstract on paper. </p><p>A few classic systems are especially useful:</p><ul><li><p><strong>A URL shortener</strong> teaches you how to think about key generation, read-heavy traffic, redirects, and cache-friendly design.</p></li><li><p><strong>A chat application</strong> teaches you how to reason about persistent connections, fan-out, ordering, and message delivery.</p></li><li><p><strong>A feed system</strong> teaches you how to think through fan-out on read vs fan-out on write, ranking, and precomputation trade-offs.</p></li><li><p><strong>A notification system</strong> teaches you how to design for retries, idempotency, provider failures, and backpressure.</p></li></ul><p>Practice builds judgment. </p><p>Still, even practice systems often remain too clean compared with production. That is why reading about real failures matters so much.</p><h3>Read real-world failures</h3><p>Tutorials usually teach the happy path. Postmortems teach reality.</p><p>A clean architecture never shows the retry storm that multiplied traffic, the migration that locked writes, the dead-letter queue nobody monitored, the stale cache serving wrong results, or the timeout mismatch that triggered cascading failure. Those are the details that make real systems painful and instructive.</p><p>This is where your thinking starts to mature. You stop asking only how the system should work and start asking how it fails. That is the more useful question, because distributed systems are judged by behavior under pressure.</p><p>A system that works perfectly under ideal conditions tells you very little. The real design shows up when traffic spikes, replicas lag, workers crash in the middle of a task, messages get duplicated, or downstream services slow to a crawl. Postmortems sharpen your instincts for actual system behavior rather than idealized architecture.</p><p>Here are <strong>5 strong postmortem examples</strong> worth reading:</p><ol><li><p><a href="https://about.gitlab.com/blog/postmortem-of-database-outage-of-january-31">Postmortem of database outage of January 31 </a> (A great example of transparency, detailed timeline, and clear lessons learned)</p></li><li><p><a href="https://slack.engineering/slacks-incident-on-2-22-22">Slack&#8217;s Incident on 2-22-22</a> (A strong example of how cascading failures happen in complex systems)</p></li><li><p><a href="https://engineering.fb.com/2021/10/05/networking-traffic/outage-details">Meta - More details about the October 4 outage</a> (A useful postmortem for understanding network failures at scale)</p></li><li><p><a href="https://blog.cloudflare.com/post-mortem-on-cloudflare-control-plane-and-analytics-outage/">Post mortem on the Cloudflare Control Plane and Analytics outage</a> (A good example of connecting outage cause, recovery, and follow-up fixes)</p></li><li><p><a href="https://aws.amazon.com/premiumsupport/technology/pes/">AWS Post-Event Summaries</a> (A solid resource for studying how large platforms document incidents consistently)</p></li></ol><p>[This deserves its own full article, and there is more coming on that soon.]</p><p>After you read enough of them, one idea becomes impossible to ignore: the diagram was never the whole design.</p><h3>The diagram is not the design</h3><p>This is one of the biggest mindset shifts in system design.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hdej!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff008c6e8-f3a8-4baa-8c22-345caa85c73a_2640x1560.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hdej!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff008c6e8-f3a8-4baa-8c22-345caa85c73a_2640x1560.png 424w, https://substackcdn.com/image/fetch/$s_!hdej!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff008c6e8-f3a8-4baa-8c22-345caa85c73a_2640x1560.png 848w, https://substackcdn.com/image/fetch/$s_!hdej!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff008c6e8-f3a8-4baa-8c22-345caa85c73a_2640x1560.png 1272w, https://substackcdn.com/image/fetch/$s_!hdej!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff008c6e8-f3a8-4baa-8c22-345caa85c73a_2640x1560.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hdej!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff008c6e8-f3a8-4baa-8c22-345caa85c73a_2640x1560.png" width="1456" height="860" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f008c6e8-f3a8-4baa-8c22-345caa85c73a_2640x1560.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:860,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:194014,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/192603372?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff008c6e8-f3a8-4baa-8c22-345caa85c73a_2640x1560.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hdej!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff008c6e8-f3a8-4baa-8c22-345caa85c73a_2640x1560.png 424w, https://substackcdn.com/image/fetch/$s_!hdej!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff008c6e8-f3a8-4baa-8c22-345caa85c73a_2640x1560.png 848w, https://substackcdn.com/image/fetch/$s_!hdej!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff008c6e8-f3a8-4baa-8c22-345caa85c73a_2640x1560.png 1272w, https://substackcdn.com/image/fetch/$s_!hdej!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff008c6e8-f3a8-4baa-8c22-345caa85c73a_2640x1560.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>People often mistake the picture for the architecture.</p><p>Client. Load balancer. App layer. Cache. Database. Queue. Workers.</p><p>That picture is useful.</p><p>But it is not the real design. The real design lives in the rules.</p><p>What is the source of truth?<br>What can be stale?<br>What retries?<br>What is idempotent?<br>What times out first?<br>What happens under overload?<br>What fails open?<br>What fails closed?<br>What happens if a replica lags?<br>What happens if a message gets processed twice?</p><p>Those questions define the system far more than the visible boxes do.</p><p>You can memorize common architecture diagrams and still struggle in a real design conversation.</p><p>They know the shapes. They do not understand the behavior.</p><p>And that gap between shape and behavior is exactly what separates surface-level familiarity from actual engineering judgment.</p><h2>What actually makes someone good at system design</h2><p>What matters is understanding how systems behave under pressure.</p><p>That means understanding where latency comes from, why writes deserve more respect than reads, how retries can multiply outages, how caching can improve speed while hurting correctness, and why asynchronous systems need idempotency and ordering strategies.</p><p>Once those forces become clear, your design decisions change.</p><p>You stop chasing complexity because it looks impressive.<br>You start protecting the hot path.<br>You reduce blast radius.<br>You respect the database.<br>You design recovery paths instead of focusing only on success paths.</p><p>That is when system design stops being an interview performance and starts becoming engineering judgment.</p><p>Once you see it that way, the path to studying it becomes much simpler.</p><h2>Final thought</h2><p>Many engineers do not need more buzzwords. They need stronger fundamentals.</p><p>The best system designers are those who understand what the system is optimizing for, where pressure builds, and which trade-offs actually matter.</p><p>They know latency is real.<br>They know writes are expensive.<br>They know retries can make things worse.<br>They know scale is often more about controlling work than adding more machines.</p><blockquote><p>They know good system design starts with constraints, not diagrams.</p></blockquote><p></p><p>Until next time,<br>&#8212; Raul</p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[Async systems scale your system… and your problems.]]></title><description><![CDATA[Many developers only realize it after consistency breaks.]]></description><link>https://newsletter.systemdesignclassroom.com/p/async-systems-scale-your-system-and-your-problems</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/async-systems-scale-your-system-and-your-problems</guid><dc:creator><![CDATA[Raul Junco]]></dc:creator><pubDate>Sat, 28 Mar 2026 13:04:17 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!FeKS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4ed811a-70b2-4229-92e8-d26be55b7606_1619x1141.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>The failure no one expects</h2><p>An IoT system publishes two events from the same device into a queue:</p><ul><li><p>&#8220;door open&#8221;</p></li><li><p>&#8220;lock door&#8221;</p></li></ul><p>They land on a shared topic and get picked up by different consumers running in parallel.</p><p>Each event is valid. Each handler executes successfully. Each service does exactly what it was designed to do.</p><p>But because processing is async, they&#8217;re handled out of order:</p><p>Lock door &#8594; Door open</p><p>And so, the final state is wrong.</p><p>The door ends up open, even though a lock command was issued.</p><p>Nothing failed.<br>No alerts fired.<br>The system behaved exactly as designed.</p><p>Each component is locally correct, but no one owns the sequence over time. The result violates the expected invariant: &#8220;lock means locked.&#8221;</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!o7DU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F131d2201-b0f6-4348-ae40-6d9dcff6c1cf_1593x1141.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!o7DU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F131d2201-b0f6-4348-ae40-6d9dcff6c1cf_1593x1141.png 424w, https://substackcdn.com/image/fetch/$s_!o7DU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F131d2201-b0f6-4348-ae40-6d9dcff6c1cf_1593x1141.png 848w, https://substackcdn.com/image/fetch/$s_!o7DU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F131d2201-b0f6-4348-ae40-6d9dcff6c1cf_1593x1141.png 1272w, https://substackcdn.com/image/fetch/$s_!o7DU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F131d2201-b0f6-4348-ae40-6d9dcff6c1cf_1593x1141.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!o7DU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F131d2201-b0f6-4348-ae40-6d9dcff6c1cf_1593x1141.png" width="1456" height="1043" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/131d2201-b0f6-4348-ae40-6d9dcff6c1cf_1593x1141.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1043,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:140310,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/191354834?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F131d2201-b0f6-4348-ae40-6d9dcff6c1cf_1593x1141.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!o7DU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F131d2201-b0f6-4348-ae40-6d9dcff6c1cf_1593x1141.png 424w, https://substackcdn.com/image/fetch/$s_!o7DU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F131d2201-b0f6-4348-ae40-6d9dcff6c1cf_1593x1141.png 848w, https://substackcdn.com/image/fetch/$s_!o7DU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F131d2201-b0f6-4348-ae40-6d9dcff6c1cf_1593x1141.png 1272w, https://substackcdn.com/image/fetch/$s_!o7DU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F131d2201-b0f6-4348-ae40-6d9dcff6c1cf_1593x1141.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>From the user&#8217;s perspective, the system is broken.</p><p>This is the real danger with async systems: failures that don&#8217;t look like failures. To understand why, you need to look at what async really changes.</p><div><hr></div><p>AI coding gets practical when Agent B knows it must wait for Agent A.</p><p>Cline Kanban brings that workflow into one UI: you can run multiple agents, monitor progress at a glance, and define dependencies so work unlocks in the right order. It&#8217;s a cleaner way to manage parallel agent execution without losing track of what&#8217;s happening.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!i6sR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09eb87fd-81e5-4df2-93a3-a0f196b38f3b_1648x1080.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!i6sR!,w_424,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09eb87fd-81e5-4df2-93a3-a0f196b38f3b_1648x1080.gif 424w, https://substackcdn.com/image/fetch/$s_!i6sR!,w_848,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09eb87fd-81e5-4df2-93a3-a0f196b38f3b_1648x1080.gif 848w, https://substackcdn.com/image/fetch/$s_!i6sR!,w_1272,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09eb87fd-81e5-4df2-93a3-a0f196b38f3b_1648x1080.gif 1272w, https://substackcdn.com/image/fetch/$s_!i6sR!,w_1456,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09eb87fd-81e5-4df2-93a3-a0f196b38f3b_1648x1080.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!i6sR!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09eb87fd-81e5-4df2-93a3-a0f196b38f3b_1648x1080.gif" width="1456" height="954" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/09eb87fd-81e5-4df2-93a3-a0f196b38f3b_1648x1080.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:954,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Frame preview&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Frame preview" title="Frame preview" srcset="https://substackcdn.com/image/fetch/$s_!i6sR!,w_424,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09eb87fd-81e5-4df2-93a3-a0f196b38f3b_1648x1080.gif 424w, https://substackcdn.com/image/fetch/$s_!i6sR!,w_848,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09eb87fd-81e5-4df2-93a3-a0f196b38f3b_1648x1080.gif 848w, https://substackcdn.com/image/fetch/$s_!i6sR!,w_1272,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09eb87fd-81e5-4df2-93a3-a0f196b38f3b_1648x1080.gif 1272w, https://substackcdn.com/image/fetch/$s_!i6sR!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09eb87fd-81e5-4df2-93a3-a0f196b38f3b_1648x1080.gif 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://cline.gg/kanban&quot;,&quot;text&quot;:&quot;See how it works&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://cline.gg/kanban"><span>See how it works</span></a></p><div><hr></div><h3>What async actually changes</h3><p>Async systems unlock scale by removing blocking operations and allowing work to be processed in parallel. Services decouple, throughput increases, and systems can handle spikes without cascading failures.</p><p>That&#8217;s why queues, streams, and event-driven architectures are everywhere.</p><p>But there&#8217;s a fundamental trade-off:</p><blockquote><p>You lose control over execution order.</p></blockquote><p>You&#8217;re trading simpler consistency for availability and throughput. Order is no longer implicit; it must instead be designed.</p><p>Once ordering is not guaranteed, consistency becomes timing-dependent. State updates can arrive in different sequences, retries can reorder operations, and parallel consumers can apply conflicting changes.</p><p>The system still &#8220;works,&#8221; but the result depends on when things happen, not just what happens.</p><p>This isn&#8217;t a tooling issue. It&#8217;s a direct consequence of async processing. And it starts with how messages flow through your system.</p><p></p><h3>Why this happens</h3><p>At a high level, async pipelines look simple: producers send messages to a queue, and consumers process them.</p><p>In reality, several factors break ordering.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!FeKS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4ed811a-70b2-4229-92e8-d26be55b7606_1619x1141.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FeKS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4ed811a-70b2-4229-92e8-d26be55b7606_1619x1141.png 424w, https://substackcdn.com/image/fetch/$s_!FeKS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4ed811a-70b2-4229-92e8-d26be55b7606_1619x1141.png 848w, https://substackcdn.com/image/fetch/$s_!FeKS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4ed811a-70b2-4229-92e8-d26be55b7606_1619x1141.png 1272w, https://substackcdn.com/image/fetch/$s_!FeKS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4ed811a-70b2-4229-92e8-d26be55b7606_1619x1141.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!FeKS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4ed811a-70b2-4229-92e8-d26be55b7606_1619x1141.png" width="1456" height="1026" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b4ed811a-70b2-4229-92e8-d26be55b7606_1619x1141.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1026,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:165919,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/191354834?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4ed811a-70b2-4229-92e8-d26be55b7606_1619x1141.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FeKS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4ed811a-70b2-4229-92e8-d26be55b7606_1619x1141.png 424w, https://substackcdn.com/image/fetch/$s_!FeKS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4ed811a-70b2-4229-92e8-d26be55b7606_1619x1141.png 848w, https://substackcdn.com/image/fetch/$s_!FeKS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4ed811a-70b2-4229-92e8-d26be55b7606_1619x1141.png 1272w, https://substackcdn.com/image/fetch/$s_!FeKS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4ed811a-70b2-4229-92e8-d26be55b7606_1619x1141.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Consumers run in parallel, so related messages may be processed at the same time. Retries can push older messages ahead of newer ones. Network delays vary, so delivery order isn&#8217;t guaranteed. Batch processing changes execution timing.</p><p>All of these introduce reordering.</p><p>A message sent first might be processed last. Two related events might be handled by different consumers simultaneously.</p><p>The system is behaving correctly from an infrastructure perspective, but incorrectly from a business perspective, because no component owns the invariant over time.</p><p>It&#8217;s like multiple operators controlling the same device without coordination.</p><p>So the question becomes: where do you reintroduce order?</p><p></p><h3>The simplest fix most teams miss</h3><p>You don&#8217;t need ordering across the entire system. That would destroy scalability.</p><p>You need ordering where state matters.</p><p><strong>Rule of thumb: enforce ordering at the level where you store state (device, user, order), not globally.</strong></p><p>This is where grouping comes in.</p><p>By grouping related messages and processing them sequentially within that group, you preserve the correct order for a specific entity while still allowing parallelism across unrelated entities.</p><p>In practice, this means assigning all events for a device, user, or order to the same processing lane. For Kafka, this is the partition key; for SQS FIFO, this is the message group ID; for Service Bus, this is the session ID.</p><p>Within that lane, events are handled in sequence. Across lanes, the system remains fully parallel.</p><p>You&#8217;re not eliminating concurrency; you&#8217;re shaping it.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pgTb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cf9e90b-bfd8-431c-8739-c4e4bff6df53_1601x1013.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pgTb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cf9e90b-bfd8-431c-8739-c4e4bff6df53_1601x1013.png 424w, https://substackcdn.com/image/fetch/$s_!pgTb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cf9e90b-bfd8-431c-8739-c4e4bff6df53_1601x1013.png 848w, https://substackcdn.com/image/fetch/$s_!pgTb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cf9e90b-bfd8-431c-8739-c4e4bff6df53_1601x1013.png 1272w, https://substackcdn.com/image/fetch/$s_!pgTb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cf9e90b-bfd8-431c-8739-c4e4bff6df53_1601x1013.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pgTb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cf9e90b-bfd8-431c-8739-c4e4bff6df53_1601x1013.png" width="1456" height="921" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9cf9e90b-bfd8-431c-8739-c4e4bff6df53_1601x1013.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:921,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:116622,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/191354834?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cf9e90b-bfd8-431c-8739-c4e4bff6df53_1601x1013.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pgTb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cf9e90b-bfd8-431c-8739-c4e4bff6df53_1601x1013.png 424w, https://substackcdn.com/image/fetch/$s_!pgTb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cf9e90b-bfd8-431c-8739-c4e4bff6df53_1601x1013.png 848w, https://substackcdn.com/image/fetch/$s_!pgTb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cf9e90b-bfd8-431c-8739-c4e4bff6df53_1601x1013.png 1272w, https://substackcdn.com/image/fetch/$s_!pgTb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cf9e90b-bfd8-431c-8739-c4e4bff6df53_1601x1013.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>This pattern is everywhere</h3><p>Modern messaging systems implement this concept in different ways, but the underlying idea is the same.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!NqA4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29b6d834-64d4-423f-af6b-fe52bdc7c7e5_1531x688.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NqA4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29b6d834-64d4-423f-af6b-fe52bdc7c7e5_1531x688.png 424w, https://substackcdn.com/image/fetch/$s_!NqA4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29b6d834-64d4-423f-af6b-fe52bdc7c7e5_1531x688.png 848w, https://substackcdn.com/image/fetch/$s_!NqA4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29b6d834-64d4-423f-af6b-fe52bdc7c7e5_1531x688.png 1272w, https://substackcdn.com/image/fetch/$s_!NqA4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29b6d834-64d4-423f-af6b-fe52bdc7c7e5_1531x688.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!NqA4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29b6d834-64d4-423f-af6b-fe52bdc7c7e5_1531x688.png" width="1456" height="654" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/29b6d834-64d4-423f-af6b-fe52bdc7c7e5_1531x688.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:654,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:109086,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/191354834?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29b6d834-64d4-423f-af6b-fe52bdc7c7e5_1531x688.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NqA4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29b6d834-64d4-423f-af6b-fe52bdc7c7e5_1531x688.png 424w, https://substackcdn.com/image/fetch/$s_!NqA4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29b6d834-64d4-423f-af6b-fe52bdc7c7e5_1531x688.png 848w, https://substackcdn.com/image/fetch/$s_!NqA4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29b6d834-64d4-423f-af6b-fe52bdc7c7e5_1531x688.png 1272w, https://substackcdn.com/image/fetch/$s_!NqA4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29b6d834-64d4-423f-af6b-fe52bdc7c7e5_1531x688.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>SQS FIFO uses message groups to enforce ordered processing. Azure Service Bus uses sessions to ensure sequential handling. Kafka uses partition keys to guarantee order within a partition.</p><p>None of these systems attempt to enforce global ordering. They all enforce ordering within a defined boundary.</p><p>That boundary is what makes scale possible.</p><p>Global ordering would force all messages through a single pipeline, creating a bottleneck. Local ordering allows independent groups to progress without blocking each other.</p><p>Which brings you to the most important design decision.</p><h3>The real decision isn&#8217;t grouping</h3><p>It&#8217;s the grouping key.</p><p>The grouping key determines how messages are partitioned and how ordering is enforced. A good key aligns with real-world entities (like a device, user, or order) so that related events are processed in sequence.</p><p>A poor key introduces problems.</p><p>If the key is too broad, unrelated work is forced into the same group, reducing parallelism. If it&#8217;s too granular or random, related events may not stay together, breaking ordering guarantees.</p><p>And if the key is skewed, you create hotspots. For example, using a &#8220;tenant id&#8221; as the key when one tenant owns millions of devices collapses parallelism into a single hot group.</p><p>You&#8217;re not just deciding how to route messages.</p><p>You&#8217;re defining how your system handles concurrency.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!I_My!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3dcdc25-7ff4-4820-8f64-d118996df1cf_1594x1115.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!I_My!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3dcdc25-7ff4-4820-8f64-d118996df1cf_1594x1115.png 424w, https://substackcdn.com/image/fetch/$s_!I_My!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3dcdc25-7ff4-4820-8f64-d118996df1cf_1594x1115.png 848w, https://substackcdn.com/image/fetch/$s_!I_My!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3dcdc25-7ff4-4820-8f64-d118996df1cf_1594x1115.png 1272w, https://substackcdn.com/image/fetch/$s_!I_My!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3dcdc25-7ff4-4820-8f64-d118996df1cf_1594x1115.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!I_My!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3dcdc25-7ff4-4820-8f64-d118996df1cf_1594x1115.png" width="1456" height="1018" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d3dcdc25-7ff4-4820-8f64-d118996df1cf_1594x1115.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1018,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:160952,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/191354834?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3dcdc25-7ff4-4820-8f64-d118996df1cf_1594x1115.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!I_My!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3dcdc25-7ff4-4820-8f64-d118996df1cf_1594x1115.png 424w, https://substackcdn.com/image/fetch/$s_!I_My!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3dcdc25-7ff4-4820-8f64-d118996df1cf_1594x1115.png 848w, https://substackcdn.com/image/fetch/$s_!I_My!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3dcdc25-7ff4-4820-8f64-d118996df1cf_1594x1115.png 1272w, https://substackcdn.com/image/fetch/$s_!I_My!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3dcdc25-7ff4-4820-8f64-d118996df1cf_1594x1115.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Where things break again</h3><p>Grouping solves ordering, but it introduces new constraints.</p><p>Within a group, processing is sequential. A single slow message can delay everything behind it.</p><p>Under uneven traffic, some groups receive far more events than others. A single high-traffic entity can dominate a partition, turning it into a bottleneck while others remain underutilized.</p><p>This is the hot partition problem.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!UoZJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56cbb2b9-c20a-46af-ab56-f7f0a2c952b2_1586x971.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UoZJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56cbb2b9-c20a-46af-ab56-f7f0a2c952b2_1586x971.png 424w, https://substackcdn.com/image/fetch/$s_!UoZJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56cbb2b9-c20a-46af-ab56-f7f0a2c952b2_1586x971.png 848w, https://substackcdn.com/image/fetch/$s_!UoZJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56cbb2b9-c20a-46af-ab56-f7f0a2c952b2_1586x971.png 1272w, https://substackcdn.com/image/fetch/$s_!UoZJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56cbb2b9-c20a-46af-ab56-f7f0a2c952b2_1586x971.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UoZJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56cbb2b9-c20a-46af-ab56-f7f0a2c952b2_1586x971.png" width="1456" height="891" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/56cbb2b9-c20a-46af-ab56-f7f0a2c952b2_1586x971.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:891,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:106083,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/191354834?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56cbb2b9-c20a-46af-ab56-f7f0a2c952b2_1586x971.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UoZJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56cbb2b9-c20a-46af-ab56-f7f0a2c952b2_1586x971.png 424w, https://substackcdn.com/image/fetch/$s_!UoZJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56cbb2b9-c20a-46af-ab56-f7f0a2c952b2_1586x971.png 848w, https://substackcdn.com/image/fetch/$s_!UoZJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56cbb2b9-c20a-46af-ab56-f7f0a2c952b2_1586x971.png 1272w, https://substackcdn.com/image/fetch/$s_!UoZJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56cbb2b9-c20a-46af-ab56-f7f0a2c952b2_1586x971.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>It rarely shows up in development environments. It appears under real traffic, when distribution is uneven and unpredictable.</p><p>At that point, scaling requires rethinking your grouping strategy, not just adding more consumers.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6Hf2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821f095-f6a3-43e3-99b6-79e5cee6e971_1617x773.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6Hf2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821f095-f6a3-43e3-99b6-79e5cee6e971_1617x773.png 424w, https://substackcdn.com/image/fetch/$s_!6Hf2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821f095-f6a3-43e3-99b6-79e5cee6e971_1617x773.png 848w, https://substackcdn.com/image/fetch/$s_!6Hf2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821f095-f6a3-43e3-99b6-79e5cee6e971_1617x773.png 1272w, https://substackcdn.com/image/fetch/$s_!6Hf2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821f095-f6a3-43e3-99b6-79e5cee6e971_1617x773.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6Hf2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821f095-f6a3-43e3-99b6-79e5cee6e971_1617x773.png" width="1456" height="696" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1821f095-f6a3-43e3-99b6-79e5cee6e971_1617x773.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:696,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:129499,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/191354834?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821f095-f6a3-43e3-99b6-79e5cee6e971_1617x773.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6Hf2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821f095-f6a3-43e3-99b6-79e5cee6e971_1617x773.png 424w, https://substackcdn.com/image/fetch/$s_!6Hf2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821f095-f6a3-43e3-99b6-79e5cee6e971_1617x773.png 848w, https://substackcdn.com/image/fetch/$s_!6Hf2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821f095-f6a3-43e3-99b6-79e5cee6e971_1617x773.png 1272w, https://substackcdn.com/image/fetch/$s_!6Hf2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821f095-f6a3-43e3-99b6-79e5cee6e971_1617x773.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>What grouping actually buys you</h3><p>Grouping doesn&#8217;t eliminate concurrency issues. It scopes them.</p><p>Instead of system-wide inconsistency, you limit coordination to smaller, well-defined boundaries. This makes behavior more predictable and easier to reason about.</p><p>You still have concurrency, but it&#8217;s controlled. You still have trade-offs, but they&#8217;re explicit.</p><p>That&#8217;s what makes async systems workable in practice.</p><h3>My take</h3><p>Most teams adopt async for scale and treat ordering as an afterthought. They assume inconsistencies will be rare or manageable.</p><p>In reality, those inconsistencies surface under load, when they&#8217;re hardest to debug and fix.</p><p>A better approach is to design for ordering from the start. Define how your system handles sequence and state transitions before introducing parallelism.</p><p></p><blockquote><p>If you don&#8217;t design for order, async will decide it for you.</p></blockquote><p></p><p>Until next time,<br>&#8212; Raul</p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[Refactoring Databases Is a Different Animal]]></title><description><![CDATA[A practical pattern for evolving database schemas without breaking production]]></description><link>https://newsletter.systemdesignclassroom.com/p/refactoring-databases-is-a-different-animal</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/refactoring-databases-is-a-different-animal</guid><dc:creator><![CDATA[Raul Junco]]></dc:creator><pubDate>Sat, 14 Mar 2026 11:57:59 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/7c90a547-6a9d-4cc5-8d96-a9524f5a4c45_2493x2404.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Most engineers are comfortable refactoring code.</p><p>You rename a class, split a function, or move logic into a different module. If something breaks, you fix it or roll back the commit. The blast radius is usually limited to the application you&#8217;re working on.</p><p><strong>Refactoring a database is different.</strong></p><p>Once data is involved, things get complicated quickly. It&#8217;s very rare to find a database only used by a single system</p><ul><li><p>Mobile apps rely on it. </p></li><li><p>Admin portals query it. </p></li><li><p>Background jobs write to it. </p></li><li><p>And analytics pipelines read from it.</p></li></ul><p>As a result, a simple schema change can become a production risk.</p><p>Drop the wrong column, and suddenly, multiple systems start failing at once. A harmless change in a migration script turns into a massive disaster.</p><p>Database refactoring requires a different mindset.</p><p>The safest way to evolve a schema without breaking running systems is the <strong>Expand / Contract pattern</strong>.</p><div><hr></div><p><strong>Building an AI demo is easy. Running AI reliably in production is a different story.</strong></p><p>Data pipelines, governance, cost control, observability; that&#8217;s where most of the work actually is.</p><p>AWS put together a simple guide that breaks this down into <strong>6 architectural stages</strong>, from data foundations to operating AI systems in production.</p><p>If you&#8217;re building AI systems, it&#8217;s a useful way to see <strong>where your team actually stands</strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pJGb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb0e4ac3-b79b-40a1-b82e-71ecc69f91f3_659x539.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pJGb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb0e4ac3-b79b-40a1-b82e-71ecc69f91f3_659x539.png 424w, https://substackcdn.com/image/fetch/$s_!pJGb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb0e4ac3-b79b-40a1-b82e-71ecc69f91f3_659x539.png 848w, https://substackcdn.com/image/fetch/$s_!pJGb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb0e4ac3-b79b-40a1-b82e-71ecc69f91f3_659x539.png 1272w, https://substackcdn.com/image/fetch/$s_!pJGb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb0e4ac3-b79b-40a1-b82e-71ecc69f91f3_659x539.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pJGb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb0e4ac3-b79b-40a1-b82e-71ecc69f91f3_659x539.png" width="659" height="539" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fb0e4ac3-b79b-40a1-b82e-71ecc69f91f3_659x539.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:539,&quot;width&quot;:659,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pJGb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb0e4ac3-b79b-40a1-b82e-71ecc69f91f3_659x539.png 424w, https://substackcdn.com/image/fetch/$s_!pJGb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb0e4ac3-b79b-40a1-b82e-71ecc69f91f3_659x539.png 848w, https://substackcdn.com/image/fetch/$s_!pJGb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb0e4ac3-b79b-40a1-b82e-71ecc69f91f3_659x539.png 1272w, https://substackcdn.com/image/fetch/$s_!pJGb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb0e4ac3-b79b-40a1-b82e-71ecc69f91f3_659x539.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://pages.awscloud.com/awsmp-gim-j9sb-adhoc-aim-data-ai-maturity-data-and-ai-foundations-ebook.html?trk=ab27e04b-53cb-497b-b770-44565f600582&amp;sc_channel=el&quot;,&quot;text&quot;:&quot;Download the guide here&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://pages.awscloud.com/awsmp-gim-j9sb-adhoc-aim-data-ai-maturity-data-and-ai-foundations-ebook.html?trk=ab27e04b-53cb-497b-b770-44565f600582&amp;sc_channel=el"><span>Download the guide here</span></a></p><div><hr></div><h3>A Very Common Production Failure</h3><p>Imagine a team that wants to improve a table design. They currently store the user&#8217;s name like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gVEF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37cfea98-e36f-4fe1-964e-f3a1e0e65abb_422x370.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gVEF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37cfea98-e36f-4fe1-964e-f3a1e0e65abb_422x370.png 424w, https://substackcdn.com/image/fetch/$s_!gVEF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37cfea98-e36f-4fe1-964e-f3a1e0e65abb_422x370.png 848w, https://substackcdn.com/image/fetch/$s_!gVEF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37cfea98-e36f-4fe1-964e-f3a1e0e65abb_422x370.png 1272w, https://substackcdn.com/image/fetch/$s_!gVEF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37cfea98-e36f-4fe1-964e-f3a1e0e65abb_422x370.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gVEF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37cfea98-e36f-4fe1-964e-f3a1e0e65abb_422x370.png" width="422" height="370" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/37cfea98-e36f-4fe1-964e-f3a1e0e65abb_422x370.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:370,&quot;width&quot;:422,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:30352,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/190106122?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37cfea98-e36f-4fe1-964e-f3a1e0e65abb_422x370.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gVEF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37cfea98-e36f-4fe1-964e-f3a1e0e65abb_422x370.png 424w, https://substackcdn.com/image/fetch/$s_!gVEF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37cfea98-e36f-4fe1-964e-f3a1e0e65abb_422x370.png 848w, https://substackcdn.com/image/fetch/$s_!gVEF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37cfea98-e36f-4fe1-964e-f3a1e0e65abb_422x370.png 1272w, https://substackcdn.com/image/fetch/$s_!gVEF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37cfea98-e36f-4fe1-964e-f3a1e0e65abb_422x370.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>At some point, they realize this structure is limiting. Searching, sorting, and validation all become harder. Splitting the column into two fields makes much more sense:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!XbX_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6550e891-c621-4568-9a54-ec6f56dc6603_404x448.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XbX_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6550e891-c621-4568-9a54-ec6f56dc6603_404x448.png 424w, https://substackcdn.com/image/fetch/$s_!XbX_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6550e891-c621-4568-9a54-ec6f56dc6603_404x448.png 848w, https://substackcdn.com/image/fetch/$s_!XbX_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6550e891-c621-4568-9a54-ec6f56dc6603_404x448.png 1272w, https://substackcdn.com/image/fetch/$s_!XbX_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6550e891-c621-4568-9a54-ec6f56dc6603_404x448.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!XbX_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6550e891-c621-4568-9a54-ec6f56dc6603_404x448.png" width="404" height="448" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6550e891-c621-4568-9a54-ec6f56dc6603_404x448.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:448,&quot;width&quot;:404,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:38368,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/190106122?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6550e891-c621-4568-9a54-ec6f56dc6603_404x448.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!XbX_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6550e891-c621-4568-9a54-ec6f56dc6603_404x448.png 424w, https://substackcdn.com/image/fetch/$s_!XbX_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6550e891-c621-4568-9a54-ec6f56dc6603_404x448.png 848w, https://substackcdn.com/image/fetch/$s_!XbX_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6550e891-c621-4568-9a54-ec6f56dc6603_404x448.png 1272w, https://substackcdn.com/image/fetch/$s_!XbX_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6550e891-c621-4568-9a54-ec6f56dc6603_404x448.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>So someone writes a migration:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_EFw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95379940-7727-4882-95c2-7cdc410b9eab_749x83.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_EFw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95379940-7727-4882-95c2-7cdc410b9eab_749x83.png 424w, https://substackcdn.com/image/fetch/$s_!_EFw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95379940-7727-4882-95c2-7cdc410b9eab_749x83.png 848w, https://substackcdn.com/image/fetch/$s_!_EFw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95379940-7727-4882-95c2-7cdc410b9eab_749x83.png 1272w, https://substackcdn.com/image/fetch/$s_!_EFw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95379940-7727-4882-95c2-7cdc410b9eab_749x83.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_EFw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95379940-7727-4882-95c2-7cdc410b9eab_749x83.png" width="749" height="83" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/95379940-7727-4882-95c2-7cdc410b9eab_749x83.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:83,&quot;width&quot;:749,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:5268,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/190106122?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95379940-7727-4882-95c2-7cdc410b9eab_749x83.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_EFw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95379940-7727-4882-95c2-7cdc410b9eab_749x83.png 424w, https://substackcdn.com/image/fetch/$s_!_EFw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95379940-7727-4882-95c2-7cdc410b9eab_749x83.png 848w, https://substackcdn.com/image/fetch/$s_!_EFw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95379940-7727-4882-95c2-7cdc410b9eab_749x83.png 1272w, https://substackcdn.com/image/fetch/$s_!_EFw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95379940-7727-4882-95c2-7cdc410b9eab_749x83.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>The change works perfectly in development. The migration runs without errors. Tests pass.</p><p>But when the change reaches production, things start failing.</p><p>The mobile application still writes to the <code>FullName</code> column. The admin dashboard still reads from it. A background worker updates the field during profile imports. None of those systems deployed at the same time as the database migration.</p><p>The result is predictable: production breaks.</p><p>The schema change itself was correct. The problem was that the change was <strong>not backwards compatible</strong>.</p><h3>What&#8217;s Actually at Stake</h3><p>Databases usually sit at the center of the architecture.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ftqv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6686c678-0ad0-46c5-9ff6-d0596744106b_1573x1083.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ftqv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6686c678-0ad0-46c5-9ff6-d0596744106b_1573x1083.png 424w, https://substackcdn.com/image/fetch/$s_!Ftqv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6686c678-0ad0-46c5-9ff6-d0596744106b_1573x1083.png 848w, https://substackcdn.com/image/fetch/$s_!Ftqv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6686c678-0ad0-46c5-9ff6-d0596744106b_1573x1083.png 1272w, https://substackcdn.com/image/fetch/$s_!Ftqv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6686c678-0ad0-46c5-9ff6-d0596744106b_1573x1083.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ftqv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6686c678-0ad0-46c5-9ff6-d0596744106b_1573x1083.png" width="1456" height="1002" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6686c678-0ad0-46c5-9ff6-d0596744106b_1573x1083.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1002,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:172779,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/190106122?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6686c678-0ad0-46c5-9ff6-d0596744106b_1573x1083.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Ftqv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6686c678-0ad0-46c5-9ff6-d0596744106b_1573x1083.png 424w, https://substackcdn.com/image/fetch/$s_!Ftqv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6686c678-0ad0-46c5-9ff6-d0596744106b_1573x1083.png 848w, https://substackcdn.com/image/fetch/$s_!Ftqv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6686c678-0ad0-46c5-9ff6-d0596744106b_1573x1083.png 1272w, https://substackcdn.com/image/fetch/$s_!Ftqv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6686c678-0ad0-46c5-9ff6-d0596744106b_1573x1083.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Every one of these systems depends on the same schema. That means a schema change is rarely isolated, and it becomes a cross-system change.</p><p>In theory, you could coordinate deployments across every service that depends on the database. In practice, that rarely works. Teams deploy at different speeds; some systems update frequently, while others change only occasionally.</p><p>A safer approach is to design migrations that allow <strong>old and new versions of the system to coexist temporarily</strong>.</p><p>This is exactly what the <strong>Expand / Contract pattern</strong> provides.</p><h3>The Expand / Contract Pattern</h3><p>The idea behind Expand / Contract is simple:</p><p><strong>Never introduce a breaking schema change.</strong></p><p>Instead, evolve the schema in stages so that both the old and the new structure can function at the same time.</p><p>The migration typically follows three phases:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LtKJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F524d1569-fb07-4473-99ec-2c03be21e51d_2326x980.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LtKJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F524d1569-fb07-4473-99ec-2c03be21e51d_2326x980.png 424w, https://substackcdn.com/image/fetch/$s_!LtKJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F524d1569-fb07-4473-99ec-2c03be21e51d_2326x980.png 848w, https://substackcdn.com/image/fetch/$s_!LtKJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F524d1569-fb07-4473-99ec-2c03be21e51d_2326x980.png 1272w, https://substackcdn.com/image/fetch/$s_!LtKJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F524d1569-fb07-4473-99ec-2c03be21e51d_2326x980.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LtKJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F524d1569-fb07-4473-99ec-2c03be21e51d_2326x980.png" width="1456" height="613" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/524d1569-fb07-4473-99ec-2c03be21e51d_2326x980.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:613,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:405824,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/190106122?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F524d1569-fb07-4473-99ec-2c03be21e51d_2326x980.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LtKJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F524d1569-fb07-4473-99ec-2c03be21e51d_2326x980.png 424w, https://substackcdn.com/image/fetch/$s_!LtKJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F524d1569-fb07-4473-99ec-2c03be21e51d_2326x980.png 848w, https://substackcdn.com/image/fetch/$s_!LtKJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F524d1569-fb07-4473-99ec-2c03be21e51d_2326x980.png 1272w, https://substackcdn.com/image/fetch/$s_!LtKJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F524d1569-fb07-4473-99ec-2c03be21e51d_2326x980.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Each phase moves the system forward without breaking existing consumers.</p><h3>Step 1 &#8212; Expand</h3><p>The first step is to introduce the new structure while keeping the old one.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!--wQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5223eee4-8991-415b-87f6-3cfc99540d86_1356x524.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!--wQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5223eee4-8991-415b-87f6-3cfc99540d86_1356x524.png 424w, https://substackcdn.com/image/fetch/$s_!--wQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5223eee4-8991-415b-87f6-3cfc99540d86_1356x524.png 848w, https://substackcdn.com/image/fetch/$s_!--wQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5223eee4-8991-415b-87f6-3cfc99540d86_1356x524.png 1272w, https://substackcdn.com/image/fetch/$s_!--wQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5223eee4-8991-415b-87f6-3cfc99540d86_1356x524.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!--wQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5223eee4-8991-415b-87f6-3cfc99540d86_1356x524.png" width="1356" height="524" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5223eee4-8991-415b-87f6-3cfc99540d86_1356x524.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:524,&quot;width&quot;:1356,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:85179,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/190106122?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5223eee4-8991-415b-87f6-3cfc99540d86_1356x524.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!--wQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5223eee4-8991-415b-87f6-3cfc99540d86_1356x524.png 424w, https://substackcdn.com/image/fetch/$s_!--wQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5223eee4-8991-415b-87f6-3cfc99540d86_1356x524.png 848w, https://substackcdn.com/image/fetch/$s_!--wQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5223eee4-8991-415b-87f6-3cfc99540d86_1356x524.png 1272w, https://substackcdn.com/image/fetch/$s_!--wQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5223eee4-8991-415b-87f6-3cfc99540d86_1356x524.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>At this point, the system still works exactly as before. Existing applications continue reading and writing <code>FullName</code>.</p><p>Next, migrate existing data into the new structure.</p><p>Example migration logic:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!optJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!optJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png 424w, https://substackcdn.com/image/fetch/$s_!optJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png 848w, https://substackcdn.com/image/fetch/$s_!optJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png 1272w, https://substackcdn.com/image/fetch/$s_!optJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!optJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png" width="748" height="143" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:143,&quot;width&quot;:748,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:9146,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/190106122?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!optJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png 424w, https://substackcdn.com/image/fetch/$s_!optJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png 848w, https://substackcdn.com/image/fetch/$s_!optJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png 1272w, https://substackcdn.com/image/fetch/$s_!optJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p><strong>Note:</strong> <code>split_part</code> here represents a simple string-splitting utility (either built-in depending on the database, or implemented as a helper function). In real systems, migrations often need additional logic to handle edge cases such as single-word names, extra spaces, or inconsistent formatting in the original data.</p><p>Now the table supports both formats.</p><p>Old systems keep functioning, and new systems can begin using the improved schema.</p><h3>Step 2 &#8212; Transition</h3><p>During the transition phase, both schemas must stay consistent.</p><p>You cannot allow data like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!EdVw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26d06821-5717-498f-bb11-a3e17508f8b7_1890x1097.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EdVw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26d06821-5717-498f-bb11-a3e17508f8b7_1890x1097.png 424w, https://substackcdn.com/image/fetch/$s_!EdVw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26d06821-5717-498f-bb11-a3e17508f8b7_1890x1097.png 848w, https://substackcdn.com/image/fetch/$s_!EdVw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26d06821-5717-498f-bb11-a3e17508f8b7_1890x1097.png 1272w, https://substackcdn.com/image/fetch/$s_!EdVw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26d06821-5717-498f-bb11-a3e17508f8b7_1890x1097.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!EdVw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26d06821-5717-498f-bb11-a3e17508f8b7_1890x1097.png" width="1456" height="845" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/26d06821-5717-498f-bb11-a3e17508f8b7_1890x1097.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:845,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:265959,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/190106122?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26d06821-5717-498f-bb11-a3e17508f8b7_1890x1097.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!EdVw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26d06821-5717-498f-bb11-a3e17508f8b7_1890x1097.png 424w, https://substackcdn.com/image/fetch/$s_!EdVw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26d06821-5717-498f-bb11-a3e17508f8b7_1890x1097.png 848w, https://substackcdn.com/image/fetch/$s_!EdVw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26d06821-5717-498f-bb11-a3e17508f8b7_1890x1097.png 1272w, https://substackcdn.com/image/fetch/$s_!EdVw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26d06821-5717-498f-bb11-a3e17508f8b7_1890x1097.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>If different services read different columns, inconsistent data will appear quickly.</p><p>To prevent this, writes must keep both representations synchronized.</p><p>A simple way to do this is to use <strong>dual writes at the application layer</strong>.</p><p>Whenever a service updates user data, it writes to both the old column and the new columns.</p><p>Example:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3gDx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d41090-f1e1-4dd5-a4eb-819465302f2e_751x180.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3gDx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d41090-f1e1-4dd5-a4eb-819465302f2e_751x180.png 424w, https://substackcdn.com/image/fetch/$s_!3gDx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d41090-f1e1-4dd5-a4eb-819465302f2e_751x180.png 848w, https://substackcdn.com/image/fetch/$s_!3gDx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d41090-f1e1-4dd5-a4eb-819465302f2e_751x180.png 1272w, https://substackcdn.com/image/fetch/$s_!3gDx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d41090-f1e1-4dd5-a4eb-819465302f2e_751x180.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3gDx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d41090-f1e1-4dd5-a4eb-819465302f2e_751x180.png" width="751" height="180" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a9d41090-f1e1-4dd5-a4eb-819465302f2e_751x180.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:180,&quot;width&quot;:751,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:11020,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/190106122?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d41090-f1e1-4dd5-a4eb-819465302f2e_751x180.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3gDx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d41090-f1e1-4dd5-a4eb-819465302f2e_751x180.png 424w, https://substackcdn.com/image/fetch/$s_!3gDx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d41090-f1e1-4dd5-a4eb-819465302f2e_751x180.png 848w, https://substackcdn.com/image/fetch/$s_!3gDx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d41090-f1e1-4dd5-a4eb-819465302f2e_751x180.png 1272w, https://substackcdn.com/image/fetch/$s_!3gDx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d41090-f1e1-4dd5-a4eb-819465302f2e_751x180.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Because both values are written inside <strong>a single database transaction</strong>, the update remains atomic, and both representations stay consistent.</p><blockquote><p>Note: dual writes become much harder when they involve <strong>multiple systems</strong> (for example writing to two databases or publishing an event). In those cases, patterns like <strong>transactional outbox</strong> or <strong>change data capture (CDC)</strong> are typically used to guarantee consistency.</p></blockquote><p>During this phase:</p><ul><li><p>Older services continue reading <code>FullName</code></p></li><li><p>Newer services read <code>FirstName</code> and <code>LastName</code></p></li><li><p>The application keeps both representations aligned</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!48BT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ee89f36-fff1-45e4-8ca5-f36e1ebffacc_2072x1389.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!48BT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ee89f36-fff1-45e4-8ca5-f36e1ebffacc_2072x1389.png 424w, https://substackcdn.com/image/fetch/$s_!48BT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ee89f36-fff1-45e4-8ca5-f36e1ebffacc_2072x1389.png 848w, https://substackcdn.com/image/fetch/$s_!48BT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ee89f36-fff1-45e4-8ca5-f36e1ebffacc_2072x1389.png 1272w, https://substackcdn.com/image/fetch/$s_!48BT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ee89f36-fff1-45e4-8ca5-f36e1ebffacc_2072x1389.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!48BT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ee89f36-fff1-45e4-8ca5-f36e1ebffacc_2072x1389.png" width="1456" height="976" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6ee89f36-fff1-45e4-8ca5-f36e1ebffacc_2072x1389.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:976,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:356456,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/190106122?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ee89f36-fff1-45e4-8ca5-f36e1ebffacc_2072x1389.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!48BT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ee89f36-fff1-45e4-8ca5-f36e1ebffacc_2072x1389.png 424w, https://substackcdn.com/image/fetch/$s_!48BT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ee89f36-fff1-45e4-8ca5-f36e1ebffacc_2072x1389.png 848w, https://substackcdn.com/image/fetch/$s_!48BT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ee89f36-fff1-45e4-8ca5-f36e1ebffacc_2072x1389.png 1272w, https://substackcdn.com/image/fetch/$s_!48BT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ee89f36-fff1-45e4-8ca5-f36e1ebffacc_2072x1389.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li></ul><p>The key requirement is simple: <strong>both schemas must stay consistent until the migration finishes</strong>.</p><p>This transition period allows services to migrate at their own pace. Once every system reads from the new columns, the old column can be safely removed.</p><h3>Where Should Synchronization Live?</h3><p>During the transition phase, the system must keep both schema versions synchronized. </p><p>There are two common ways to enforce this: <strong>application-level dual writes</strong> or <strong>database-level mechanisms</strong> such as triggers or generated columns.</p><p>Application-level dual writes keep the logic explicit in the codebase. You can see exactly how data flows and reason about it during reviews and deployments. This approach also avoids adding extra work to the database write path.</p><p>However, dual writes rely on <strong>every writer being updated correctly</strong>. If multiple services or scripts write to the same table, it&#8217;s easy for one of them to forget the new columns during the transition.</p><p>Database-level mechanisms solve that problem by centralizing the logic. A trigger or generated column guarantees that any write to the table keeps both representations consistent, regardless of which service performs the write. </p><p>The trade-off is that triggers can add latency and make behavior less visible to application developers.</p><p>A useful rule of thumb is:</p><blockquote><p>If many heterogeneous clients write to the same table, go for database-level mechanisms during the transition period. </p><p>If a single service owns the write path, application-level dual writes are usually simpler.</p></blockquote><p>Both approaches follow the same principle: <strong>keep the old and new schema consistent until every consumer has migrated.</strong></p><h3>Step 3 &#8212; Contract</h3><p>You can remove the old structure once all applications have migrated to the new schema.</p><p>This is known as the contract phase. The final schema becomes:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PQjC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f158642-4285-4d58-b9c3-5e12ebefbc41_404x448.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PQjC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f158642-4285-4d58-b9c3-5e12ebefbc41_404x448.png 424w, https://substackcdn.com/image/fetch/$s_!PQjC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f158642-4285-4d58-b9c3-5e12ebefbc41_404x448.png 848w, https://substackcdn.com/image/fetch/$s_!PQjC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f158642-4285-4d58-b9c3-5e12ebefbc41_404x448.png 1272w, https://substackcdn.com/image/fetch/$s_!PQjC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f158642-4285-4d58-b9c3-5e12ebefbc41_404x448.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PQjC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f158642-4285-4d58-b9c3-5e12ebefbc41_404x448.png" width="404" height="448" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5f158642-4285-4d58-b9c3-5e12ebefbc41_404x448.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:448,&quot;width&quot;:404,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:36682,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/190106122?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f158642-4285-4d58-b9c3-5e12ebefbc41_404x448.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!PQjC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f158642-4285-4d58-b9c3-5e12ebefbc41_404x448.png 424w, https://substackcdn.com/image/fetch/$s_!PQjC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f158642-4285-4d58-b9c3-5e12ebefbc41_404x448.png 848w, https://substackcdn.com/image/fetch/$s_!PQjC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f158642-4285-4d58-b9c3-5e12ebefbc41_404x448.png 1272w, https://substackcdn.com/image/fetch/$s_!PQjC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f158642-4285-4d58-b9c3-5e12ebefbc41_404x448.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>At this point, the refactoring is complete, and the compatibility layer is no longer needed.</p><h3>Expand / Contract Is Not Just About Columns</h3><p>Most examples focus on columns, but real schemas include more than that.</p><p>Indexes, constraints, and foreign keys often depend on the fields being migrated, so they must evolve through the same Expand / Contract lifecycle.</p><p>For example, imagine <code>FullName</code> has an index used for search queries. When introducing <code>FirstName</code> and <code>LastName. </code>The migration might look like this.</p><p><strong>Expand phase</strong></p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zSjc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf579ef4-1b65-4b1e-847b-427995645498_753x103.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zSjc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf579ef4-1b65-4b1e-847b-427995645498_753x103.png 424w, https://substackcdn.com/image/fetch/$s_!zSjc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf579ef4-1b65-4b1e-847b-427995645498_753x103.png 848w, https://substackcdn.com/image/fetch/$s_!zSjc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf579ef4-1b65-4b1e-847b-427995645498_753x103.png 1272w, https://substackcdn.com/image/fetch/$s_!zSjc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf579ef4-1b65-4b1e-847b-427995645498_753x103.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zSjc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf579ef4-1b65-4b1e-847b-427995645498_753x103.png" width="753" height="103" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/df579ef4-1b65-4b1e-847b-427995645498_753x103.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:103,&quot;width&quot;:753,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:11402,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/190106122?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf579ef4-1b65-4b1e-847b-427995645498_753x103.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zSjc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf579ef4-1b65-4b1e-847b-427995645498_753x103.png 424w, https://substackcdn.com/image/fetch/$s_!zSjc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf579ef4-1b65-4b1e-847b-427995645498_753x103.png 848w, https://substackcdn.com/image/fetch/$s_!zSjc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf579ef4-1b65-4b1e-847b-427995645498_753x103.png 1272w, https://substackcdn.com/image/fetch/$s_!zSjc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf579ef4-1b65-4b1e-847b-427995645498_753x103.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>The old index on <code>FullName</code> remains in place while applications migrate.</p><p>Once all systems use the new columns, the old index can be removed.</p><p><strong>Contract phase</strong></p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!j8q2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5d83fcf-3009-45ba-8b86-0d72cf571de4_749x85.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!j8q2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5d83fcf-3009-45ba-8b86-0d72cf571de4_749x85.png 424w, https://substackcdn.com/image/fetch/$s_!j8q2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5d83fcf-3009-45ba-8b86-0d72cf571de4_749x85.png 848w, https://substackcdn.com/image/fetch/$s_!j8q2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5d83fcf-3009-45ba-8b86-0d72cf571de4_749x85.png 1272w, https://substackcdn.com/image/fetch/$s_!j8q2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5d83fcf-3009-45ba-8b86-0d72cf571de4_749x85.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!j8q2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5d83fcf-3009-45ba-8b86-0d72cf571de4_749x85.png" width="749" height="85" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b5d83fcf-3009-45ba-8b86-0d72cf571de4_749x85.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:85,&quot;width&quot;:749,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:4955,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/190106122?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5d83fcf-3009-45ba-8b86-0d72cf571de4_749x85.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!j8q2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5d83fcf-3009-45ba-8b86-0d72cf571de4_749x85.png 424w, https://substackcdn.com/image/fetch/$s_!j8q2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5d83fcf-3009-45ba-8b86-0d72cf571de4_749x85.png 848w, https://substackcdn.com/image/fetch/$s_!j8q2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5d83fcf-3009-45ba-8b86-0d72cf571de4_749x85.png 1272w, https://substackcdn.com/image/fetch/$s_!j8q2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5d83fcf-3009-45ba-8b86-0d72cf571de4_749x85.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>The same principle applies to:</p><ul><li><p>unique constraints</p></li><li><p>foreign keys</p></li><li><p>check constraints</p></li><li><p>partial indexes</p></li></ul><p>However, creating indexes or constraints on large tables can be disruptive in itself.</p><p>Some databases support <strong>online or concurrent index creation</strong> (for example, PostgreSQL&#8217;s <code>CREATE INDEX CONCURRENTLY</code>), which avoids blocking writes during the operation.</p><p>You can also introduce constraints in stages. A common pattern creates the constraint first without validating existing rows, then validates the data afterward.</p><p>Example:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QuDh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff642ea15-f85a-4dd3-8b09-d11ad75bff57_749x402.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QuDh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff642ea15-f85a-4dd3-8b09-d11ad75bff57_749x402.png 424w, https://substackcdn.com/image/fetch/$s_!QuDh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff642ea15-f85a-4dd3-8b09-d11ad75bff57_749x402.png 848w, https://substackcdn.com/image/fetch/$s_!QuDh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff642ea15-f85a-4dd3-8b09-d11ad75bff57_749x402.png 1272w, https://substackcdn.com/image/fetch/$s_!QuDh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff642ea15-f85a-4dd3-8b09-d11ad75bff57_749x402.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QuDh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff642ea15-f85a-4dd3-8b09-d11ad75bff57_749x402.png" width="749" height="402" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f642ea15-f85a-4dd3-8b09-d11ad75bff57_749x402.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:402,&quot;width&quot;:749,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:32562,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/190106122?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff642ea15-f85a-4dd3-8b09-d11ad75bff57_749x402.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QuDh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff642ea15-f85a-4dd3-8b09-d11ad75bff57_749x402.png 424w, https://substackcdn.com/image/fetch/$s_!QuDh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff642ea15-f85a-4dd3-8b09-d11ad75bff57_749x402.png 848w, https://substackcdn.com/image/fetch/$s_!QuDh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff642ea15-f85a-4dd3-8b09-d11ad75bff57_749x402.png 1272w, https://substackcdn.com/image/fetch/$s_!QuDh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff642ea15-f85a-4dd3-8b09-d11ad75bff57_749x402.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This allows the system to keep running while the database verifies existing data.</p><h3>Realistic Considerations</h3><p>The pattern itself is straightforward. Real systems introduce complications.</p><h4>Long transition periods</h4><p>Some consumers migrate slowly.</p><p>Internal tools, reporting jobs, and ETL pipelines often depend on the same tables but deploy on very different schedules. It&#8217;s not unusual for the transition phase to last weeks or even months.</p><p>Temporary schema complexity is part of the cost of safe evolution.</p><h4>Partial deployments</h4><p>It is common for migrations and application changes to deploy at different times.</p><p>For example:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!TaAY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05e50998-32d5-4718-b229-a1dbf8b00117_1923x668.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TaAY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05e50998-32d5-4718-b229-a1dbf8b00117_1923x668.png 424w, https://substackcdn.com/image/fetch/$s_!TaAY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05e50998-32d5-4718-b229-a1dbf8b00117_1923x668.png 848w, https://substackcdn.com/image/fetch/$s_!TaAY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05e50998-32d5-4718-b229-a1dbf8b00117_1923x668.png 1272w, https://substackcdn.com/image/fetch/$s_!TaAY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05e50998-32d5-4718-b229-a1dbf8b00117_1923x668.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!TaAY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05e50998-32d5-4718-b229-a1dbf8b00117_1923x668.png" width="1456" height="506" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/05e50998-32d5-4718-b229-a1dbf8b00117_1923x668.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:506,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:197111,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/190106122?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05e50998-32d5-4718-b229-a1dbf8b00117_1923x668.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!TaAY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05e50998-32d5-4718-b229-a1dbf8b00117_1923x668.png 424w, https://substackcdn.com/image/fetch/$s_!TaAY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05e50998-32d5-4718-b229-a1dbf8b00117_1923x668.png 848w, https://substackcdn.com/image/fetch/$s_!TaAY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05e50998-32d5-4718-b229-a1dbf8b00117_1923x668.png 1272w, https://substackcdn.com/image/fetch/$s_!TaAY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05e50998-32d5-4718-b229-a1dbf8b00117_1923x668.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4>Migration Checklist</h4><p>Before running a schema migration, it helps to answer a few operational questions.</p><ol><li><p><strong>Do we have a backfill plan and progress tracking?</strong><br>Large tables often require batch migrations. Make sure the process can run incrementally and resume if interrupted.</p></li><li><p><strong>How will we detect when the last consumer of the old schema is gone?</strong><br>Base schema removal on evidence. Monitor queries, application logs, or feature flags to confirm that no services still depend on the old fields.</p></li><li><p><strong>What&#8217;s the rollback strategy if the new schema misbehaves?</strong><br>Even backward-compatible migrations can introduce unexpected issues. Make sure the system can safely revert to the previous behavior while both schemas still exist.</p></li></ol><p>Thinking through these questions early helps you avoid the most common failure mode of database migrations: discovering operational problems only after the change reaches production.</p><p>During this entire window, the system must function correctly with both schemas.</p><h4>High-volume tables</h4><p>On tables with heavy write traffic, synchronization mechanisms require extra care.</p><p>Triggers can add latency because they execute on every write. For very busy tables, many teams prefer <strong>dual writes combined with feature flags</strong> in the application layer.</p><p>Services gradually migrate their reads while the application maintains compatibility during the transition.</p><p>Backfilling Large Tables Without Locking Them</p><h3>Backfilling Large Tables Without Locking Them</h3><p>The examples above use a simple migration:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!optJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!optJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png 424w, https://substackcdn.com/image/fetch/$s_!optJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png 848w, https://substackcdn.com/image/fetch/$s_!optJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png 1272w, https://substackcdn.com/image/fetch/$s_!optJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!optJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png" width="748" height="143" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:143,&quot;width&quot;:748,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!optJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png 424w, https://substackcdn.com/image/fetch/$s_!optJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png 848w, https://substackcdn.com/image/fetch/$s_!optJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png 1272w, https://substackcdn.com/image/fetch/$s_!optJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ea3339b-baba-47b6-930c-124f85a92bc3_748x143.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>This works well on small tables.</p><p>On large production tables, it can cause serious problems.</p><p>A single <code>UPDATE</code> touching millions of rows can:</p><ul><li><p>lock the table</p></li><li><p>generate massive transaction logs</p></li><li><p>block writes</p></li><li><p>slow down the database for other workloads</p></li></ul><p>Instead, most teams <strong>backfill data in batches</strong>.</p><p>The idea is simple: update small chunks of rows at a time.</p><p>Example:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RNmo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e5effd-6bf6-4283-aea2-202aa2adb6dd_747x172.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RNmo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e5effd-6bf6-4283-aea2-202aa2adb6dd_747x172.png 424w, https://substackcdn.com/image/fetch/$s_!RNmo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e5effd-6bf6-4283-aea2-202aa2adb6dd_747x172.png 848w, https://substackcdn.com/image/fetch/$s_!RNmo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e5effd-6bf6-4283-aea2-202aa2adb6dd_747x172.png 1272w, https://substackcdn.com/image/fetch/$s_!RNmo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e5effd-6bf6-4283-aea2-202aa2adb6dd_747x172.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RNmo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e5effd-6bf6-4283-aea2-202aa2adb6dd_747x172.png" width="747" height="172" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/12e5effd-6bf6-4283-aea2-202aa2adb6dd_747x172.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:172,&quot;width&quot;:747,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:14687,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/190106122?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e5effd-6bf6-4283-aea2-202aa2adb6dd_747x172.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RNmo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e5effd-6bf6-4283-aea2-202aa2adb6dd_747x172.png 424w, https://substackcdn.com/image/fetch/$s_!RNmo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e5effd-6bf6-4283-aea2-202aa2adb6dd_747x172.png 848w, https://substackcdn.com/image/fetch/$s_!RNmo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e5effd-6bf6-4283-aea2-202aa2adb6dd_747x172.png 1272w, https://substackcdn.com/image/fetch/$s_!RNmo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e5effd-6bf6-4283-aea2-202aa2adb6dd_747x172.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>A background job repeatedly runs until it migrates all rows.</p><p>Pseudo workflow:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Wo2_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfdfa869-980d-4ee1-be1f-e8c33fe5355c_1881x1228.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Wo2_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfdfa869-980d-4ee1-be1f-e8c33fe5355c_1881x1228.png 424w, https://substackcdn.com/image/fetch/$s_!Wo2_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfdfa869-980d-4ee1-be1f-e8c33fe5355c_1881x1228.png 848w, https://substackcdn.com/image/fetch/$s_!Wo2_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfdfa869-980d-4ee1-be1f-e8c33fe5355c_1881x1228.png 1272w, https://substackcdn.com/image/fetch/$s_!Wo2_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfdfa869-980d-4ee1-be1f-e8c33fe5355c_1881x1228.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Wo2_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfdfa869-980d-4ee1-be1f-e8c33fe5355c_1881x1228.png" width="1456" height="951" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bfdfa869-980d-4ee1-be1f-e8c33fe5355c_1881x1228.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:951,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:249193,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/190106122?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfdfa869-980d-4ee1-be1f-e8c33fe5355c_1881x1228.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Wo2_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfdfa869-980d-4ee1-be1f-e8c33fe5355c_1881x1228.png 424w, https://substackcdn.com/image/fetch/$s_!Wo2_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfdfa869-980d-4ee1-be1f-e8c33fe5355c_1881x1228.png 848w, https://substackcdn.com/image/fetch/$s_!Wo2_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfdfa869-980d-4ee1-be1f-e8c33fe5355c_1881x1228.png 1272w, https://substackcdn.com/image/fetch/$s_!Wo2_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfdfa869-980d-4ee1-be1f-e8c33fe5355c_1881x1228.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This approach keeps transactions small and prevents long table locks.</p><p>It also allows the migration to run safely while the system continues serving traffic.</p><p>Many production systems combine this with <strong>progress tracking</strong>, so the job can resume if it stops.</p><p>The goal is simple:</p><p>Migrate the data <strong>without impacting the rest of the system</strong>.</p><h4>The Hardest Problem Is Not Technical</h4><p>The Expand / Contract pattern itself is technically simple.</p><p>The hardest problem is organizational.</p><p>Shared databases mean multiple teams depend on the same schema. That means migrations require coordination, communication, and clear ownership.</p><p>Without that discipline, temporary compatibility layers remain indefinitely. Old columns stay around because nobody is sure which system still depends on them.</p><p>Over time, schemas accumulate artifacts like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!i_-D!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70cfa9d1-7699-4aba-bead-1c9e61fccc55_512x560.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!i_-D!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70cfa9d1-7699-4aba-bead-1c9e61fccc55_512x560.png 424w, https://substackcdn.com/image/fetch/$s_!i_-D!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70cfa9d1-7699-4aba-bead-1c9e61fccc55_512x560.png 848w, https://substackcdn.com/image/fetch/$s_!i_-D!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70cfa9d1-7699-4aba-bead-1c9e61fccc55_512x560.png 1272w, https://substackcdn.com/image/fetch/$s_!i_-D!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70cfa9d1-7699-4aba-bead-1c9e61fccc55_512x560.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!i_-D!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70cfa9d1-7699-4aba-bead-1c9e61fccc55_512x560.png" width="512" height="560" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/70cfa9d1-7699-4aba-bead-1c9e61fccc55_512x560.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:560,&quot;width&quot;:512,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:54606,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/190106122?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70cfa9d1-7699-4aba-bead-1c9e61fccc55_512x560.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!i_-D!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70cfa9d1-7699-4aba-bead-1c9e61fccc55_512x560.png 424w, https://substackcdn.com/image/fetch/$s_!i_-D!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70cfa9d1-7699-4aba-bead-1c9e61fccc55_512x560.png 848w, https://substackcdn.com/image/fetch/$s_!i_-D!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70cfa9d1-7699-4aba-bead-1c9e61fccc55_512x560.png 1272w, https://substackcdn.com/image/fetch/$s_!i_-D!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70cfa9d1-7699-4aba-bead-1c9e61fccc55_512x560.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Successful teams treat schema changes like any other cross-team change:</p><ul><li><p>they track migration progress</p></li><li><p>define schema ownership</p></li><li><p>schedule the contract phase explicitly</p></li></ul><p>The technical pattern is straightforward.</p><p>The real challenge is <strong>making sure the organization follows through.</strong></p><h2>Takeaways</h2><ul><li><p>Database refactoring is harder than code refactoring because many systems depend on the same schema.</p></li><li><p>Direct schema changes often break running services.</p></li><li><p>The Expand / Contract pattern allows schemas to evolve safely by introducing changes in stages.</p></li><li><p>Dual writes keep old and new structures consistent while systems migrate.</p></li><li><p>A schema migration completes only after you remove the old structures.</p></li></ul><p></p><p>The safest database migration is the one that allows old and new systems to coexist.</p><blockquote><p>Compatibility buys you time.<br>Time keeps production running.</p></blockquote><p></p><p>Until next time,<br>&#8212; Raul</p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[CAP questions almost never appear labeled as “CAP theorem.”]]></title><description><![CDATA[They show up disguised as simple data questions.]]></description><link>https://newsletter.systemdesignclassroom.com/p/consistency-vs-accuracy-distributed-systems</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/consistency-vs-accuracy-distributed-systems</guid><dc:creator><![CDATA[Raul Junco]]></dc:creator><pubDate>Sat, 07 Mar 2026 12:53:30 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/aaea914a-3004-429d-91c0-7aa8463f5e6d_2424x2970.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This is one of the trickiest <strong>questions I have heard</strong> in system design interviews:</p><blockquote><p><strong>Can a system be accurate but inconsistent?</strong></p></blockquote><p>Many candidates pause here because the phrase sounds like an oxymoron; something contradictory that shouldn&#8217;t even be possible.</p><p>It is not.</p><p>Understanding this possibility is important because distributed systems constantly separate accuracy &amp; consistency.<br>And once systems scale across replicas and regions, the gap between <strong>accuracy</strong> and <strong>consistency</strong> becomes impossible to ignore.</p><p>To see why, we first need to define what those terms actually mean.</p><div><hr></div><h3>The best way to build any app</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zOKL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zOKL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png 424w, https://substackcdn.com/image/fetch/$s_!zOKL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png 848w, https://substackcdn.com/image/fetch/$s_!zOKL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png 1272w, https://substackcdn.com/image/fetch/$s_!zOKL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zOKL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png" width="1456" height="819" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:819,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:192630,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/188817135?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zOKL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png 424w, https://substackcdn.com/image/fetch/$s_!zOKL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png 848w, https://substackcdn.com/image/fetch/$s_!zOKL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png 1272w, https://substackcdn.com/image/fetch/$s_!zOKL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Most &#8220;AI app builders&#8221; aren&#8217;t actually app builders. They are infrastructure middlemen. You live inside their box, choose from their secret stack, and force you to start over the moment you want to use a different database, payment processor, or tool. With Orchids:</p><ul><li><p>You&#8217;re not locked-in to Supabase or Stripe.</p></li><li><p>Not forced to spend credits, bring your own AI subscriptions with you.</p></li><li><p>One-click deployment straight to Vercel</p></li></ul><p>Build  anything. From Web, mobile, internal tools, browser extensions, scripts, and bots. Orchids.app is capable of building anything that you can put your mind to.</p><p>Use code <strong>MARCH15</strong> for <strong>15% off</strong> (one-time discount).</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://orchidsapp.link/raul&quot;,&quot;text&quot;:&quot;Get Started Today&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://orchidsapp.link/raul"><span>Get Started Today</span></a></p><div><hr></div><h3>Accuracy vs Consistency</h3><p>Let&#8217;s start with the definitions.</p><p><strong>Accuracy</strong> means the data reflects the real-world value.</p><p><strong>Consistency can mean different things depending on context.</strong><br>In casual conversations, engineers sometimes mean &#8220;replicas return the same value.&#8221;<br>In the CAP theorem, consistency specifically refers to <strong>linearizability</strong>, where reads always see the most recent committed write.</p><p>In a single database running on one machine, these usually appear together.<br>The correct value is written once, and every read returns that same value.</p><p>But distributed systems introduce replication.</p><p>Multiple nodes store copies of the same data.<br>Those copies must stay synchronized.</p><p>That synchronization delay is exactly where accuracy and consistency begin to diverge.</p><p>The confusion happens because small systems usually give you both properties at the same time.</p><p>And the easiest way to see that is through a very common scenario: a system that is <strong>accurate but temporarily inconsistent</strong>.</p><h3>Accurate but inconsistent</h3><p>This situation happens constantly in distributed systems.</p><p>Imagine a user updating their email address.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7TR_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34326f3c-92bf-4edf-a904-d0ade612a0e2_2300x2008.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7TR_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34326f3c-92bf-4edf-a904-d0ade612a0e2_2300x2008.png 424w, https://substackcdn.com/image/fetch/$s_!7TR_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34326f3c-92bf-4edf-a904-d0ade612a0e2_2300x2008.png 848w, https://substackcdn.com/image/fetch/$s_!7TR_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34326f3c-92bf-4edf-a904-d0ade612a0e2_2300x2008.png 1272w, https://substackcdn.com/image/fetch/$s_!7TR_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34326f3c-92bf-4edf-a904-d0ade612a0e2_2300x2008.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7TR_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34326f3c-92bf-4edf-a904-d0ade612a0e2_2300x2008.png" width="1456" height="1271" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/34326f3c-92bf-4edf-a904-d0ade612a0e2_2300x2008.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1271,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:632381,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/189868894?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34326f3c-92bf-4edf-a904-d0ade612a0e2_2300x2008.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7TR_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34326f3c-92bf-4edf-a904-d0ade612a0e2_2300x2008.png 424w, https://substackcdn.com/image/fetch/$s_!7TR_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34326f3c-92bf-4edf-a904-d0ade612a0e2_2300x2008.png 848w, https://substackcdn.com/image/fetch/$s_!7TR_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34326f3c-92bf-4edf-a904-d0ade612a0e2_2300x2008.png 1272w, https://substackcdn.com/image/fetch/$s_!7TR_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34326f3c-92bf-4edf-a904-d0ade612a0e2_2300x2008.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now imagine a read request arrives during that replication window.</p><p>The <strong>primary database</strong> returns the new email.</p><p>A <strong>replica</strong> still returns the old one.</p><p>Some users see the new value.<br>Others see the old one.</p><p>The system already contains the <strong>correct value</strong>, so it is <strong>accurate</strong>.</p><p>But the nodes <strong>do not agree yet</strong>, so it is <strong>inconsistent</strong>.</p><p>This behavior appears in systems using:</p><ul><li><p>read replicas</p></li><li><p>multi-region databases</p></li><li><p>asynchronous replication</p></li><li><p>eventual consistency models</p></li></ul><p>The inconsistency usually resolves itself once replication finishes.</p><p>But not all inconsistencies are temporary. In fact, the more dangerous scenario is when a system becomes <strong>perfectly consistent while being completely wrong</strong>.</p><h3>Consistent but inaccurate</h3><p>Now consider a different situation.</p><p>A bug writes the wrong tax rate.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!1ocD!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38f83c15-ccff-4736-8a35-25ee604481a9_2300x2203.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1ocD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38f83c15-ccff-4736-8a35-25ee604481a9_2300x2203.png 424w, https://substackcdn.com/image/fetch/$s_!1ocD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38f83c15-ccff-4736-8a35-25ee604481a9_2300x2203.png 848w, https://substackcdn.com/image/fetch/$s_!1ocD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38f83c15-ccff-4736-8a35-25ee604481a9_2300x2203.png 1272w, https://substackcdn.com/image/fetch/$s_!1ocD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38f83c15-ccff-4736-8a35-25ee604481a9_2300x2203.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1ocD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38f83c15-ccff-4736-8a35-25ee604481a9_2300x2203.png" width="1456" height="1395" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/38f83c15-ccff-4736-8a35-25ee604481a9_2300x2203.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1395,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:719136,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/189868894?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38f83c15-ccff-4736-8a35-25ee604481a9_2300x2203.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1ocD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38f83c15-ccff-4736-8a35-25ee604481a9_2300x2203.png 424w, https://substackcdn.com/image/fetch/$s_!1ocD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38f83c15-ccff-4736-8a35-25ee604481a9_2300x2203.png 848w, https://substackcdn.com/image/fetch/$s_!1ocD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38f83c15-ccff-4736-8a35-25ee604481a9_2300x2203.png 1272w, https://substackcdn.com/image/fetch/$s_!1ocD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38f83c15-ccff-4736-8a35-25ee604481a9_2300x2203.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Every node returns <strong>the same number</strong>.</p><p>The system is now <strong>perfectly consistent</strong>.</p><p>But the number itself is <strong>incorrect</strong>.</p><p>Consistency guarantees agreement about the relative order of reads and writes as observed by clients, in a way that behaves like a single global log.</p><p>It does <strong>not guarantee correctness</strong>.</p><p>A distributed system can synchronize bad data just as efficiently as good data.</p><p>This is why strong consistency does not protect a system from logical errors.</p><p>And that leads to one of the most common misunderstandings engineers have about the CAP theorem.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0vig!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F146fe587-ff65-4733-a78b-91860610655f_2458x1610.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0vig!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F146fe587-ff65-4733-a78b-91860610655f_2458x1610.png 424w, https://substackcdn.com/image/fetch/$s_!0vig!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F146fe587-ff65-4733-a78b-91860610655f_2458x1610.png 848w, https://substackcdn.com/image/fetch/$s_!0vig!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F146fe587-ff65-4733-a78b-91860610655f_2458x1610.png 1272w, https://substackcdn.com/image/fetch/$s_!0vig!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F146fe587-ff65-4733-a78b-91860610655f_2458x1610.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0vig!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F146fe587-ff65-4733-a78b-91860610655f_2458x1610.png" width="1456" height="954" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/146fe587-ff65-4733-a78b-91860610655f_2458x1610.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:954,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:798393,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/189868894?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F146fe587-ff65-4733-a78b-91860610655f_2458x1610.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0vig!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F146fe587-ff65-4733-a78b-91860610655f_2458x1610.png 424w, https://substackcdn.com/image/fetch/$s_!0vig!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F146fe587-ff65-4733-a78b-91860610655f_2458x1610.png 848w, https://substackcdn.com/image/fetch/$s_!0vig!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F146fe587-ff65-4733-a78b-91860610655f_2458x1610.png 1272w, https://substackcdn.com/image/fetch/$s_!0vig!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F146fe587-ff65-4733-a78b-91860610655f_2458x1610.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>The CAP misconception</h3><p>Many engineers assume <strong>strong consistency prevents incorrect data</strong>.</p><p>But that&#8217;s not what the CAP theorem promises.</p><p>In the CAP theorem, consistency refers to <strong>linearizability</strong>: every read appears to see the most recent completed write as if all operations happened in a single global order.</p><p>This is different from the everyday meaning of &#8220;replicas having the same value&#8221; or SQL-style consistency constraints.</p><p>If the write itself is wrong, the system will consistently return the wrong value everywhere.</p><p>In other words:</p><p>Consistency protects <strong>agreement about the order of writes</strong>, not the truth of the data itself.</p><p>Truth depends on things like:</p><ul><li><p>application validation</p></li><li><p>business rules</p></li><li><p>transactional safeguards</p></li><li><p>domain logic</p></li></ul><p>Distributed systems coordinate <strong>during and after writes</strong> so nodes agree on the result.</p><p>Many production systems relax this guarantee and instead provide <strong>eventual consistency</strong>, where replicas may temporarily diverge but converge over time.</p><p>But that agreement comes at a cost, because coordinating nodes across machines or regions is never free.</p><h3>The latency tax of coordination</h3><p>Strong consistency requires nodes to coordinate before confirming a write.</p><p>A typical strongly consistent write looks like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3tYP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64739db8-abfd-4cd6-a229-0b275add1306_2555x2536.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3tYP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64739db8-abfd-4cd6-a229-0b275add1306_2555x2536.png 424w, https://substackcdn.com/image/fetch/$s_!3tYP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64739db8-abfd-4cd6-a229-0b275add1306_2555x2536.png 848w, https://substackcdn.com/image/fetch/$s_!3tYP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64739db8-abfd-4cd6-a229-0b275add1306_2555x2536.png 1272w, https://substackcdn.com/image/fetch/$s_!3tYP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64739db8-abfd-4cd6-a229-0b275add1306_2555x2536.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3tYP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64739db8-abfd-4cd6-a229-0b275add1306_2555x2536.png" width="1456" height="1445" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/64739db8-abfd-4cd6-a229-0b275add1306_2555x2536.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1445,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1082533,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/189868894?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64739db8-abfd-4cd6-a229-0b275add1306_2555x2536.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3tYP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64739db8-abfd-4cd6-a229-0b275add1306_2555x2536.png 424w, https://substackcdn.com/image/fetch/$s_!3tYP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64739db8-abfd-4cd6-a229-0b275add1306_2555x2536.png 848w, https://substackcdn.com/image/fetch/$s_!3tYP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64739db8-abfd-4cd6-a229-0b275add1306_2555x2536.png 1272w, https://substackcdn.com/image/fetch/$s_!3tYP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64739db8-abfd-4cd6-a229-0b275add1306_2555x2536.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Each additional replica adds more communication.</p><p>Across regions, this becomes expensive.</p><p>A write that takes <strong>5 ms locally</strong> might take <strong>80&#8211;200 ms globally</strong>.</p><p>At scale, that latency affects user experience.</p><p>To avoid that cost, many distributed systems allow writes to succeed without waiting for every replica to confirm.</p><p>Updates propagate asynchronously.</p><p>This reduces latency but introduces temporary inconsistency.</p><p>Strong consistency requires <strong>coordination between nodes before a write is considered committed</strong>.<br>Most distributed databases implement this using <strong>quorums or consensus protocols</strong>, where a majority of replicas must acknowledge the write.</p><p>And different products choose different approaches depending on what matters most for the system.</p><h3>Why systems choose different trade-offs</h3><p>Architecture decisions always depend on the domain.</p><p>Some systems must guarantee correctness immediately.</p><p>Others must prioritize speed and availability.</p><h4>Systems that require strong consistency</h4><p>These domains cannot tolerate incorrect values:</p><ul><li><p>banking balances</p></li><li><p>payment processing</p></li><li><p>financial ledgers</p></li><li><p>inventory reservations</p></li></ul><p>If two nodes approve the same payment simultaneously, the system could double-charge a user.</p><p>To prevent that, these systems accept the latency cost of coordination.</p><p>Correctness with respect to business invariants must be guaranteed before a transaction commits.</p><p>But not every system faces that constraint.</p><h4>Systems that accept eventual consistency</h4><p>Other domains prioritize responsiveness and global scale:</p><ul><li><p>social feeds</p></li><li><p>analytics dashboards</p></li><li><p>recommendation engines</p></li><li><p>caching layers</p></li></ul><p>If a post appears a few seconds later in another region, the user experience barely changes.</p><p>But forcing every write to coordinate globally would slow the system dramatically.</p><p>These architectures allow temporary inconsistency while updates propagate across replicas.</p><p>Eventually, all nodes converge to the same value.</p><p>And that design decision reveals the real lesson behind CAP.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3rU2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F046bdc50-de05-46b1-9d39-cf6cca216d8a_2458x244.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3rU2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F046bdc50-de05-46b1-9d39-cf6cca216d8a_2458x244.png 424w, https://substackcdn.com/image/fetch/$s_!3rU2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F046bdc50-de05-46b1-9d39-cf6cca216d8a_2458x244.png 848w, https://substackcdn.com/image/fetch/$s_!3rU2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F046bdc50-de05-46b1-9d39-cf6cca216d8a_2458x244.png 1272w, https://substackcdn.com/image/fetch/$s_!3rU2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F046bdc50-de05-46b1-9d39-cf6cca216d8a_2458x244.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3rU2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F046bdc50-de05-46b1-9d39-cf6cca216d8a_2458x244.png" width="1456" height="145" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/046bdc50-de05-46b1-9d39-cf6cca216d8a_2458x244.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:145,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:115034,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/189868894?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F046bdc50-de05-46b1-9d39-cf6cca216d8a_2458x244.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3rU2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F046bdc50-de05-46b1-9d39-cf6cca216d8a_2458x244.png 424w, https://substackcdn.com/image/fetch/$s_!3rU2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F046bdc50-de05-46b1-9d39-cf6cca216d8a_2458x244.png 848w, https://substackcdn.com/image/fetch/$s_!3rU2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F046bdc50-de05-46b1-9d39-cf6cca216d8a_2458x244.png 1272w, https://substackcdn.com/image/fetch/$s_!3rU2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F046bdc50-de05-46b1-9d39-cf6cca216d8a_2458x244.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><h3>The real lesson of CAP</h3><p>The CAP theorem often appears in textbooks as a theoretical concept.</p><p>In practice, it represents a constant architectural choice.</p><p>Every distributed system must balance:</p><ul><li><p>coordination cost</p></li><li><p>latency</p></li><li><p>availability</p></li><li><p>correctness guarantees</p></li></ul><p>At a small scale, these trade-offs are easy to ignore.</p><p>But once systems span multiple replicas, regions, and networks, they become unavoidable.</p><p>Which is why the real challenge in system design isn&#8217;t eliminating trade-offs.</p><p>It&#8217;s deciding <strong>which trade-off hurts the least</strong>.</p><h3>Final thought</h3><p>Distributed systems will always contain imperfections.</p><p>Nodes fail.<br>Networks partition.<br>Replication lags.</p><p>You cannot design those problems away.</p><p>But you can decide how the system behaves when they happen.</p><p>A system can be:</p><ul><li><p><strong>accurate but temporarily inconsistent</strong> (replication lag)</p></li><li><p><strong>consistent but permanently wrong</strong> (a bad write replicated everywhere)</p></li><li><p><strong>both inaccurate and inconsistent</strong> (bugs combined with replication delay)</p></li></ul><p>And the architecture determines which one occurs.</p><p>Good engineers don&#8217;t try to build perfect systems.</p><p>They design systems where <strong>the inevitable failure mode causes the least damage</strong>.</p><p></p><blockquote><p>Because at scale, system design isn&#8217;t about perfection.</p><p>It&#8217;s about <strong>choosing the right compromise</strong>.</p></blockquote><p></p><p>Until next time,<br>&#8212; Raul</p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[A Single Subscriber Doesn’t Turn Pub/Sub Into a Queue]]></title><description><![CDATA[Why execution semantics -not tooling- define async patterns.]]></description><link>https://newsletter.systemdesignclassroom.com/p/a-single-subscriber-doesnt-turn-pubsub-into-a-queue</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/a-single-subscriber-doesnt-turn-pubsub-into-a-queue</guid><dc:creator><![CDATA[Raul Junco]]></dc:creator><pubDate>Sat, 28 Feb 2026 12:52:05 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/c0ccdfce-ca86-4a28-8711-84fe60d79a2d_6731x3862.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A few weeks ago, an engineer reached out with a question that looked simple on the surface:</p><blockquote><p><strong>User requests a report &#8594; API queues a job &#8594; worker generates the PDF.<br>Is this pub/sub or a work queue?</strong></p></blockquote><p>The team was split.<br>Some argued it was pub/sub because the producer is decoupled from the consumer.<br>Others said it was a queue because only one worker processes the job.</p><p>It looked like a terminology debate.</p><p>It wasn&#8217;t.</p><p>The answer changes how the system behaves under load, failure, and scale, which means we need to step back and look beyond the tools.</p><div><hr></div><h3>The best way to build any app</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zOKL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zOKL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png 424w, https://substackcdn.com/image/fetch/$s_!zOKL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png 848w, https://substackcdn.com/image/fetch/$s_!zOKL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png 1272w, https://substackcdn.com/image/fetch/$s_!zOKL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zOKL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png" width="1456" height="819" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:819,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:192630,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/188817135?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zOKL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png 424w, https://substackcdn.com/image/fetch/$s_!zOKL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png 848w, https://substackcdn.com/image/fetch/$s_!zOKL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png 1272w, https://substackcdn.com/image/fetch/$s_!zOKL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceef8368-d4ab-4de6-b178-3974fbd77de7_2048x1152.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Most &#8220;AI app builders&#8221; aren&#8217;t actually app builders. They are infrastructure middlemen. You live inside their box, choose from their secret stack, and force you to start over the moment you want to use a different database, payment processor, or tool. With Orchids:</p><ul><li><p>You&#8217;re not locked-in to Supabase or Stripe.</p></li><li><p>Not forced to spend credits, bring your own AI subscriptions with you.</p></li><li><p>One-click deployment straight to Vercel</p></li></ul><p>Build  anything. From Web, mobile, internal tools, browser extensions, scripts, and bots. Orchids.app is capable of building anything that you can put your mind to.</p><p>Use code <strong>MARCH15</strong> for <strong>15% off</strong> (one-time discount).</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://orchidsapp.link/raul&quot;,&quot;text&quot;:&quot;Get Started Today&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://orchidsapp.link/raul"><span>Get Started Today</span></a></p><div><hr></div><h3>Start with intent, not tooling</h3><p>When engineers discuss async systems, the conversation often jumps straight to Kafka, SQS, RabbitMQ, or Redis.</p><p>That&#8217;s like choosing a truck before deciding whether you&#8217;re moving furniture or delivering packages.</p><p>Transport moves messages.<br>Patterns define meaning.</p><p>The real question is: <strong>what is the system trying to accomplish?</strong></p><p>Understanding the intent becomes easier when we look at the actual flow that triggered the debate.</p><h3>The report generator scenario</h3><ol><li><p>User requests a report</p></li><li><p>API enqueues a job</p></li><li><p>Worker generates the PDF</p></li><li><p>Result is stored, and the client is notified the report is ready</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tc5O!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03357557-c96c-4b09-8ab7-c62c6db365f5_3290x1028.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tc5O!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03357557-c96c-4b09-8ab7-c62c6db365f5_3290x1028.png 424w, https://substackcdn.com/image/fetch/$s_!tc5O!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03357557-c96c-4b09-8ab7-c62c6db365f5_3290x1028.png 848w, https://substackcdn.com/image/fetch/$s_!tc5O!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03357557-c96c-4b09-8ab7-c62c6db365f5_3290x1028.png 1272w, https://substackcdn.com/image/fetch/$s_!tc5O!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03357557-c96c-4b09-8ab7-c62c6db365f5_3290x1028.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tc5O!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03357557-c96c-4b09-8ab7-c62c6db365f5_3290x1028.png" width="1456" height="455" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/03357557-c96c-4b09-8ab7-c62c6db365f5_3290x1028.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:455,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:320315,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/188817135?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03357557-c96c-4b09-8ab7-c62c6db365f5_3290x1028.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tc5O!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03357557-c96c-4b09-8ab7-c62c6db365f5_3290x1028.png 424w, https://substackcdn.com/image/fetch/$s_!tc5O!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03357557-c96c-4b09-8ab7-c62c6db365f5_3290x1028.png 848w, https://substackcdn.com/image/fetch/$s_!tc5O!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03357557-c96c-4b09-8ab7-c62c6db365f5_3290x1028.png 1272w, https://substackcdn.com/image/fetch/$s_!tc5O!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03357557-c96c-4b09-8ab7-c62c6db365f5_3290x1028.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The system expects the job to run once. If the worker crashes, the job must retry. If demand increases, more workers can be added.</p><p>Nothing here suggests broadcasting information.</p><p>The system is executing work.</p><p>This is a <strong>work queue</strong>.</p><p>To see why, we need to look at the pattern designed specifically for executing tasks.</p><h3>Work queue: built to execute work</h3><p>A work queue says:</p><blockquote><p>&#8220;Do this task.&#8221;</p></blockquote><p>Each job is handled by a single worker. If you add more workers, the workload spreads across them. If no worker successfully processes the job, the task remains incomplete, and the system retries it or moves it to a dead-letter queue, but this is a story for another day.</p><p>Think about generating a PDF, sending an email receipt, or resizing images. You don&#8217;t want five services doing the same work. You want the work done once, reliably.</p><p>This model optimizes for throughput, retries, and completion guarantees.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!43JX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d735b00-3762-4028-b2e9-8dd05f4d8eb6_3436x1641.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!43JX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d735b00-3762-4028-b2e9-8dd05f4d8eb6_3436x1641.png 424w, https://substackcdn.com/image/fetch/$s_!43JX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d735b00-3762-4028-b2e9-8dd05f4d8eb6_3436x1641.png 848w, https://substackcdn.com/image/fetch/$s_!43JX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d735b00-3762-4028-b2e9-8dd05f4d8eb6_3436x1641.png 1272w, https://substackcdn.com/image/fetch/$s_!43JX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d735b00-3762-4028-b2e9-8dd05f4d8eb6_3436x1641.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!43JX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d735b00-3762-4028-b2e9-8dd05f4d8eb6_3436x1641.png" width="1456" height="695" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5d735b00-3762-4028-b2e9-8dd05f4d8eb6_3436x1641.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:695,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:522033,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/188817135?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d735b00-3762-4028-b2e9-8dd05f4d8eb6_3436x1641.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!43JX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d735b00-3762-4028-b2e9-8dd05f4d8eb6_3436x1641.png 424w, https://substackcdn.com/image/fetch/$s_!43JX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d735b00-3762-4028-b2e9-8dd05f4d8eb6_3436x1641.png 848w, https://substackcdn.com/image/fetch/$s_!43JX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d735b00-3762-4028-b2e9-8dd05f4d8eb6_3436x1641.png 1272w, https://substackcdn.com/image/fetch/$s_!43JX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5d735b00-3762-4028-b2e9-8dd05f4d8eb6_3436x1641.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>To understand the contrast, let&#8217;s look at the pattern built for distributing information instead of executing work.</p><h3>Pub/sub: built to distribute facts</h3><p>Pub/sub says:</p><blockquote><p>&#8220;This happened.&#8221;</p></blockquote><p>When an event occurs, multiple systems may react independently. Each subscriber receives its own copy. One subscriber failing does not block the others.</p><p>Imagine a user signs up. That single event might trigger analytics tracking, a welcome email, CRM updates, and fraud checks.</p><p>No single service owns the event. They react to it.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!oyL9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6fd7f9c-2716-453f-87cd-b4808fe2affd_3365x1567.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oyL9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6fd7f9c-2716-453f-87cd-b4808fe2affd_3365x1567.png 424w, https://substackcdn.com/image/fetch/$s_!oyL9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6fd7f9c-2716-453f-87cd-b4808fe2affd_3365x1567.png 848w, https://substackcdn.com/image/fetch/$s_!oyL9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6fd7f9c-2716-453f-87cd-b4808fe2affd_3365x1567.png 1272w, https://substackcdn.com/image/fetch/$s_!oyL9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6fd7f9c-2716-453f-87cd-b4808fe2affd_3365x1567.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!oyL9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6fd7f9c-2716-453f-87cd-b4808fe2affd_3365x1567.png" width="1456" height="678" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d6fd7f9c-2716-453f-87cd-b4808fe2affd_3365x1567.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:678,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:530424,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/188817135?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6fd7f9c-2716-453f-87cd-b4808fe2affd_3365x1567.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!oyL9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6fd7f9c-2716-453f-87cd-b4808fe2affd_3365x1567.png 424w, https://substackcdn.com/image/fetch/$s_!oyL9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6fd7f9c-2716-453f-87cd-b4808fe2affd_3365x1567.png 848w, https://substackcdn.com/image/fetch/$s_!oyL9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6fd7f9c-2716-453f-87cd-b4808fe2affd_3365x1567.png 1272w, https://substackcdn.com/image/fetch/$s_!oyL9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6fd7f9c-2716-453f-87cd-b4808fe2affd_3365x1567.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This model optimizes for independence and extensibility.</p><p>At this point, the confusion usually appears: both patterns decouple components, so why aren&#8217;t they the same?</p><h3>Why decoupling alone isn&#8217;t the definition</h3><p>Decoupling is a side effect, not the defining trait.</p><p>If decoupling were the definition, every async system would be pub/sub, and the term would stop being useful.</p><p>What matters is consumption behavior.</p><p>If another consumer joins:</p><ul><li><p>should the work split?</p></li><li><p>or should the work duplicate?</p></li></ul><p>That answer reveals the pattern.</p><p>Your PDF generation should not run twice.</p><p>Another way to clarify the difference is to look at what the message represents.</p><h3>Commands vs events: a useful shortcut</h3><p>A <strong>command</strong> tells the system to do something.<br>An <strong>event</strong> tells the system something already happened.</p><p>&#8220;GenerateReport&#8221; is a command.<br>&#8220;ReportGenerated&#8221; is an event.</p><p>Commands belong in work queues.<br>Events belong in pub/sub systems.</p><p>By the way, most of the time, mature architectures use both.</p><p>This distinction may sound subtle, but it becomes very real once systems reach production scale.</p><h3>Why the distinction becomes painful in production</h3><p>The difference may sound subtle during design discussions, but it becomes very real once systems are under load and failures begin to surface.</p><p>Teams that blur the boundary often discover problems the hard way.</p><p>Duplicate billing because the same job ran twice.<br>Customers receiving the same email multiple times.<br>Retries triggering unexpected side effects.<br>Work completed but reported as failed due to acknowledgment timing.</p><p>These issues don&#8217;t come from bad intentions. They come from how messaging systems behave in real environments.</p><p>Most queues and streaming platforms provide <strong>at-least-once delivery</strong>. If a worker crashes, times out, or fails to acknowledge completion, the job becomes visible again and is retried. This improves reliability, but it also means the same job can execute more than once.</p><p>Because of this, consumers must be <strong>idempotent</strong>; the job may run multiple times, but the outcome must remain correct.</p><p>Event systems face a related challenge. Pub/sub consumers may replay historical events, reprocess messages after failures, or start from earlier offsets. Idempotency ensures these replays do not create duplicate side effects.</p><p>Exactly-once delivery is often discussed but rarely absolute. Some platforms provide transactional guarantees within the messaging system, yet external side effects (sending emails, charging payments, calling APIs) still require safeguards.</p><p>Understanding delivery guarantees explains why duplicates happen:</p><ul><li><p>Retries improve reliability</p></li><li><p>Reliability introduces duplicates</p></li><li><p>Idempotency preserves correctness</p></li></ul><blockquote><p>Queues prioritize reliable execution of work.<br>Pub/sub prioritizes reliable distribution of events.</p></blockquote><p>Getting the pattern right and designing for its guarantees is what keeps systems predictable when real failures occur.</p><h3>The clean evolution path</h3><p>Start by enqueueing a command to generate the report.</p><p>After completion, emit a <code>ReportGenerated</code> event.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!HCqc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79865689-290d-4528-9e9f-99977c1bf290_4899x2123.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HCqc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79865689-290d-4528-9e9f-99977c1bf290_4899x2123.png 424w, https://substackcdn.com/image/fetch/$s_!HCqc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79865689-290d-4528-9e9f-99977c1bf290_4899x2123.png 848w, https://substackcdn.com/image/fetch/$s_!HCqc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79865689-290d-4528-9e9f-99977c1bf290_4899x2123.png 1272w, https://substackcdn.com/image/fetch/$s_!HCqc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79865689-290d-4528-9e9f-99977c1bf290_4899x2123.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!HCqc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79865689-290d-4528-9e9f-99977c1bf290_4899x2123.png" width="1456" height="631" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/79865689-290d-4528-9e9f-99977c1bf290_4899x2123.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:631,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:830824,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/188817135?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79865689-290d-4528-9e9f-99977c1bf290_4899x2123.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HCqc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79865689-290d-4528-9e9f-99977c1bf290_4899x2123.png 424w, https://substackcdn.com/image/fetch/$s_!HCqc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79865689-290d-4528-9e9f-99977c1bf290_4899x2123.png 848w, https://substackcdn.com/image/fetch/$s_!HCqc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79865689-290d-4528-9e9f-99977c1bf290_4899x2123.png 1272w, https://substackcdn.com/image/fetch/$s_!HCqc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79865689-290d-4528-9e9f-99977c1bf290_4899x2123.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now other systems can react, notifications, analytics, auditing, and caching, without coupling themselves to the report service.</p><p>The work remains controlled.<br>The ecosystem stays extensible.</p><p>If the distinction still feels abstract, a real-world analogy makes the difference obvious.</p><h3>A simple analogy</h3><p>Think of an airport baggage system.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!CL6S!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5438b565-f345-4a3a-8319-75ff8b419ee6_4879x2459.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CL6S!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5438b565-f345-4a3a-8319-75ff8b419ee6_4879x2459.png 424w, https://substackcdn.com/image/fetch/$s_!CL6S!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5438b565-f345-4a3a-8319-75ff8b419ee6_4879x2459.png 848w, https://substackcdn.com/image/fetch/$s_!CL6S!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5438b565-f345-4a3a-8319-75ff8b419ee6_4879x2459.png 1272w, https://substackcdn.com/image/fetch/$s_!CL6S!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5438b565-f345-4a3a-8319-75ff8b419ee6_4879x2459.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!CL6S!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5438b565-f345-4a3a-8319-75ff8b419ee6_4879x2459.png" width="1456" height="734" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5438b565-f345-4a3a-8319-75ff8b419ee6_4879x2459.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:734,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1006408,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/188817135?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5438b565-f345-4a3a-8319-75ff8b419ee6_4879x2459.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!CL6S!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5438b565-f345-4a3a-8319-75ff8b419ee6_4879x2459.png 424w, https://substackcdn.com/image/fetch/$s_!CL6S!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5438b565-f345-4a3a-8319-75ff8b419ee6_4879x2459.png 848w, https://substackcdn.com/image/fetch/$s_!CL6S!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5438b565-f345-4a3a-8319-75ff8b419ee6_4879x2459.png 1272w, https://substackcdn.com/image/fetch/$s_!CL6S!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5438b565-f345-4a3a-8319-75ff8b419ee6_4879x2459.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>When you check a suitcase, it is routed to one handler who loads it onto your flight. That&#8217;s a work queue. The task must be completed once, and if it fails, your bag doesn&#8217;t arrive.</p><p>When the plane lands, an arrival event is triggered. Baggage claim displays update, ground crew prepare the gate, and notifications are sent to connecting flights. That&#8217;s pub/sub. Multiple systems react independently to the same event.</p><p>Different intent. Different behavior.</p><p>Understanding the difference is what allows systems to scale without surprises.</p><h3>If you remember one thing</h3><p>Most async flows are not pub/sub.<br>They are work queues that may emit events after completion.</p><p>Understanding that difference prevents duplicate work, simplifies retries, and keeps system responsibilities clear.</p><blockquote><p>And clarity is what allows systems to scale without surprises.</p></blockquote><p></p><p>Until next time,<br>&#8212; Raul</p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[80% Of The Times, Scaling Is Not a Rewrite Problem]]></title><description><![CDATA[How a single interview question reveals who understands load, risk, and trade-offs]]></description><link>https://newsletter.systemdesignclassroom.com/p/scaling-is-not-a-rewrite-problem</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/scaling-is-not-a-rewrite-problem</guid><dc:creator><![CDATA[Raul Junco]]></dc:creator><pubDate>Sat, 10 Jan 2026 12:33:29 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/247863d1-4a7d-4aec-9dd4-0ef4f08c57a8_2727x2714.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This question looks simple. It isn&#8217;t.</p><blockquote><p><strong>You inherit a production monolith that starts failing during peak traffic. You have 90 days to improve scalability. A full rewrite is not an option. What do you do?</strong></p></blockquote><p>This is one of the best system design interview questions I&#8217;ve heard.</p><p>Not because it tests tools. Not because it tests architecture diagrams.</p><p>But because it tests something much harder:</p><p><strong>Can you reason under real constraints?</strong></p><p>Most candidates hear this question and immediately say:</p><blockquote><p>&#8220;I&#8217;d break it into microservices.&#8221;</p></blockquote><p>That answer usually fails.</p><p>Not because microservices are bad. But because <strong>rewriting a system that&#8217;s already failing is the fastest way to make things worse</strong>.</p><p>This question is really about judgment.</p><p>And judgment is the core skill that System Design interviews aim to measure.</p><div><hr></div><p>If you want to train this kind of judgment intentionally, this is exactly what we focus on at <strong><a href="https://www.joinenginuity.com/question-of-day">joinenginuity.com</a></strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!TiVx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4028f355-a55a-45f7-9c80-27f3993eb6a6_2352x2088.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TiVx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4028f355-a55a-45f7-9c80-27f3993eb6a6_2352x2088.png 424w, https://substackcdn.com/image/fetch/$s_!TiVx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4028f355-a55a-45f7-9c80-27f3993eb6a6_2352x2088.png 848w, https://substackcdn.com/image/fetch/$s_!TiVx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4028f355-a55a-45f7-9c80-27f3993eb6a6_2352x2088.png 1272w, https://substackcdn.com/image/fetch/$s_!TiVx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4028f355-a55a-45f7-9c80-27f3993eb6a6_2352x2088.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!TiVx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4028f355-a55a-45f7-9c80-27f3993eb6a6_2352x2088.png" width="1456" height="1293" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4028f355-a55a-45f7-9c80-27f3993eb6a6_2352x2088.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1293,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1239559,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/183159965?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4028f355-a55a-45f7-9c80-27f3993eb6a6_2352x2088.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!TiVx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4028f355-a55a-45f7-9c80-27f3993eb6a6_2352x2088.png 424w, https://substackcdn.com/image/fetch/$s_!TiVx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4028f355-a55a-45f7-9c80-27f3993eb6a6_2352x2088.png 848w, https://substackcdn.com/image/fetch/$s_!TiVx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4028f355-a55a-45f7-9c80-27f3993eb6a6_2352x2088.png 1272w, https://substackcdn.com/image/fetch/$s_!TiVx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4028f355-a55a-45f7-9c80-27f3993eb6a6_2352x2088.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Not memorizing architectures, but learning how to reason under constraints, pressure, and incomplete information.</p><p>To make it easier to get started, here is a <strong>30% off for the first 25 engineers</strong> using the coupon code <strong>ENGCLASSROOM30</strong>.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://www.joinenginuity.com/signup?callbackUrl=%2Fquestion-of-day&quot;,&quot;text&quot;:&quot;Join Us&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://www.joinenginuity.com/signup?callbackUrl=%2Fquestion-of-day"><span>Join Us</span></a></p><div><hr></div><p>Before jumping into timelines and tactics, there is a step many candidates skip entirely.</p><p>It is the most important one.</p><p>If you do not get this right, every decision that follows will be flawed, even if your architecture skills are strong.</p><h3>First: Reframe the problem</h3><p>Before timelines, phases, or technical steps, this question tests something more basic: <strong>can you restate the problem correctly</strong>?</p><p>Most system design failures don&#8217;t start with bad code. They start with a bad understanding of the problem being solved.</p><p>So before touching architecture, you need to show that you understand <em>what actually matters</em> in this situation.</p><p>Before touching code or architecture, I restate the problem in system terms.</p><p>What we actually know:</p><ul><li><p>The system is already in production</p></li><li><p>It fails under <strong>peak load</strong>, not average load</p></li><li><p>Revenue depends on it</p></li><li><p>You have <strong>12 weeks</strong>, not a year</p></li><li><p>A full rewrite is explicitly disallowed</p></li></ul><p>That changes the goal.</p><p>Now the goal is <strong>not elegance</strong>; focus on <strong>stability under peak pressure</strong>.</p><p>Increase peak capacity, reduce blast radius, and buy time.</p><p>If a candidate doesn&#8217;t say this out loud, they usually miss the intent of the question.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xAqW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91750662-9ffd-4610-b0ed-f5fd51d32fd9_2477x545.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xAqW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91750662-9ffd-4610-b0ed-f5fd51d32fd9_2477x545.png 424w, https://substackcdn.com/image/fetch/$s_!xAqW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91750662-9ffd-4610-b0ed-f5fd51d32fd9_2477x545.png 848w, https://substackcdn.com/image/fetch/$s_!xAqW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91750662-9ffd-4610-b0ed-f5fd51d32fd9_2477x545.png 1272w, https://substackcdn.com/image/fetch/$s_!xAqW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91750662-9ffd-4610-b0ed-f5fd51d32fd9_2477x545.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xAqW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91750662-9ffd-4610-b0ed-f5fd51d32fd9_2477x545.png" width="1456" height="320" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/91750662-9ffd-4610-b0ed-f5fd51d32fd9_2477x545.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:320,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:206224,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/183159965?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91750662-9ffd-4610-b0ed-f5fd51d32fd9_2477x545.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xAqW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91750662-9ffd-4610-b0ed-f5fd51d32fd9_2477x545.png 424w, https://substackcdn.com/image/fetch/$s_!xAqW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91750662-9ffd-4610-b0ed-f5fd51d32fd9_2477x545.png 848w, https://substackcdn.com/image/fetch/$s_!xAqW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91750662-9ffd-4610-b0ed-f5fd51d32fd9_2477x545.png 1272w, https://substackcdn.com/image/fetch/$s_!xAqW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91750662-9ffd-4610-b0ed-f5fd51d32fd9_2477x545.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Up to this point, everything has been about thinking clearly.</p><p><strong>Now it is time to act.</strong></p><p>The first phase is not about scaling up. It is about preventing things from getting worse, and it should take roughly two to four weeks.</p><h3>Month 1: Stop the bleeding</h3><p>This phase is about survival. Before you can start to think about scale, elegance, or future architecture, you need the system to stay up long enough to learn from it.</p><h4>1. Add observability before changing behavior</h4><p>If the system is failing and you don&#8217;t know why, every change is a guess.</p><p>So the first move is visibility:</p><ul><li><p>Request latency (p50 / p95 / p99)</p></li><li><p>Error rates by endpoint</p></li><li><p>Database query timing</p></li><li><p>Connection pool saturation</p></li><li><p>CPU and memory pressure</p></li></ul><p>If tracing is missing, add basic tracing.</p><p>Why this matters:</p><p>Scaling without observability is like load testing blindfolded. You might change something, but it&#8217;s impossible to know if it helped.</p><h4>2. Identify the hot path</h4><p>Under peak load, not everything matters.</p><p>Usually it&#8217;s:</p><ul><li><p>Checkout</p></li><li><p>Inventory reads</p></li><li><p>Pricing</p></li><li><p>Auth/session validation</p></li></ul><p>I look for:</p><ul><li><p>N+1 queries</p></li><li><p>Synchronous downstream calls</p></li><li><p>Unbounded fan&#8209;out</p></li><li><p>Lock contention</p></li><li><p>Chatty ORM behavior</p></li></ul><p>System design is about leverage.</p><blockquote><p>Fix the path every request touches. Ignore the rest for now.</p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!cPyL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03e7c76d-1a89-445d-9f93-f07005341456_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!cPyL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03e7c76d-1a89-445d-9f93-f07005341456_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!cPyL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03e7c76d-1a89-445d-9f93-f07005341456_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!cPyL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03e7c76d-1a89-445d-9f93-f07005341456_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!cPyL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03e7c76d-1a89-445d-9f93-f07005341456_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!cPyL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03e7c76d-1a89-445d-9f93-f07005341456_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/03e7c76d-1a89-445d-9f93-f07005341456_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1048631,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/183159965?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03e7c76d-1a89-445d-9f93-f07005341456_1024x1024.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!cPyL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03e7c76d-1a89-445d-9f93-f07005341456_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!cPyL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03e7c76d-1a89-445d-9f93-f07005341456_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!cPyL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03e7c76d-1a89-445d-9f93-f07005341456_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!cPyL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03e7c76d-1a89-445d-9f93-f07005341456_1024x1024.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4>3. Pull fast, reversible levers</h4><p>No refactors yet. No rewrites.</p><p>Only changes I can roll back quickly.</p><p>Typical examples:</p><ul><li><p>Add read replicas</p></li><li><p>Introduce cache&#8209;aside for hot reads</p></li><li><p>Add timeouts and circuit breakers</p></li><li><p>Rate&#8209;limit non&#8209;critical endpoints</p></li><li><p>Tune connection pools carefully</p></li></ul><p>In parallel, I apply <strong>infra&#8209;level scaling levers</strong> that are cheap and reversible:</p><p>This includes tuning instance sizes, autoscaling policies, container CPU and memory limits, and thread or connection pool sizes. These changes often buy immediate headroom and reduce cascading failures before any deeper work begins.</p><p>The goal of Month 1 is simple:</p><p><strong>Survive the next peak.</strong></p><h3>Month 2: Increase capacity without redesign</h3><p>Once the system stops falling over, the goal shifts. Now, you increase throughput and reduce pressure, without introducing risky structural changes you can&#8217;t easily undo.</p><h4>4. Turn the monolith into a modular monolith</h4><p>This is where strong candidates separate themselves.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hQ9c!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ca362d4-063e-43c3-bf25-cae761d7a295_2515x1789.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hQ9c!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ca362d4-063e-43c3-bf25-cae761d7a295_2515x1789.png 424w, https://substackcdn.com/image/fetch/$s_!hQ9c!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ca362d4-063e-43c3-bf25-cae761d7a295_2515x1789.png 848w, https://substackcdn.com/image/fetch/$s_!hQ9c!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ca362d4-063e-43c3-bf25-cae761d7a295_2515x1789.png 1272w, https://substackcdn.com/image/fetch/$s_!hQ9c!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ca362d4-063e-43c3-bf25-cae761d7a295_2515x1789.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hQ9c!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ca362d4-063e-43c3-bf25-cae761d7a295_2515x1789.png" width="1456" height="1036" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9ca362d4-063e-43c3-bf25-cae761d7a295_2515x1789.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1036,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:455067,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/183159965?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ca362d4-063e-43c3-bf25-cae761d7a295_2515x1789.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hQ9c!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ca362d4-063e-43c3-bf25-cae761d7a295_2515x1789.png 424w, https://substackcdn.com/image/fetch/$s_!hQ9c!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ca362d4-063e-43c3-bf25-cae761d7a295_2515x1789.png 848w, https://substackcdn.com/image/fetch/$s_!hQ9c!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ca362d4-063e-43c3-bf25-cae761d7a295_2515x1789.png 1272w, https://substackcdn.com/image/fetch/$s_!hQ9c!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ca362d4-063e-43c3-bf25-cae761d7a295_2515x1789.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>They don&#8217;t jump to the network. They start with <strong>boundaries</strong>.</p><p>Actions:</p><ul><li><p>Split code by domain, not layers</p></li><li><p>Introduce explicit interfaces</p></li><li><p>Remove shared global state</p></li><li><p>Make dependencies visible</p></li></ul><p>This reduces:</p><ul><li><p>Change risk</p></li><li><p>Accidental coupling</p></li><li><p>Debug time</p></li></ul><p>A modular monolith scales better than a distributed system built in panic.</p><h4>5. Move expensive work off the request path</h4><p>Peak traffic dies in synchronous work.</p><p>Common offenders:</p><ul><li><p>Email sending</p></li><li><p>Payment callbacks</p></li><li><p>Inventory recalculation</p></li><li><p>Analytics writes</p></li></ul><p>Fix:</p><ul><li><p>Convert sync &#8594; async</p></li><li><p>Push work to background workers</p></li><li><p>Return <code>202 Accepted</code> when possible</p></li></ul><p>Rule of thumb:</p><blockquote><p>If it doesn&#8217;t need to block the user, it shouldn&#8217;t block the request.</p></blockquote><p></p><h4>6. Apply targeted data fixes</h4><p>Most scalability problems show up in the database first.</p><p>I focus on real queries and real traffic patterns, not theoretical models. Missing indexes, unnecessary transactions, and overly strict isolation levels are common causes of peak&#8209;load failures.</p><p>I focus on <strong>real queries</strong>, not theory.</p><p>Typical wins:</p><ul><li><p>Add missing indexes</p></li><li><p>Remove unnecessary transactions</p></li><li><p>Lower isolation levels where safe</p></li><li><p>Precompute reports instead of running them live</p></li><li><p>Cache computed aggregates</p></li></ul><p>When caching is introduced or expanded at this stage, it must be done carefully.</p><p>Caching pitfalls matter:</p><p>Cache stampedes can take systems down faster than databases. I look for basic protections such as request coalescing or locking, jittered TTLs to avoid synchronized expirations, and clear rules around invalidation. I also make explicit decisions about where stale reads are acceptable and where they are dangerous, especially around pricing, inventory, and payments.</p><p>Caching should reduce pressure, not introduce a new failure mode.</p><p>No heroic schema redesigns. Only changes justified by metrics.</p><h3>Month 3: Reduce blast radius and create options</h3><p>At this point, the system should be stable under peak load. Month 3 is about turning that stability into confidence and making future failures smaller, slower, and easier to manage.</p><h4>7. Isolate the biggest offender (optional)</h4><p>If one domain dominates load and boundaries are clean:</p><ul><li><p>Extract <strong>one</strong> worker or service</p></li><li><p>Keep the contract small</p></li><li><p>Avoid creating new coupling</p></li></ul><p>This step is optional.</p><p>Many systems stabilize without any extraction at all.</p><h4>8. Load test peak, not average</h4><p>By now, I want clear answers:</p><ul><li><p>Can we handle 2&#215; peak?</p></li><li><p>What fails first?</p></li><li><p>Do failures degrade or cascade?</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8dHa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9234531-e534-474f-943e-3ad81929aa00_2316x1487.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8dHa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9234531-e534-474f-943e-3ad81929aa00_2316x1487.png 424w, https://substackcdn.com/image/fetch/$s_!8dHa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9234531-e534-474f-943e-3ad81929aa00_2316x1487.png 848w, https://substackcdn.com/image/fetch/$s_!8dHa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9234531-e534-474f-943e-3ad81929aa00_2316x1487.png 1272w, https://substackcdn.com/image/fetch/$s_!8dHa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9234531-e534-474f-943e-3ad81929aa00_2316x1487.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8dHa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9234531-e534-474f-943e-3ad81929aa00_2316x1487.png" width="1456" height="935" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c9234531-e534-474f-943e-3ad81929aa00_2316x1487.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:935,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:270230,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/183159965?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9234531-e534-474f-943e-3ad81929aa00_2316x1487.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8dHa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9234531-e534-474f-943e-3ad81929aa00_2316x1487.png 424w, https://substackcdn.com/image/fetch/$s_!8dHa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9234531-e534-474f-943e-3ad81929aa00_2316x1487.png 848w, https://substackcdn.com/image/fetch/$s_!8dHa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9234531-e534-474f-943e-3ad81929aa00_2316x1487.png 1272w, https://substackcdn.com/image/fetch/$s_!8dHa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9234531-e534-474f-943e-3ad81929aa00_2316x1487.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Good systems fail partially. Bad systems fall over completely.</p><h4>9. Document decisions and limits</h4><p>This is a senior&#8209;level signal.</p><p>I document:</p><ul><li><p>What we fixed</p></li><li><p>What we deliberately didn&#8217;t fix</p></li><li><p>Known limits</p></li><li><p>Next extraction candidates</p></li></ul><p>System design is not about pretending trade&#8209;offs don&#8217;t exist. It&#8217;s about making them explicit.</p><h3>Why this question works so well</h3><p>This question works because it exposes how engineers think when systems are already under stress.</p><p>Strong candidates naturally reason in constraints. They focus on the hot path first, not the entire system. They respect rollout risk and reversibility. And they understand that architecture, by itself, does not equal progress.</p><p>In short, it rewards judgment formed by real production experience, not familiarity with trendy patterns.</p><h3>My Final takeaway</h3><p>Scaling is not about rewriting systems.</p><p>It is about seeing the system clearly under pressure, choosing the smallest levers that create real impact, and reducing blast radius before adding complexity. Most importantly, it is about buying time so better decisions are possible later.</p><p>Good system design is not measured by how fast you can draw boxes.</p><p>It is measured by how long your system can survive peak traffic without falling apart.</p><p>If someone answers this question well, they can built systems that have had to survive peak traffic.</p><p>And that&#8217;s exactly what System Design interviews are trying to uncover.</p><p></p><p>Until next time,<br>&#8212; Raul</p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[Happy Teams Build Better Products]]></title><description><![CDATA[6 lessons every engineer eventually learns the hard way.]]></description><link>https://newsletter.systemdesignclassroom.com/p/happy-teams-build-better-products</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/happy-teams-build-better-products</guid><dc:creator><![CDATA[Raul Junco]]></dc:creator><pubDate>Fri, 12 Dec 2025 12:38:14 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!FaZ5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb810ed38-0a06-497a-bb4e-4af6cfa21f3e_2171x1764.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If you&#8217;ve ever worked in a startup, you know how fast things can fall apart behind the scenes.</p><p>A customer reports an issue.<br>Support files a vague ticket.<br>Engineering tries to reproduce it.<br>Frontend blames backend.<br>Backend blames frontend.<br>Slack threads explode.<br>Everyone&#8217;s busy, but somehow, nobody actually knows what&#8217;s going on.</p><p>I used to live inside this loop for years.</p><p>And here&#8217;s what hit me:</p><blockquote><p><strong>The problem wasn&#8217;t the customer. It wasn&#8217;t the product.<br>The real issues was the </strong><em><strong>team system itself</strong></em><strong>.</strong></p></blockquote><p>If a team doesn&#8217;t have clarity, context, or energy&#8230;then nothing works.<br>It doesn&#8217;t matter how strong your architecture is; <strong>tired people ship tired products.</strong></p><p>This realization forced me to rethink how teams actually build and debug software.<br>And it led me to six lessons I wish I&#8217;d learned sooner.</p><h3>1. Context is everything</h3><p>The root cause of most engineering pain is simple:<br><strong>No one knows what actually happened.</strong></p><p>Support writes:<br>&#8220;Checkout is slow.&#8221;</p><p>Engineering responds:<br>&#8220;Works for me.&#8221;</p><p>And both are right, because neither has the full story.</p><p>Once I started forcing myself (and my teams) to capture the full context <em>once</em> and make it travel with the issue, everything changed.</p><p>A good bug report includes:</p><ul><li><p>real repro steps</p></li><li><p>real environment</p></li><li><p>a timestamp</p></li><li><p>screenshots or (ideally) a replay</p></li><li><p>the trace or request ID</p></li></ul><p>This alone removed hours of back-and-forth from every incident.</p><p>And the surprising thing?<br>It also reduced tension between teams.<br><strong>Clarity is the best stress relief.</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!FaZ5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb810ed38-0a06-497a-bb4e-4af6cfa21f3e_2171x1764.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FaZ5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb810ed38-0a06-497a-bb4e-4af6cfa21f3e_2171x1764.png 424w, https://substackcdn.com/image/fetch/$s_!FaZ5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb810ed38-0a06-497a-bb4e-4af6cfa21f3e_2171x1764.png 848w, https://substackcdn.com/image/fetch/$s_!FaZ5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb810ed38-0a06-497a-bb4e-4af6cfa21f3e_2171x1764.png 1272w, https://substackcdn.com/image/fetch/$s_!FaZ5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb810ed38-0a06-497a-bb4e-4af6cfa21f3e_2171x1764.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!FaZ5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb810ed38-0a06-497a-bb4e-4af6cfa21f3e_2171x1764.png" width="1456" height="1183" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b810ed38-0a06-497a-bb4e-4af6cfa21f3e_2171x1764.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1183,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:713562,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/180328442?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb810ed38-0a06-497a-bb4e-4af6cfa21f3e_2171x1764.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FaZ5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb810ed38-0a06-497a-bb4e-4af6cfa21f3e_2171x1764.png 424w, https://substackcdn.com/image/fetch/$s_!FaZ5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb810ed38-0a06-497a-bb4e-4af6cfa21f3e_2171x1764.png 848w, https://substackcdn.com/image/fetch/$s_!FaZ5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb810ed38-0a06-497a-bb4e-4af6cfa21f3e_2171x1764.png 1272w, https://substackcdn.com/image/fetch/$s_!FaZ5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb810ed38-0a06-497a-bb4e-4af6cfa21f3e_2171x1764.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>2. Replays beat meetings</h3><p>Eventually, I realized how many meetings existed only because someone in the chain was missing context.</p><p>&#8220;Let&#8217;s jump on a call.&#8221;<br>Translation: &#8220;I don&#8217;t know what happened, please walk me through it slowly.&#8221;</p><p>A replay solved that in 10 seconds.</p><p>No storytelling.<br>No guessing.<br>No back-and-forth.</p><p>Just: <em>&#8220;Watch this. Let&#8217;s fix it.&#8221;</em></p><p>This single shift cut a ridiculous number of meetings.<br>And when you remove unnecessary meetings, you protect the thing teams need most: <strong>ENERGY</strong>.</p><div class="native-video-embed" data-component-name="VideoPlaceholder" data-attrs="{&quot;mediaUploadId&quot;:&quot;b173ef60-646a-448e-840d-838e3a4bd8b3&quot;,&quot;duration&quot;:null}"></div><h3>3. Too many tools destroy focus</h3><p>Another lesson: even if you have the right data, it&#8217;s hard to use when it lives in four different places.</p><p>That was my life for years:</p><p>Replay in one tab.<br>Logs in another.<br>Traces in a third.<br>Metrics somewhere else.</p><p>By the time I pieced everything together, my brain was fried.</p><p>The real problem was that the <em>debugging context</em> lived across too many places.</p><p>The fix was simple:<br>put all the technical signals in <strong>one place</strong> so everyone sees the same thing.</p><p>Not fewer tools.<br><strong>Just fewer places to hunt for the truth.</strong></p><p>One path from &#8220;user clicked something&#8221; &#8594; &#8220;database wrote something.&#8221;</p><p>When the team stops switching tools, they start solving problems.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!mNVz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b86595a-b99b-401f-9602-068504bdb499_3557x3076.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mNVz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b86595a-b99b-401f-9602-068504bdb499_3557x3076.png 424w, https://substackcdn.com/image/fetch/$s_!mNVz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b86595a-b99b-401f-9602-068504bdb499_3557x3076.png 848w, https://substackcdn.com/image/fetch/$s_!mNVz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b86595a-b99b-401f-9602-068504bdb499_3557x3076.png 1272w, https://substackcdn.com/image/fetch/$s_!mNVz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b86595a-b99b-401f-9602-068504bdb499_3557x3076.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!mNVz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b86595a-b99b-401f-9602-068504bdb499_3557x3076.png" width="1456" height="1259" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8b86595a-b99b-401f-9602-068504bdb499_3557x3076.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1259,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2440079,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/180328442?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b86595a-b99b-401f-9602-068504bdb499_3557x3076.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!mNVz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b86595a-b99b-401f-9602-068504bdb499_3557x3076.png 424w, https://substackcdn.com/image/fetch/$s_!mNVz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b86595a-b99b-401f-9602-068504bdb499_3557x3076.png 848w, https://substackcdn.com/image/fetch/$s_!mNVz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b86595a-b99b-401f-9602-068504bdb499_3557x3076.png 1272w, https://substackcdn.com/image/fetch/$s_!mNVz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b86595a-b99b-401f-9602-068504bdb499_3557x3076.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>4. Automate the boring parts (the steps after debugging)</h3><p>Once we know what broke, there&#8217;s a second phase: reproduce the bug reliably, run API calls, build integration tests, document edge cases, verify fixes. That&#8217;s where the manual cost really piles up.</p><p>That&#8217;s when a Notebook becomes handy, you can automate that second phase:</p><ul><li><p>Convert a session recording into a reproducible test or script.</p></li><li><p>Sequence API calls or backend interactions exactly as they occurred, with real data, payloads, headers, and timing. </p></li><li><p>Annotate, document, and version the flow so teammates, devs, QA, PMs, can see exactly what happened and how it was tested. </p></li></ul><p>Something like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3HUQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54a7fef8-ff66-456b-a8a6-c60a5b48eac5_3424x2751.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3HUQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54a7fef8-ff66-456b-a8a6-c60a5b48eac5_3424x2751.png 424w, https://substackcdn.com/image/fetch/$s_!3HUQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54a7fef8-ff66-456b-a8a6-c60a5b48eac5_3424x2751.png 848w, https://substackcdn.com/image/fetch/$s_!3HUQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54a7fef8-ff66-456b-a8a6-c60a5b48eac5_3424x2751.png 1272w, https://substackcdn.com/image/fetch/$s_!3HUQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54a7fef8-ff66-456b-a8a6-c60a5b48eac5_3424x2751.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3HUQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54a7fef8-ff66-456b-a8a6-c60a5b48eac5_3424x2751.png" width="1456" height="1170" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/54a7fef8-ff66-456b-a8a6-c60a5b48eac5_3424x2751.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1170,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:3045853,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/180328442?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54a7fef8-ff66-456b-a8a6-c60a5b48eac5_3424x2751.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3HUQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54a7fef8-ff66-456b-a8a6-c60a5b48eac5_3424x2751.png 424w, https://substackcdn.com/image/fetch/$s_!3HUQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54a7fef8-ff66-456b-a8a6-c60a5b48eac5_3424x2751.png 848w, https://substackcdn.com/image/fetch/$s_!3HUQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54a7fef8-ff66-456b-a8a6-c60a5b48eac5_3424x2751.png 1272w, https://substackcdn.com/image/fetch/$s_!3HUQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54a7fef8-ff66-456b-a8a6-c60a5b48eac5_3424x2751.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>So debugging stays where it belongs, in the replay.<br>But all the follow-up steps, test scripts, documentation, and regression checks become automatic, repeatable, and shareable.</p><p><strong>Simple result:</strong> way less repetition, way more time saved.</p><h3>5. Energy is a system constraint</h3><p>Startups obsess over uptime, latency, and error budgets.<br>But the thing that brings teams down isn&#8217;t CPU or RAM, it&#8217;s <strong>human bandwidth</strong>.</p><p>I saw it repeatedly: burned-out engineers write worse code, fix bugs slower, communicate poorly, and lose patience with customers.<br>None of that shows up on a dashboard, but you feel it everywhere in the system.</p><p>You can&#8217;t build great products with exhausted people.</p><p>Once I started treating team energy as an&nbsp;<em>actual</em>&nbsp;engineering constraint (not a &#8220;soft&#8221; idea), everything changed. Delivery became more predictable. PR quality went up. On-call incidents felt less chaotic. And the product itself noticeably improved.</p><p>One practical change made an outsized impact:</p><p><strong>We implemented flow blocks.</strong></p><p>Every engineer had protected windows where they could actually think:</p><ul><li><p>2-hour focused work blocks</p></li><li><p>no Slack</p></li><li><p>no meetings</p></li><li><p>no pings</p></li><li><p>no &#8220;quick questions&#8221;</p></li></ul><p>Protecting even one real flow block a day dramatically boosted output <strong>without increasing hours worked</strong>.<br>It gave people breathing room, restored cognitive bandwidth, and reduced the constant context switching that quietly drains teams.</p><blockquote><p>Happy teams don&#8217;t happen by accident, you have to design your workflow to protect their energy.</p></blockquote><p>And when you do, the quality of the product rises with it.</p><p></p><h3>6. Problems get solved faster together</h3><p>The last lesson was the most human: <strong>silos kill speed.</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!B578!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7fc59ebc-a1f0-41dd-abc3-8b4b8e56c3d1_1600x503.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!B578!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7fc59ebc-a1f0-41dd-abc3-8b4b8e56c3d1_1600x503.jpeg 424w, https://substackcdn.com/image/fetch/$s_!B578!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7fc59ebc-a1f0-41dd-abc3-8b4b8e56c3d1_1600x503.jpeg 848w, https://substackcdn.com/image/fetch/$s_!B578!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7fc59ebc-a1f0-41dd-abc3-8b4b8e56c3d1_1600x503.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!B578!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7fc59ebc-a1f0-41dd-abc3-8b4b8e56c3d1_1600x503.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!B578!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7fc59ebc-a1f0-41dd-abc3-8b4b8e56c3d1_1600x503.jpeg" width="1456" height="458" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7fc59ebc-a1f0-41dd-abc3-8b4b8e56c3d1_1600x503.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:458,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!B578!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7fc59ebc-a1f0-41dd-abc3-8b4b8e56c3d1_1600x503.jpeg 424w, https://substackcdn.com/image/fetch/$s_!B578!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7fc59ebc-a1f0-41dd-abc3-8b4b8e56c3d1_1600x503.jpeg 848w, https://substackcdn.com/image/fetch/$s_!B578!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7fc59ebc-a1f0-41dd-abc3-8b4b8e56c3d1_1600x503.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!B578!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7fc59ebc-a1f0-41dd-abc3-8b4b8e56c3d1_1600x503.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I watched this pattern over and over again, support sees one piece, frontend sees another, backend sees something completely different, and QA is working off a reproduction that doesn&#8217;t match what actually happened.<br>Everyone is smart.<br>Everyone is trying.<br>But everyone is solving a <strong>different</strong> version of the problem.</p><p>When teams don&#8217;t share context, they don&#8217;t share reality.</p><p>The turning point came when we made sure everyone,  support, QA, frontend, backend,  worked from the <em>same</em> source of truth.<br>Not notes.<br>Not Slack threads.<br>Not assumptions.</p><p>A single replay.<br>A single timeline.<br>A single root cause.</p><p>Once that happened, alignment was instant.<br>Speculation disappeared.<br>People stopped &#8220;defending their part of the system&#8221; and started solving the actual issue.</p><blockquote><p>Shared context creates shared ownership.<br>And shared ownership is the fastest path to a real fix.</p></blockquote><p>It sounds simple, but it&#8217;s the closest thing I&#8217;ve found to a productivity multiplier.</p><h3>One tool that enables all of this: Multiplayer</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hf_S!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2bd936e-1778-4e1b-bab8-3794074d49ed_3600x1890.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hf_S!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2bd936e-1778-4e1b-bab8-3794074d49ed_3600x1890.png 424w, https://substackcdn.com/image/fetch/$s_!hf_S!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2bd936e-1778-4e1b-bab8-3794074d49ed_3600x1890.png 848w, https://substackcdn.com/image/fetch/$s_!hf_S!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2bd936e-1778-4e1b-bab8-3794074d49ed_3600x1890.png 1272w, https://substackcdn.com/image/fetch/$s_!hf_S!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2bd936e-1778-4e1b-bab8-3794074d49ed_3600x1890.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hf_S!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2bd936e-1778-4e1b-bab8-3794074d49ed_3600x1890.png" width="1456" height="764" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c2bd936e-1778-4e1b-bab8-3794074d49ed_3600x1890.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:764,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1161365,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/180328442?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2bd936e-1778-4e1b-bab8-3794074d49ed_3600x1890.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hf_S!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2bd936e-1778-4e1b-bab8-3794074d49ed_3600x1890.png 424w, https://substackcdn.com/image/fetch/$s_!hf_S!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2bd936e-1778-4e1b-bab8-3794074d49ed_3600x1890.png 848w, https://substackcdn.com/image/fetch/$s_!hf_S!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2bd936e-1778-4e1b-bab8-3794074d49ed_3600x1890.png 1272w, https://substackcdn.com/image/fetch/$s_!hf_S!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2bd936e-1778-4e1b-bab8-3794074d49ed_3600x1890.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Multiplayer gives your team a single place where the full story of an issue is captured automatically.</p><p>It records user actions, frontend state, network calls, backend traces, logs, and request/response data, all stitched into <strong>one connected timeline</strong>:</p><p>No tool-hopping.<br>No reconstructing.<br>No missing context.</p><p>It supports quick on-demand captures, continuous recording for hard bugs, and an upcoming conditional mode for issues users never report.</p><p>It also gives your AI tools the context they need to generate <em>accurate</em> fixes, tests, and explanations, not guesses.</p><p>The result is simple:<br>less friction, less context switching, and fewer interruptions.</p><p>More clarity, more focus, and more calm.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://trymultiplayer.link/raul-junco&quot;,&quot;text&quot;:&quot;Try it here&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://trymultiplayer.link/raul-junco"><span>Try it here</span></a></p><h3>My Takeaways </h3><p>The longer I build software, the more obvious it becomes:<br><strong>you can&#8217;t brute-force your way to great products.</strong></p><p>You can push harder, add more meetings, and throw more people at a problem, but if the team doesn&#8217;t have clarity, focus, or energy, everything eventually slows down.</p><p>Most of the failures I&#8217;ve seen weren&#8217;t caused by a lack of talent.<br>They came from teams trying to build in an environment that worked against them:<br>too many tools, scattered context, constant interruptions, and workflows that drained more energy than the actual engineering work.</p><p>And that&#8217;s why the tools we choose matter.<br>Not because tools &#8220;fix culture,&#8221; but because they quietly shape the day-to-day reality of the team:</p><ul><li><p>whether debugging takes minutes or hours</p></li><li><p>whether context stays intact or gets lost in handoffs</p></li><li><p>whether people get real flow time or live inside Slack</p></li><li><p>whether collaboration feels natural or forced</p></li></ul><p>A good tool reduces friction.<br>A good workflow protects energy.<br>And when the environment supports the team instead of fighting them, everything gets easier; product quality, delivery speed, even customer outcomes.</p><p></p><blockquote><p><strong>Happy teams build better products.<br>And better products make happier customers.</strong></p></blockquote><p></p><p>You don&#8217;t get that by pushing harder.<br>You get it by designing the system, including your tools, to help the team do their best work.<br></p><p>Until next time,<br>&#8212; Raul</p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[Performance Doesn’t Start at SELECT; It Starts at CREATE.]]></title><description><![CDATA[Stop blaming your queries. Most database slowness comes from design mistakes made on day one.]]></description><link>https://newsletter.systemdesignclassroom.com/p/performance-doesnt-start-at-select</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/performance-doesnt-start-at-select</guid><dc:creator><![CDATA[Raul Junco]]></dc:creator><pubDate>Tue, 28 Oct 2025 11:34:44 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/bd6ce9be-8411-406d-81b1-4fc746262680_2877x3084.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Most engineers learn query optimization too late.</p><p>They spend days adding indexes, rewriting JOINs, and tuning queries&#8230;<br>only to realize the real problem isn&#8217;t the query;  it&#8217;s the schema.</p><p>Most of the time, slow queries are symptoms, not causes. <br>The disease starts with schema design.</p><p>The Problem is that you can rewrite a query a hundred times; but if the schema underneath is broken, you&#8217;re just polishing rust.</p><p>When a database is poorly designed, every new feature adds friction:</p><ul><li><p>Queries grow more complex.</p></li><li><p>Indexes pile up without real gain.</p></li><li><p>Data integrity becomes optional.</p></li><li><p>Performance quietly decays until it explodes, like a dead whale.</p></li></ul><p>By the time you notice, you&#8217;re dealing with migrations, downtime, and brittle code paths that no amount of indexing can save.</p><p>Most teams don&#8217;t realize this until it&#8217;s too late.<br>The first few releases run fine.<br>Then, traffic spikes, queries slow down, and the database becomes the bottleneck no one planned for.</p><p>It&#8217;s at that point you discover what good engineers already know:<br><strong>Performance is baked in at the schema level.</strong></p><p>Every decision you make during <code>CREATE</code> (data types, constraints, normalization, indexes) decides how well your system will scale later.</p><p>Here&#8217;s how to build it right.</p><div><hr></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://tbrd.co/data-course-pd" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DEBE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021b1489-8914-4e30-b8f0-7b73ad507781_720x361.jpeg 424w, https://substackcdn.com/image/fetch/$s_!DEBE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021b1489-8914-4e30-b8f0-7b73ad507781_720x361.jpeg 848w, https://substackcdn.com/image/fetch/$s_!DEBE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021b1489-8914-4e30-b8f0-7b73ad507781_720x361.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!DEBE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021b1489-8914-4e30-b8f0-7b73ad507781_720x361.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DEBE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021b1489-8914-4e30-b8f0-7b73ad507781_720x361.jpeg" width="720" height="361" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/021b1489-8914-4e30-b8f0-7b73ad507781_720x361.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:361,&quot;width&quot;:720,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:78212,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:&quot;https://tbrd.co/data-course-pd&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/176314312?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021b1489-8914-4e30-b8f0-7b73ad507781_720x361.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!DEBE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021b1489-8914-4e30-b8f0-7b73ad507781_720x361.jpeg 424w, https://substackcdn.com/image/fetch/$s_!DEBE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021b1489-8914-4e30-b8f0-7b73ad507781_720x361.jpeg 848w, https://substackcdn.com/image/fetch/$s_!DEBE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021b1489-8914-4e30-b8f0-7b73ad507781_720x361.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!DEBE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021b1489-8914-4e30-b8f0-7b73ad507781_720x361.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Real-time isn&#8217;t a buzzword, it&#8217;s the performance edge for companies like Vercel, Canva, and Framer. <a href="https://tbrd.co/home-pd">Tinybird</a> helps them transform massive streams of data into instant insights and real-time user experiences.</p><p>To share what we&#8217;ve learned over the last 5 years running Petabyte-sized clusters, we built a free course on real-time analytical data foundations designed for developers who want to master the basics and build faster, smarter data products.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://tbrd.co/data-course-pd&quot;,&quot;text&quot;:&quot;Join the course for free&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://tbrd.co/data-course-pd"><span>Join the course for free</span></a></p><div><hr></div><h3><strong>1. Normalize First, Then Denormalize with Evidence</strong></h3><p>Normalization isn&#8217;t just a database theory; it&#8217;s your first defense against chaos.</p><p>When you normalize, you enforce discipline:</p><ul><li><p>Every column has a single, clear purpose.</p></li><li><p>Relationships are explicit, not implied.</p></li><li><p>Updates happen in one place, not ten.</p></li></ul><p>That structure pays off when your system evolves.<br>New features don&#8217;t break old data. Schema changes stay localized.<br>You can scale without rewriting your business logic.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jrQd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0524a97-510c-43d7-a08c-75d4ad30ca09_1064x390.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jrQd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0524a97-510c-43d7-a08c-75d4ad30ca09_1064x390.png 424w, https://substackcdn.com/image/fetch/$s_!jrQd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0524a97-510c-43d7-a08c-75d4ad30ca09_1064x390.png 848w, https://substackcdn.com/image/fetch/$s_!jrQd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0524a97-510c-43d7-a08c-75d4ad30ca09_1064x390.png 1272w, https://substackcdn.com/image/fetch/$s_!jrQd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0524a97-510c-43d7-a08c-75d4ad30ca09_1064x390.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jrQd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0524a97-510c-43d7-a08c-75d4ad30ca09_1064x390.png" width="1064" height="390" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d0524a97-510c-43d7-a08c-75d4ad30ca09_1064x390.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:390,&quot;width&quot;:1064,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:52400,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/176314312?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0524a97-510c-43d7-a08c-75d4ad30ca09_1064x390.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jrQd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0524a97-510c-43d7-a08c-75d4ad30ca09_1064x390.png 424w, https://substackcdn.com/image/fetch/$s_!jrQd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0524a97-510c-43d7-a08c-75d4ad30ca09_1064x390.png 848w, https://substackcdn.com/image/fetch/$s_!jrQd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0524a97-510c-43d7-a08c-75d4ad30ca09_1064x390.png 1272w, https://substackcdn.com/image/fetch/$s_!jrQd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0524a97-510c-43d7-a08c-75d4ad30ca09_1064x390.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Start here. Get it right. Then <em>measure</em>.</p><p>If you later discover that query performance is suffering, that JOIN-heavy reports or analytical workloads are dragging, that&#8217;s when you earn the right to denormalize.</p><p>But denormalization should always be a <strong>measured trade-off</strong>, not a default decision.</p><blockquote><p>Every denormalization is a bet: you&#8217;re trading consistency for speed.<br>Make sure it&#8217;s a bet you can afford to lose.</p></blockquote><p>Denormalize when:</p><ul><li><p>You&#8217;ve identified repeated JOINs on high-traffic queries.</p></li><li><p>You&#8217;re operating on immutable data (like historical logs).</p></li><li><p>You&#8217;ve validated the benefit through metrics, not assumptions.</p></li></ul><p>Denormalize <strong>with evidence</strong>, not fear.</p><p>Most systems suffer not because of normalization, but because of shortcuts taken before the first slow query ever appeared.</p><h3><strong>2. Use the Right Data Types</strong></h3><p>Your choice of data types decides how efficiently the database stores, compares, and retrieves your data.<br>It&#8217;s not a trivial decision, it&#8217;s a design constraint with real cost.</p><p>Most performance issues trace back to oversized or mismatched types.<br>Developers reach for <code>VARCHAR(255)</code> out of habit, or store timestamps as strings because it &#8220;just works.&#8221;<br>Those shortcuts add up, in memory, CPU, and I/O, especially when your table holds millions of rows.</p><p>Here&#8217;s what to remember:</p><ul><li><p><strong>Use the smallest data type that fits.</strong><br>Smaller data types mean smaller indexes, faster scans, and less memory pressure.<br>For example, <code>SMALLINT</code> (2 bytes) can handle values up to 32 767; often enough for bounded IDs.</p></li><li><p><strong>Avoid generic types like </strong><code>TEXT</code><strong> and </strong><code>BLOB</code><strong> unless absolutely necessary.</strong><br>They live off-page in most engines, increasing read latency and memory churn.<br>If you must store large blobs or unstructured text, isolate them in a side table or a storage service optimized for that pattern.</p></li><li><p><strong>Match semantics to type.</strong><br>Don&#8217;t store dates as strings. Don&#8217;t store numbers in text. Don&#8217;t use floats for currency.<br>Every mismatch forces implicit casts and wastes CPU cycles.</p></li><li><p><strong>Prefer fixed-width types when possible.</strong><br>Fixed-width data (<code>INT</code>, <code>DATE</code>, <code>CHAR</code>) makes row access predictable and cache-friendly.<br>Variable-width types (<code>VARCHAR</code>, <code>TEXT</code>) require extra bookkeeping and page splits.</p></li><li><p><strong>Use JSON types with intention.</strong><br>JSON columns (<code>JSON</code> in MySQL, <code>JSONB</code> in Postgres) They are great for flexible metadata, feature flags, configuration, and sparse attributes.<br>But they come with trade-offs:</p><ul><li><p>They&#8217;re harder to validate at the database level.</p></li><li><p>They can&#8217;t always use traditional B-tree indexes.</p></li><li><p>They tempt teams to bypass schema design entirely.<br>Treat JSON as an <em>extension</em>, not an excuse. Store structure when you know it; store JSON when you don&#8217;t.<br>If you rely on JSON queries heavily, index specific keys with expression or GIN indexes.</p></li></ul></li></ul><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9nQ_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a6fc400-20e0-4a3a-a9e9-d6ee89ff9737_2199x526.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9nQ_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a6fc400-20e0-4a3a-a9e9-d6ee89ff9737_2199x526.png 424w, https://substackcdn.com/image/fetch/$s_!9nQ_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a6fc400-20e0-4a3a-a9e9-d6ee89ff9737_2199x526.png 848w, https://substackcdn.com/image/fetch/$s_!9nQ_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a6fc400-20e0-4a3a-a9e9-d6ee89ff9737_2199x526.png 1272w, https://substackcdn.com/image/fetch/$s_!9nQ_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a6fc400-20e0-4a3a-a9e9-d6ee89ff9737_2199x526.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9nQ_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a6fc400-20e0-4a3a-a9e9-d6ee89ff9737_2199x526.png" width="1456" height="348" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8a6fc400-20e0-4a3a-a9e9-d6ee89ff9737_2199x526.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:348,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:205582,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/176314312?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a6fc400-20e0-4a3a-a9e9-d6ee89ff9737_2199x526.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9nQ_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a6fc400-20e0-4a3a-a9e9-d6ee89ff9737_2199x526.png 424w, https://substackcdn.com/image/fetch/$s_!9nQ_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a6fc400-20e0-4a3a-a9e9-d6ee89ff9737_2199x526.png 848w, https://substackcdn.com/image/fetch/$s_!9nQ_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a6fc400-20e0-4a3a-a9e9-d6ee89ff9737_2199x526.png 1272w, https://substackcdn.com/image/fetch/$s_!9nQ_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a6fc400-20e0-4a3a-a9e9-d6ee89ff9737_2199x526.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Even though both versions &#8220;work,&#8221; the second tells the database exactly what to expect.<br>Databases are only as smart as the hints your schema provides.</p><blockquote><p>The more precise your data types, the less work your database (and your team) has to guess.</p></blockquote><p>Clean, intentional typing isn&#8217;t just about performance, it&#8217;s about truth in design.<br>A schema that reflects reality scales longer, breaks less, and reads like documentation.</p><h3><strong>3. Build Intentional Indexes</strong></h3><p>Indexes are like caffeine; they give your queries a quick boost, but too much of them will crash your writes.</p><p>They&#8217;re one of the most misunderstood performance tools in databases.<br>Engineers often add them reactively, every time a query slows down, until write operations start crawling.<br>The key is balance: <strong>index what&#8217;s read often, not what&#8217;s written often.</strong></p><p>This simple hierarchy helps you reason about how indexes differ in purpose and structure:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!h16X!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F992f3f4d-3afb-4f2a-91d4-ecdbfa7de9bb_991x596.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!h16X!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F992f3f4d-3afb-4f2a-91d4-ecdbfa7de9bb_991x596.png 424w, https://substackcdn.com/image/fetch/$s_!h16X!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F992f3f4d-3afb-4f2a-91d4-ecdbfa7de9bb_991x596.png 848w, https://substackcdn.com/image/fetch/$s_!h16X!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F992f3f4d-3afb-4f2a-91d4-ecdbfa7de9bb_991x596.png 1272w, https://substackcdn.com/image/fetch/$s_!h16X!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F992f3f4d-3afb-4f2a-91d4-ecdbfa7de9bb_991x596.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!h16X!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F992f3f4d-3afb-4f2a-91d4-ecdbfa7de9bb_991x596.png" width="991" height="596" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/992f3f4d-3afb-4f2a-91d4-ecdbfa7de9bb_991x596.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:596,&quot;width&quot;:991,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:62763,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/176314312?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F992f3f4d-3afb-4f2a-91d4-ecdbfa7de9bb_991x596.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!h16X!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F992f3f4d-3afb-4f2a-91d4-ecdbfa7de9bb_991x596.png 424w, https://substackcdn.com/image/fetch/$s_!h16X!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F992f3f4d-3afb-4f2a-91d4-ecdbfa7de9bb_991x596.png 848w, https://substackcdn.com/image/fetch/$s_!h16X!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F992f3f4d-3afb-4f2a-91d4-ecdbfa7de9bb_991x596.png 1272w, https://substackcdn.com/image/fetch/$s_!h16X!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F992f3f4d-3afb-4f2a-91d4-ecdbfa7de9bb_991x596.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>Primary vs. Secondary:</strong><br>Primary indexes are built on the primary key, ensuring logical ordering of data.<br>Secondary indexes exist for non-primary-key lookups (like email or status).</p></li><li><p><strong>Clustering:</strong><br>Determines whether data is stored physically in the same order as the index.<br>(e.g., In MySQL&#8217;s InnoDB, the primary key <em>is</em> the clustered index.)</p></li><li><p><strong>Dense vs. Sparse:</strong></p><ul><li><p><strong>Dense indexes</strong> store an entry for every search key value.</p></li><li><p><strong>Sparse indexes</strong> store entries for blocks of data, reducing storage but slightly increasing lookup time.</p></li></ul></li></ul><p>Here&#8217;s how to design them with intent:</p><ul><li><p><strong>Index columns that filter, join, or sort.</strong><br>Indexes shine when they reduce search space.<br>If a column appears frequently in <code>WHERE</code>, <code>JOIN</code>, or <code>ORDER BY</code> clauses, it&#8217;s a good candidate.</p></li><li><p><strong>Avoid indexing volatile columns.</strong><br>Every index must be updated on every write.<br>Indexing frequently changing columns (like <code>status</code>, <code>last_updated</code>, or <code>login_count</code>) can double your write cost.</p></li></ul><p><strong>Composite indexes matter.</strong><br>When queries filter on multiple columns together, a composite index performs better than separate ones.<br>But order matters; always align the index order with your query&#8217;s filter order.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kaFg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb060da5-2398-474d-ba86-705d6b2b106b_3414x1465.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kaFg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb060da5-2398-474d-ba86-705d6b2b106b_3414x1465.png 424w, https://substackcdn.com/image/fetch/$s_!kaFg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb060da5-2398-474d-ba86-705d6b2b106b_3414x1465.png 848w, https://substackcdn.com/image/fetch/$s_!kaFg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb060da5-2398-474d-ba86-705d6b2b106b_3414x1465.png 1272w, https://substackcdn.com/image/fetch/$s_!kaFg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb060da5-2398-474d-ba86-705d6b2b106b_3414x1465.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kaFg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb060da5-2398-474d-ba86-705d6b2b106b_3414x1465.png" width="1456" height="625" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/eb060da5-2398-474d-ba86-705d6b2b106b_3414x1465.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:625,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:709452,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/176314312?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb060da5-2398-474d-ba86-705d6b2b106b_3414x1465.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kaFg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb060da5-2398-474d-ba86-705d6b2b106b_3414x1465.png 424w, https://substackcdn.com/image/fetch/$s_!kaFg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb060da5-2398-474d-ba86-705d6b2b106b_3414x1465.png 848w, https://substackcdn.com/image/fetch/$s_!kaFg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb060da5-2398-474d-ba86-705d6b2b106b_3414x1465.png 1272w, https://substackcdn.com/image/fetch/$s_!kaFg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb060da5-2398-474d-ba86-705d6b2b106b_3414x1465.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>Understand the &#8220;Leftmost Prefix&#8221; rule.</strong><br>A composite index only helps when the query filters on the <strong>leftmost columns</strong> of the index definition.<br>If you skip the first column, the index can&#8217;t be fully used.</p></li><li><p><strong>Use covering indexes for hot paths.</strong><br>A <strong>covering index</strong> contains all columns required by a query, allowing the database to serve it directly from the index without touching the base table.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xUbE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8481a68a-0581-46d1-96d7-d8e2a4ea60f1_2246x1474.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xUbE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8481a68a-0581-46d1-96d7-d8e2a4ea60f1_2246x1474.png 424w, https://substackcdn.com/image/fetch/$s_!xUbE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8481a68a-0581-46d1-96d7-d8e2a4ea60f1_2246x1474.png 848w, https://substackcdn.com/image/fetch/$s_!xUbE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8481a68a-0581-46d1-96d7-d8e2a4ea60f1_2246x1474.png 1272w, https://substackcdn.com/image/fetch/$s_!xUbE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8481a68a-0581-46d1-96d7-d8e2a4ea60f1_2246x1474.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xUbE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8481a68a-0581-46d1-96d7-d8e2a4ea60f1_2246x1474.png" width="1456" height="956" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8481a68a-0581-46d1-96d7-d8e2a4ea60f1_2246x1474.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:956,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:518478,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/176314312?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8481a68a-0581-46d1-96d7-d8e2a4ea60f1_2246x1474.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xUbE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8481a68a-0581-46d1-96d7-d8e2a4ea60f1_2246x1474.png 424w, https://substackcdn.com/image/fetch/$s_!xUbE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8481a68a-0581-46d1-96d7-d8e2a4ea60f1_2246x1474.png 848w, https://substackcdn.com/image/fetch/$s_!xUbE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8481a68a-0581-46d1-96d7-d8e2a4ea60f1_2246x1474.png 1272w, https://substackcdn.com/image/fetch/$s_!xUbE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8481a68a-0581-46d1-96d7-d8e2a4ea60f1_2246x1474.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>Watch out for index bloat.</strong><br>Indexes take space, slow writes, and can grow faster than the data itself.<br>Periodically audit and drop unused indexes.<br>Tools like <code>pg_stat_user_indexes</code> (Postgres) or <code>sys.dm_db_index_usage_stats</code> (SQL Server) can show you which ones actually get used.</p></li><li><p><strong>Use specialized indexes when needed.</strong></p><ul><li><p><strong>GIN/GiST indexes</strong> for JSON, arrays, and full-text search (Postgres).</p></li><li><p><strong>HASH indexes</strong> for equality lookups on simple keys.</p></li><li><p><strong>BRIN indexes</strong> for large, sequential data (e.g., logs or time-series).</p></li></ul><p>The right index type can outperform dozens of generic ones.</p></li></ul><blockquote><p>A good index strategy is like caching: the wrong one helps no one, the right one changes everything.</p></blockquote><p>Indexes are not about adding speed; they&#8217;re about <strong>removing unnecessary work.</strong><br>Each index is a contract; a trade-off between faster reads and slower writes.<br>Treat them as investments, not defaults.</p><h3><strong>4. Enforce Integrity with Constraints</strong></h3><p>Most performance problems aren&#8217;t caused by the database doing too much; they&#8217;re caused by it trusting you too much.</p><p>When you skip constraints, you shift data validation from the database to the application layer.</p><p>The result?<br>Redundant checks, unpredictable data, and queries that have to work harder to clean up your mess.</p><p>Constraints are the foundation of both <strong>performance and correctness</strong>; because a database that <em>knows the rules</em> can optimize around them.</p><p>Here&#8217;s how each one helps:</p><ul><li><p><code>PRIMARY KEY</code><strong> &#8594; guarantees identity and access speed.</strong><br>It enforces uniqueness and creates a clustered index (in most engines), which improves range scans and lookup consistency.</p></li><li><p><code>FOREIGN KEY</code><strong> &#8594; ensures relationships and prevents orphans.</strong><br>When properly indexed, foreign keys actually <em>improve</em> join performance by guaranteeing referential integrity; the optimizer doesn&#8217;t have to plan for missing matches.</p></li><li><p><code>NOT NULL</code><strong> &#8594; simplifies query plans.</strong><br>When a column is guaranteed to be non-null, the optimizer can skip conditional branches and null checks, producing faster execution plans.</p></li><li><p><code>UNIQUE</code><strong> &#8594; enforces business rules at scale.</strong><br>It prevents duplicates early and ensures consistency without expensive application-side lookups or retries.</p></li><li><p><code>CHECK</code><strong> &#8594; enforces domain rules early.</strong><br>These simple guards (e.g., <code>CHECK (age &gt;= 0)</code>) stop invalid data from ever being written, reducing downstream complexity and debugging time.</p></li></ul><blockquote><p>Constraints aren&#8217;t about restriction. They&#8217;re about <em>communication</em>; telling the database what&#8217;s impossible so it can stop checking for it.</p></blockquote><p>Proper constraints lead to:</p><ul><li><p>Smaller, cleaner indexes</p></li><li><p>Faster joins (less null logic and filtering)</p></li><li><p>Fewer defensive checks in code</p></li><li><p>Safer migrations and refactors</p></li></ul><p>The only valid reason to skip a constraint is when the database physically can&#8217;t enforce it (e.g., external dependencies, event streams).<br>Otherwise, you&#8217;re just outsourcing correctness to a place with fewer guarantees and more bugs.</p><h3><strong>5. Partition What Grows Fast</strong></h3><p>Even a perfect schema will choke under scale if everything lives in one table.<br>Indexes get bloated, queries slow down, and maintenance becomes painful.</p><p>Partitioning is how you <strong>keep growth predictable</strong>.<br>It doesn&#8217;t make your database magically faster; it makes it <em>stay fast</em> as data volume explodes.</p><p>There are two main flavors:</p><h4><strong>Horizontal Partitioning (Sharding):</strong></h4><p>Split a large table into smaller ones that share the same schema but hold different rows.<br>For example, you might partition orders by region, tenant, or date range.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ZSEj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd241831d-80ef-4601-b3d1-9ea85960b148_1438x1182.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZSEj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd241831d-80ef-4601-b3d1-9ea85960b148_1438x1182.png 424w, https://substackcdn.com/image/fetch/$s_!ZSEj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd241831d-80ef-4601-b3d1-9ea85960b148_1438x1182.png 848w, https://substackcdn.com/image/fetch/$s_!ZSEj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd241831d-80ef-4601-b3d1-9ea85960b148_1438x1182.png 1272w, https://substackcdn.com/image/fetch/$s_!ZSEj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd241831d-80ef-4601-b3d1-9ea85960b148_1438x1182.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZSEj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd241831d-80ef-4601-b3d1-9ea85960b148_1438x1182.png" width="1438" height="1182" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d241831d-80ef-4601-b3d1-9ea85960b148_1438x1182.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1182,&quot;width&quot;:1438,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:263551,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/176314312?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd241831d-80ef-4601-b3d1-9ea85960b148_1438x1182.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZSEj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd241831d-80ef-4601-b3d1-9ea85960b148_1438x1182.png 424w, https://substackcdn.com/image/fetch/$s_!ZSEj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd241831d-80ef-4601-b3d1-9ea85960b148_1438x1182.png 848w, https://substackcdn.com/image/fetch/$s_!ZSEj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd241831d-80ef-4601-b3d1-9ea85960b148_1438x1182.png 1272w, https://substackcdn.com/image/fetch/$s_!ZSEj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd241831d-80ef-4601-b3d1-9ea85960b148_1438x1182.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This keeps each partition small and manageable, so queries only scan what&#8217;s relevant.<br>In systems like Postgres, native table partitioning can automatically route inserts to the right partition and prune irrelevant ones during queries.</p><p>Time-based partitioning is especially common. It keeps operational queries fast and archival data isolated.</p><h4><strong>Vertical Partitioning:</strong></h4><p>Split columns across tables to separate &#8220;hot&#8221; from &#8220;cold&#8221; data.<br>Frequently accessed columns stay in the main table; large or rarely used columns move to a secondary table.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GFXZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F882729d0-909b-460e-ba87-68be3357af9b_1797x1948.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GFXZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F882729d0-909b-460e-ba87-68be3357af9b_1797x1948.png 424w, https://substackcdn.com/image/fetch/$s_!GFXZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F882729d0-909b-460e-ba87-68be3357af9b_1797x1948.png 848w, https://substackcdn.com/image/fetch/$s_!GFXZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F882729d0-909b-460e-ba87-68be3357af9b_1797x1948.png 1272w, https://substackcdn.com/image/fetch/$s_!GFXZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F882729d0-909b-460e-ba87-68be3357af9b_1797x1948.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GFXZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F882729d0-909b-460e-ba87-68be3357af9b_1797x1948.png" width="1456" height="1578" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/882729d0-909b-460e-ba87-68be3357af9b_1797x1948.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1578,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:353063,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/176314312?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F882729d0-909b-460e-ba87-68be3357af9b_1797x1948.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GFXZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F882729d0-909b-460e-ba87-68be3357af9b_1797x1948.png 424w, https://substackcdn.com/image/fetch/$s_!GFXZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F882729d0-909b-460e-ba87-68be3357af9b_1797x1948.png 848w, https://substackcdn.com/image/fetch/$s_!GFXZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F882729d0-909b-460e-ba87-68be3357af9b_1797x1948.png 1272w, https://substackcdn.com/image/fetch/$s_!GFXZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F882729d0-909b-460e-ba87-68be3357af9b_1797x1948.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This keeps your main table lean, smaller I/O, faster scans, and cheaper caching.</p><h4><strong>When to Partition</strong></h4><p>Partitioning adds complexity, so don&#8217;t reach for it too early.<br>Use it when:</p><ul><li><p>Your tables cross <strong>tens or hundreds of millions</strong> of rows.</p></li><li><p>Maintenance operations (vacuuming, backups, deletes) start impacting uptime.</p></li><li><p>You need <strong>data lifecycle management</strong>; archiving, pruning, or region-based compliance (e.g., GDPR).</p></li><li><p>Query performance drops even with proper indexing.</p></li></ul><h4><strong>How It Improves Performance</strong></h4><ul><li><p><strong>Query Pruning:</strong> Only relevant partitions are scanned.</p></li><li><p><strong>Faster Maintenance:</strong> You can rebuild or drop partitions independently.</p></li><li><p><strong>Improved Caching:</strong> Smaller working sets fit better in memory.</p></li><li><p><strong>Parallelism:</strong> Queries can run across partitions concurrently.</p></li></ul><blockquote><p>Partitioning doesn&#8217;t make queries faster &#8212; it keeps them from getting slower as data grows.</p></blockquote><h4><strong>The Trade-offs</strong></h4><p>Partitioning comes with operational cost:</p><ul><li><p>More tables to manage and monitor.</p></li><li><p>Cross-partition queries can be slower if not designed carefully.</p></li><li><p>Secondary indexes must be rebuilt for each partition.</p></li><li><p>Application logic or ORM support can complicate inserts and reads.</p></li></ul><p>When done right, though, it buys you years of runway before you need to consider database sharding or distributed systems.<br>Partitioning is scalability&#8217;s quiet superpower; invisible when it works, painful when it&#8217;s missing.</p><h3><strong>After Almost 20 Years Designing and Re-Designing Databases</strong></h3><p>What I&#8217;ve learned is simple: databases never forget your early mistakes.<br>A careless column type, a missing constraint, or an unnecessary denormalization will come back, just when your system is at its busiest.</p><p>Good schema design doesn&#8217;t just make things faster; it makes them <em>last</em>.</p><p>The teams that win long-term are the ones who treat table design with the same respect they give code.</p><h4>Some Realistic Considerations</h4><ul><li><p><strong>Over-normalization</strong> can hurt read performance. Let query patterns guide final design.</p></li><li><p><strong>Indexes</strong> require maintenance. Rebuild periodically to prevent bloat.</p></li><li><p><strong>Constraints</strong> add minor write overhead, a small price for guaranteed correctness.</p></li><li><p><strong>Partitioning</strong> adds complexity. Keep boundaries simple and visible.</p></li></ul><p>I&#8217;ve seen teams spend weeks chasing query plans when a single redesign could&#8217;ve fixed the issue forever.</p><p><br>If you take one thing away, let it be this:</p><blockquote><p><strong>Performance isn&#8217;t something you tune; it&#8217;s something you design.</strong></p></blockquote><p></p><p>Until next time,<br>&#8212; Raul</p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[CDC Isn’t the Shortcut You Think It Is]]></title><description><![CDATA[7 hidden costs of &#8220;free&#8221; event publishing]]></description><link>https://newsletter.systemdesignclassroom.com/p/cdc-isnt-the-shortcut-you-think-it-is</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/cdc-isnt-the-shortcut-you-think-it-is</guid><dc:creator><![CDATA[Raul Junco]]></dc:creator><pubDate>Tue, 07 Oct 2025 11:52:11 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!HjiF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbf0f423-6c0b-4f1e-b748-8332f7d58d61_1288x1052.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Change Data Capture (CDC) feels like a cheat code.</p><p>I remember the first time I tried it, we had a legacy service, and the idea of streaming database changes without touching the code felt like magic.</p><p>And while it works, there are trade-offs you should know before jumping in.</p><p>Here are 7 lessons I&#8217;ve learned the hard way:</p><div><hr></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!qENV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90853543-3a6c-41ab-a501-200278ba7609_1280x834.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qENV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90853543-3a6c-41ab-a501-200278ba7609_1280x834.png 424w, https://substackcdn.com/image/fetch/$s_!qENV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90853543-3a6c-41ab-a501-200278ba7609_1280x834.png 848w, https://substackcdn.com/image/fetch/$s_!qENV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90853543-3a6c-41ab-a501-200278ba7609_1280x834.png 1272w, https://substackcdn.com/image/fetch/$s_!qENV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90853543-3a6c-41ab-a501-200278ba7609_1280x834.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qENV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90853543-3a6c-41ab-a501-200278ba7609_1280x834.png" width="1280" height="834" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/90853543-3a6c-41ab-a501-200278ba7609_1280x834.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:834,&quot;width&quot;:1280,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:36496,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/174960920?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90853543-3a6c-41ab-a501-200278ba7609_1280x834.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!qENV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90853543-3a6c-41ab-a501-200278ba7609_1280x834.png 424w, https://substackcdn.com/image/fetch/$s_!qENV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90853543-3a6c-41ab-a501-200278ba7609_1280x834.png 848w, https://substackcdn.com/image/fetch/$s_!qENV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90853543-3a6c-41ab-a501-200278ba7609_1280x834.png 1272w, https://substackcdn.com/image/fetch/$s_!qENV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90853543-3a6c-41ab-a501-200278ba7609_1280x834.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>IcePanel&#8217;s a collaborative diagramming and modelling tool for designing software architecture. Create interactive and layered views for different stakeholders, based on a single source of truth.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://icepanel.io/?utm_source=substack&amp;utm_campaign=rj&quot;,&quot;text&quot;:&quot;Try it for free&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://icepanel.io/?utm_source=substack&amp;utm_campaign=rj"><span>Try it for free</span></a></p><div><hr></div><h3>1. Event Granularity: Business Fact vs. Domain Model</h3><p>CDC streams are tied to tables, not to business events.</p><p>Imagine a customer places an order:</p><ul><li><p><code>orders</code> table gets a new row.</p></li><li><p><code>order_items</code> table inserts multiple rows.</p></li><li><p><code>payments</code> table updates with a pending transaction.</p></li></ul><p>CDC faithfully emits <strong>three different low-level events</strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!e137!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff27c4f30-4835-40b2-91a2-71e0b6668af5_1493x1226.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!e137!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff27c4f30-4835-40b2-91a2-71e0b6668af5_1493x1226.png 424w, https://substackcdn.com/image/fetch/$s_!e137!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff27c4f30-4835-40b2-91a2-71e0b6668af5_1493x1226.png 848w, https://substackcdn.com/image/fetch/$s_!e137!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff27c4f30-4835-40b2-91a2-71e0b6668af5_1493x1226.png 1272w, https://substackcdn.com/image/fetch/$s_!e137!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff27c4f30-4835-40b2-91a2-71e0b6668af5_1493x1226.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!e137!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff27c4f30-4835-40b2-91a2-71e0b6668af5_1493x1226.png" width="1456" height="1196" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f27c4f30-4835-40b2-91a2-71e0b6668af5_1493x1226.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1196,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:117778,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/174960920?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff27c4f30-4835-40b2-91a2-71e0b6668af5_1493x1226.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!e137!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff27c4f30-4835-40b2-91a2-71e0b6668af5_1493x1226.png 424w, https://substackcdn.com/image/fetch/$s_!e137!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff27c4f30-4835-40b2-91a2-71e0b6668af5_1493x1226.png 848w, https://substackcdn.com/image/fetch/$s_!e137!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff27c4f30-4835-40b2-91a2-71e0b6668af5_1493x1226.png 1272w, https://substackcdn.com/image/fetch/$s_!e137!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff27c4f30-4835-40b2-91a2-71e0b6668af5_1493x1226.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Diagram created in IcePanel</figcaption></figure></div><p>But what consumers actually wanted was a single, meaningful business event:</p><pre><code><code>{
  &#8220;event&#8221;: &#8220;OrderPlaced&#8221;,
  &#8220;orderId&#8221;: &#8220;123&#8221;,
  &#8220;total&#8221;: 89.50,
  &#8220;items&#8221;: [ ... ]
}
</code></code></pre><p>Instead, they get a stream of row changes and have to <strong>reconstruct the business fact themselves</strong>. This adds complexity, invites inconsistent interpretations, and turns your supposedly decoupled consumers into fragile data archaeologists.</p><h3>2. Database Schema Coupling</h3><p>Your schema becomes your contract.</p><ul><li><p>Merge two tables? Consumers, depending on the old streams, break.</p></li><li><p>Split one table into many? You may need to create new streams, forcing everyone to update.</p></li></ul><p>A schema change that should be local to a team now requires <strong>cross-team coordination</strong>. The more consumers you have, the harder this becomes.</p><p>The result: your producer service loses autonomy. Every schema tweak becomes a release-management nightmare.</p><h3>3. Sensitive Data Exposure</h3><p>CDC publishes the full row by default. That often includes fields like:</p><ul><li><p>Credit card numbers</p></li><li><p>Social Security numbers</p></li><li><p>Internal audit fields</p></li></ul><p>Now every downstream consumer sees them.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tSJJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd2ebd59-daef-4273-bc60-5a2c8abd63ea_2374x1672.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tSJJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd2ebd59-daef-4273-bc60-5a2c8abd63ea_2374x1672.png 424w, https://substackcdn.com/image/fetch/$s_!tSJJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd2ebd59-daef-4273-bc60-5a2c8abd63ea_2374x1672.png 848w, https://substackcdn.com/image/fetch/$s_!tSJJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd2ebd59-daef-4273-bc60-5a2c8abd63ea_2374x1672.png 1272w, https://substackcdn.com/image/fetch/$s_!tSJJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd2ebd59-daef-4273-bc60-5a2c8abd63ea_2374x1672.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tSJJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd2ebd59-daef-4273-bc60-5a2c8abd63ea_2374x1672.png" width="1456" height="1025" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cd2ebd59-daef-4273-bc60-5a2c8abd63ea_2374x1672.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1025,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:289040,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/174960920?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd2ebd59-daef-4273-bc60-5a2c8abd63ea_2374x1672.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tSJJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd2ebd59-daef-4273-bc60-5a2c8abd63ea_2374x1672.png 424w, https://substackcdn.com/image/fetch/$s_!tSJJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd2ebd59-daef-4273-bc60-5a2c8abd63ea_2374x1672.png 848w, https://substackcdn.com/image/fetch/$s_!tSJJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd2ebd59-daef-4273-bc60-5a2c8abd63ea_2374x1672.png 1272w, https://substackcdn.com/image/fetch/$s_!tSJJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd2ebd59-daef-4273-bc60-5a2c8abd63ea_2374x1672.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Diagram created in IcePanel</figcaption></figure></div><p>You can filter or encrypt, but that creates a new problem: <strong>some consumers need that data, some don&#8217;t.</strong> Which means custom filtering logic, duplicated pipelines, or complicated access policies.</p><p>Instead of protecting sensitive fields at the source, CDC spreads the risk system-wide.</p><h3>4. Handling Relational Data</h3><p>Most real-world domains aren&#8217;t flat. They have relationships.</p><ul><li><p>Orders belong to Customers.</p></li><li><p>Orders contain Items.</p></li><li><p>Items reference Products.</p></li></ul><p>CDC splits these into different streams (<code>orders</code>, <code>customers</code>, <code>products</code>). Consumers now have to:</p><ul><li><p>Subscribe to multiple streams.</p></li><li><p>Perform joins.</p></li><li><p>Reconstruct context before doing anything useful.</p></li></ul><p>Each consumer ends up reimplementing <strong>business logic</strong> that should have stayed in the producer service. This increases bugs, documentation debt, and wasted effort.</p><h3>5. Configuration Complexity</h3><p>CDC isn&#8217;t &#8220;flip a switch and done.&#8221;</p><p>You have to configure:</p><ul><li><p>Which tables to capture.</p></li><li><p>How to serialize events.</p></li><li><p>What schema format to use.</p></li><li><p>How to handle deletes and updates.</p></li></ul><p>Misconfigure one setting, and you risk <strong>malformed events or silent data loss</strong>. Consumers will keep processing, unaware they&#8217;re working with incomplete or corrupted data.</p><h3>6. Database Migration Challenges</h3><p>Switch databases, say, from MySQL to PostgreSQL, and you&#8217;ll quickly discover that CDC tools don&#8217;t guarantee consistent event formats.</p><p>Column types differ. Timestamps look different. Even the order of fields can change.</p><p>That means every consumer must adapt. A migration that should be a producer concern suddenly becomes an <strong>organization-wide coordination project</strong>.</p><h3>7. Operational Overhead</h3><p>The CDC processor (Debezium, GoldenGate, etc.) isn&#8217;t free. It&#8217;s another <strong>critical moving part</strong> in your system.</p><ul><li><p>If it crashes, your event stream stalls.</p></li><li><p>If it lags, consumers drift behind real time.</p></li><li><p>If it silently drops changes, producers and consumers fall out of sync.</p></li></ul><p>And then comes the biggest question: <strong>who owns it?</strong></p><ul><li><p>The producer service team?</p></li><li><p>The DevOps/SRE group?</p></li><li><p>A shared data engineering team?</p></li></ul><p>Without clear ownership and robust observability, CDC can become your weakest link.</p><h3>The Hidden Complexity of CDC</h3><p>On paper, CDC decouples producers from event publishing.<br>In practice, it couples consumers to the producer&#8217;s database design.</p><ul><li><p>Consumers deal with row-level noise, not meaningful business events.</p></li><li><p>Schema changes ripple across every service.</p></li><li><p>Sensitive data spreads far too easily.</p></li><li><p>Operations become fragile and political.</p></li></ul><p>What started as a shortcut to avoid writing event code ends up creating <strong>a web of dependencies that slows everyone down</strong>.</p><h3>An Alternative Path: Transactional Outbox?</h3><p>CDC has its place, but for most event-driven architectures, a <strong>Transactional Outbox</strong> is safer.</p><p>Instead of exposing table changes, the producer writes <strong>business events</strong> into an outbox table as part of its transaction. A relay process then publishes them to the event bus.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4h7j!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe707b598-42b4-4504-9b26-2c3993db87aa_1752x1768.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4h7j!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe707b598-42b4-4504-9b26-2c3993db87aa_1752x1768.png 424w, https://substackcdn.com/image/fetch/$s_!4h7j!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe707b598-42b4-4504-9b26-2c3993db87aa_1752x1768.png 848w, https://substackcdn.com/image/fetch/$s_!4h7j!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe707b598-42b4-4504-9b26-2c3993db87aa_1752x1768.png 1272w, https://substackcdn.com/image/fetch/$s_!4h7j!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe707b598-42b4-4504-9b26-2c3993db87aa_1752x1768.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4h7j!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe707b598-42b4-4504-9b26-2c3993db87aa_1752x1768.png" width="1456" height="1469" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e707b598-42b4-4504-9b26-2c3993db87aa_1752x1768.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1469,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:199835,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/174960920?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe707b598-42b4-4504-9b26-2c3993db87aa_1752x1768.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4h7j!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe707b598-42b4-4504-9b26-2c3993db87aa_1752x1768.png 424w, https://substackcdn.com/image/fetch/$s_!4h7j!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe707b598-42b4-4504-9b26-2c3993db87aa_1752x1768.png 848w, https://substackcdn.com/image/fetch/$s_!4h7j!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe707b598-42b4-4504-9b26-2c3993db87aa_1752x1768.png 1272w, https://substackcdn.com/image/fetch/$s_!4h7j!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe707b598-42b4-4504-9b26-2c3993db87aa_1752x1768.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Diagram created in IcePanel</figcaption></figure></div><p>The result:</p><ul><li><p>Events are high-level facts (<code>OrderPlaced</code>), not schema leaks.</p></li><li><p>Schema changes stay internal.</p></li><li><p>Producers own their contracts.</p></li><li><p>Consumers stay shielded.</p><p></p></li></ul><h3>Takeaways</h3><ul><li><p>CDC feels &#8220;free,&#8221; but it&#8217;s expensive for consumers.</p></li><li><p>It leaks domain internals, exposes sensitive data, and ties everyone to your schema.</p></li><li><p>It creates operational risks with an extra moving part in your pipeline.</p></li><li><p>For autonomy and clarity, favor <strong>business events</strong> via a Transactional Outbox.</p></li><li><p>That said, CDC is still one of my favorite tech for Legacy integration and analytics. </p></li></ul><p></p><blockquote><p><strong>Every row change is data. Every business fact is an event. Know the difference.</strong></p></blockquote><p></p><p>Until next time,<br>&#8212; Raul</p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[What Uber’s Slackbot Taught Me About Building Smart AI Assistants]]></title><description><![CDATA[Forget dashboards. The fastest path to insight is an agent that speaks your data&#8217;s language.]]></description><link>https://newsletter.systemdesignclassroom.com/p/what-ubers-slackbot-taught-me-about-smart-ai-assistants</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/what-ubers-slackbot-taught-me-about-smart-ai-assistants</guid><pubDate>Tue, 30 Sep 2025 11:45:58 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!qL3y!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f839101-a81c-4540-a0e9-7f40ecc30e69_3147x3424.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Most finance teams don&#8217;t lack data.</p><p>They lack <em>fast, trusted access</em> to the right data.</p><p>And no, BI dashboards aren&#8217;t the fix.<br>They still rely on manual digging, tool switching, or someone from data engineering.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!V4If!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4bfad736-2036-468c-9048-88dc53c4563f_3112x2088.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!V4If!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4bfad736-2036-468c-9048-88dc53c4563f_3112x2088.png 424w, https://substackcdn.com/image/fetch/$s_!V4If!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4bfad736-2036-468c-9048-88dc53c4563f_3112x2088.png 848w, https://substackcdn.com/image/fetch/$s_!V4If!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4bfad736-2036-468c-9048-88dc53c4563f_3112x2088.png 1272w, https://substackcdn.com/image/fetch/$s_!V4If!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4bfad736-2036-468c-9048-88dc53c4563f_3112x2088.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!V4If!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4bfad736-2036-468c-9048-88dc53c4563f_3112x2088.png" width="1456" height="977" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4bfad736-2036-468c-9048-88dc53c4563f_3112x2088.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:977,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:4867626,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/173745032?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4bfad736-2036-468c-9048-88dc53c4563f_3112x2088.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!V4If!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4bfad736-2036-468c-9048-88dc53c4563f_3112x2088.png 424w, https://substackcdn.com/image/fetch/$s_!V4If!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4bfad736-2036-468c-9048-88dc53c4563f_3112x2088.png 848w, https://substackcdn.com/image/fetch/$s_!V4If!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4bfad736-2036-468c-9048-88dc53c4563f_3112x2088.png 1272w, https://substackcdn.com/image/fetch/$s_!V4If!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4bfad736-2036-468c-9048-88dc53c4563f_3112x2088.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Uber</strong>&#8217;s answer?<br>They built an AI agent that speaks the finance team&#8217;s language, literally.</p><div><hr></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!x8JT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!x8JT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 424w, https://substackcdn.com/image/fetch/$s_!x8JT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 848w, https://substackcdn.com/image/fetch/$s_!x8JT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 1272w, https://substackcdn.com/image/fetch/$s_!x8JT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!x8JT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png" width="1456" height="879" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:879,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!x8JT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 424w, https://substackcdn.com/image/fetch/$s_!x8JT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 848w, https://substackcdn.com/image/fetch/$s_!x8JT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 1272w, https://substackcdn.com/image/fetch/$s_!x8JT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>As developers increasingly turn to CLI coding agents like Claude Code for rapid development, a critical gap emerges: <strong>who reviews the AI-generated code?</strong> </p><p>CodeRabbit CLI fills this void by delivering senior-level code reviews directly in your terminal, creating a seamless workflow where code generation flows directly into automated validation. Review uncommitted changes, catch AI hallucinations, and get one-click fixes - all without leaving your command line. </p><p>It's the quality gate that makes autonomous coding truly possible, ensuring every line of AI-generated code meets production standards before it ships.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://coderabbit.link/jG7lcRZ&quot;,&quot;text&quot;:&quot;Install CodeRabbit CLI&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://coderabbit.link/jG7lcRZ"><span>Install CodeRabbit CLI</span></a></p><div><hr></div><p>Here&#8217;s the typical flow inside a medium/large company:</p><ul><li><p>Data lives in multiple sources (Presto, Oracle EPM, Excel, Google Sheets&#8230;)</p></li><li><p>Naming conventions vary wildly (e.g. &#8220;US&amp;C&#8221;, &#8220;GB&#8221;, &#8220;Q4 FY23&#8221;)</p></li><li><p>The Analysts either:</p><ul><li><p>Know SQL (and spend their time writing/debugging queries)</p></li><li><p>Or submit requests to data teams and wait 3 days (if you are lucky)</p></li></ul></li></ul><p>It&#8217;s slow, frustrating, and error-prone.</p><p>And when data access becomes the bottleneck, everything downstream suffers.</p><ul><li><p>Decisions are delayed.</p></li><li><p>Errors creep in from manual lookups.</p></li><li><p>Analysts burn time fetching numbers instead of interpreting them.</p></li><li><p>BI tools become static graveyards.</p></li></ul><p>This is not just inefficiency; it&#8217;s an opportunity lost. And Uber knew it couldn&#8217;t afford that.</p><h3>Uber&#8217;s Answer: Finch</h3><p>Instead of adding more dashboards, Uber built <strong>Finch</strong>, an AI agent inside Slack.</p><p>You ask in plain English:<br>&#8220;What was GB value in US&amp;C in Q4 2024?&#8221;</p><p>Finch understands finance lingo (&#8220;GB&#8221; = Gross Bookings, &#8220;US&amp;C&#8221; = region). It identifies the right data source, generates SQL, runs it, and returns the result in Slack. Large datasets export directly to Sheets.</p><p>No dashboards. No context switching. No waiting in line.</p><h3>General Architecture</h3><p>Finch isn&#8217;t a chatbot with shortcuts. It&#8217;s a system of specialized agents, data layers, and safeguards.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!qL3y!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f839101-a81c-4540-a0e9-7f40ecc30e69_3147x3424.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qL3y!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f839101-a81c-4540-a0e9-7f40ecc30e69_3147x3424.png 424w, https://substackcdn.com/image/fetch/$s_!qL3y!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f839101-a81c-4540-a0e9-7f40ecc30e69_3147x3424.png 848w, https://substackcdn.com/image/fetch/$s_!qL3y!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f839101-a81c-4540-a0e9-7f40ecc30e69_3147x3424.png 1272w, https://substackcdn.com/image/fetch/$s_!qL3y!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f839101-a81c-4540-a0e9-7f40ecc30e69_3147x3424.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qL3y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f839101-a81c-4540-a0e9-7f40ecc30e69_3147x3424.png" width="1456" height="1584" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6f839101-a81c-4540-a0e9-7f40ecc30e69_3147x3424.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1584,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1180289,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/173745032?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f839101-a81c-4540-a0e9-7f40ecc30e69_3147x3424.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!qL3y!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f839101-a81c-4540-a0e9-7f40ecc30e69_3147x3424.png 424w, https://substackcdn.com/image/fetch/$s_!qL3y!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f839101-a81c-4540-a0e9-7f40ecc30e69_3147x3424.png 848w, https://substackcdn.com/image/fetch/$s_!qL3y!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f839101-a81c-4540-a0e9-7f40ecc30e69_3147x3424.png 1272w, https://substackcdn.com/image/fetch/$s_!qL3y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f839101-a81c-4540-a0e9-7f40ecc30e69_3147x3424.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p>A <strong>semantic layer</strong> maps user-friendly terms to schema fields.</p></li><li><p><strong>Curated marts</strong> provide optimized, reliable datasets.</p></li><li><p><strong>RBAC checks</strong> enforce strict access control.</p></li><li><p>A <strong>multi-agent system</strong> separates intent detection, SQL generation, and validation.</p></li><li><p>Results appear where users already work: Slack or Sheets.</p></li></ul><h3>How the Finch Data Agent Flow Works</h3><p>It&#8217;s one thing to say &#8220;an AI agent runs queries for you.&#8221;<br>It&#8217;s another to see how the moving parts actually work together.</p><p>Finch isn&#8217;t a black box; it&#8217;s a coordinated system of agents, metadata lookups, and real-time feedback. </p><p>Every query travels through a well-defined pipeline: from Slack input &#8594; to intent detection &#8594; to SQL generation &#8594; to validated results delivered back to the analyst.</p><p>Understanding Finch&#8217;s power is easier when you see the flow.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!O8LM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60923868-37c0-4187-b480-847f74590917_814x976.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!O8LM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60923868-37c0-4187-b480-847f74590917_814x976.png 424w, https://substackcdn.com/image/fetch/$s_!O8LM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60923868-37c0-4187-b480-847f74590917_814x976.png 848w, https://substackcdn.com/image/fetch/$s_!O8LM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60923868-37c0-4187-b480-847f74590917_814x976.png 1272w, https://substackcdn.com/image/fetch/$s_!O8LM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60923868-37c0-4187-b480-847f74590917_814x976.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!O8LM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60923868-37c0-4187-b480-847f74590917_814x976.png" width="814" height="976" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/60923868-37c0-4187-b480-847f74590917_814x976.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:976,&quot;width&quot;:814,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:169375,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/173745032?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60923868-37c0-4187-b480-847f74590917_814x976.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!O8LM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60923868-37c0-4187-b480-847f74590917_814x976.png 424w, https://substackcdn.com/image/fetch/$s_!O8LM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60923868-37c0-4187-b480-847f74590917_814x976.png 848w, https://substackcdn.com/image/fetch/$s_!O8LM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60923868-37c0-4187-b480-847f74590917_814x976.png 1272w, https://substackcdn.com/image/fetch/$s_!O8LM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60923868-37c0-4187-b480-847f74590917_814x976.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ol><li><p><strong>User query input</strong><br>A finance analyst asks a question in Slack, e.g.<br><em>&#8220;What was GBs in US&amp;C last quarter?&#8221;</em></p></li><li><p><strong>Agent orchestration</strong><br>The <strong>Supervisor Agent</strong> receives the query and decides which specialized sub-agent should handle it (e.g., SQL Writer Agent).</p></li><li><p><strong>Metadata retrieval</strong><br>The sub-agent queries an <strong>OpenSearch index</strong> to fetch relevant metadata:</p><ul><li><p>Synonyms and aliases for table/column names</p></li><li><p>Valid values for filters (e.g. &#8220;US&amp;C&#8221; &#8594; <code>region_name</code>)</p></li></ul><p>This mapping step is critical: it lets Finch bridge messy human shorthand with rigid schemas.</p></li><li><p><strong>SQL query construction and execution</strong><br>The <strong>SQL Writer Agent</strong> uses the retrieved metadata to dynamically build a precise SQL query and execute it against the right data mart.</p></li><li><p><strong>Guardrails</strong><br>Validates security permissions before executing the query.</p></li><li><p><strong>Result delivery</strong><br>The final result is returned directly in Slack, complete with:</p><ul><li><p>Natural language explanation of the SQL mapping</p></li><li><p>Generated SQL (with comments)</p></li><li><p>A Google Sheets link with full results</p></li></ul></li></ol><h3>The Trade-Offs</h3><p>Of course, an AI agent isn&#8217;t magic. Uber had to navigate real risks:</p><ul><li><p>Schema drift: keeping metadata aligned as tables change.</p></li><li><p>Trust: analysts wanting to see how answers were computed.</p></li><li><p>Backend load: too many heavy queries hammering systems.</p></li><li><p>Hallucinations: models inventing columns that don&#8217;t exist.</p></li></ul><p>The mitigations included caching common queries, regression testing generated SQL, exporting large results outside Slack, and adding human oversight for executive-level data.</p><p>The design isn&#8217;t just about speed. It&#8217;s about trust, security, and usability.</p><p></p><h3>Takeaways: How to Build Your Own Finch</h3><p>If you want to build something like this for your org:</p><ul><li><p><strong>Start with one team</strong> and a few high-leverage metrics (finance is a great use case)</p></li><li><p>Build a <strong>semantic metadata layer</strong> (OpenSearch, Postgres, whatever) to store aliases</p></li><li><p>Use <strong>curated marts</strong> to simplify routing and avoid complex joins</p></li><li><p>Separate responsibilities across <strong>multiple agents</strong> (intent &#8594; SQL &#8594; validation)</p></li><li><p>Focus on <strong>observability</strong>: log every query, allow feedback, measure success</p></li><li><p>Don&#8217;t ship without <strong>RBAC and audit logging</strong>; data privacy is non-negotiable</p></li></ul><p></p><h3>Final Thought</h3><p>Most dashboards are slow, static snapshots.<br>They were built for looking, not doing.</p><p>Finch points to the better path:</p><p>Ask the question.<br>Get the truth.<br>Make the move.</p><p>If analysts are still stuck writing SQL or digging through dashboards, it&#8217;s wasted potential. I think dashboards had their moment, but they&#8217;ve become a bottleneck. </p><p>The future isn&#8217;t more dashboards. It&#8217;s agents that deliver answers when you need them.</p><blockquote><p><strong>&#8220;Dashboards show you data. Agents move you forward.&#8221;</strong></p></blockquote><p></p><p>Until next time,<br>&#8212; Raul</p><div><hr></div><p><strong>Reference</strong></p><p>https://www.uber.com/blog/unlocking-financial-insights-with-finch/</p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[Most Engineers Want Both Consistency and Scalability.]]></title><description><![CDATA[Reality Doesn't Work That Way.]]></description><link>https://newsletter.systemdesignclassroom.com/p/most-engineers-want-both-consistency-and-scalability</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/most-engineers-want-both-consistency-and-scalability</guid><pubDate>Thu, 25 Sep 2025 11:43:41 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/c9c1b207-de7b-4e6d-b313-c752e084c2ea_1200x1200.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If you&#8217;ve ever tried to process payments across multiple services or coordinate seat reservations during a flash sale, you know the pain:</p><ul><li><p>Some users double-book.</p></li><li><p>Others get stuck in &#8220;processing&#8221; forever.</p></li><li><p>And your pager lights up at 2 AM.</p></li></ul><p>That&#8217;s the cost of ignoring distributed transaction design.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!w5LG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e08b9ce-69d4-4370-b60a-9f49b9438d78_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!w5LG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e08b9ce-69d4-4370-b60a-9f49b9438d78_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!w5LG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e08b9ce-69d4-4370-b60a-9f49b9438d78_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!w5LG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e08b9ce-69d4-4370-b60a-9f49b9438d78_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!w5LG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e08b9ce-69d4-4370-b60a-9f49b9438d78_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!w5LG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e08b9ce-69d4-4370-b60a-9f49b9438d78_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7e08b9ce-69d4-4370-b60a-9f49b9438d78_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Generated image&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Generated image" title="Generated image" srcset="https://substackcdn.com/image/fetch/$s_!w5LG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e08b9ce-69d4-4370-b60a-9f49b9438d78_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!w5LG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e08b9ce-69d4-4370-b60a-9f49b9438d78_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!w5LG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e08b9ce-69d4-4370-b60a-9f49b9438d78_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!w5LG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e08b9ce-69d4-4370-b60a-9f49b9438d78_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>You get choices. You don&#8217;t get them all. </p><p>Let&#8217;s talk about the Three Big Guns in distributed transactions: </p><ol><li><p>Two-Phase Commit (2PC) </p></li><li><p>Saga with Orchestrator </p></li><li><p>Saga with Choreography </p></li></ol><p>Each solves the same problem: keeping distributed workflows safe.<br>Each comes with brutal trade-offs.</p><div><hr></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!x8JT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!x8JT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 424w, https://substackcdn.com/image/fetch/$s_!x8JT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 848w, https://substackcdn.com/image/fetch/$s_!x8JT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 1272w, https://substackcdn.com/image/fetch/$s_!x8JT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!x8JT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png" width="1456" height="879" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:879,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!x8JT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 424w, https://substackcdn.com/image/fetch/$s_!x8JT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 848w, https://substackcdn.com/image/fetch/$s_!x8JT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 1272w, https://substackcdn.com/image/fetch/$s_!x8JT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>As developers increasingly turn to CLI coding agents like Claude Code for rapid development, a critical gap emerges: <strong>who reviews the AI-generated code?</strong> </p><p>CodeRabbit CLI fills this void by delivering senior-level code reviews directly in your terminal, creating a seamless workflow where code generation flows directly into automated validation. Review uncommitted changes, catch AI hallucinations, and get one-click fixes - all without leaving your command line. </p><p>It&#8217;s the quality gate that makes autonomous coding truly possible, ensuring every line of AI-generated code meets production standards before it ships.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://coderabbit.link/jG7lcRZ&quot;,&quot;text&quot;:&quot;Install CodeRabbit CLI&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://coderabbit.link/jG7lcRZ"><span>Install CodeRabbit CLI</span></a></p><div><hr></div><h3>Two-Phase Commit (2PC): The Illusion of Atomicity</h3><p>2PC coordinates a distributed transaction by introducing a &#8220;transaction Manager/Coordinator.&#8221; Each participant (database, service, or resource) is asked to <em>prepare</em> first. If all of them vote yes, the manager sends a final <em>commit</em> message. If any vote no, everyone rolls back.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PQ0b!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2186f57f-843d-4131-a91e-1e72bd767d42_1912x4023.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PQ0b!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2186f57f-843d-4131-a91e-1e72bd767d42_1912x4023.png 424w, https://substackcdn.com/image/fetch/$s_!PQ0b!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2186f57f-843d-4131-a91e-1e72bd767d42_1912x4023.png 848w, https://substackcdn.com/image/fetch/$s_!PQ0b!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2186f57f-843d-4131-a91e-1e72bd767d42_1912x4023.png 1272w, https://substackcdn.com/image/fetch/$s_!PQ0b!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2186f57f-843d-4131-a91e-1e72bd767d42_1912x4023.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PQ0b!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2186f57f-843d-4131-a91e-1e72bd767d42_1912x4023.png" width="1456" height="3064" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2186f57f-843d-4131-a91e-1e72bd767d42_1912x4023.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:3064,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:626966,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/173745669?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2186f57f-843d-4131-a91e-1e72bd767d42_1912x4023.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!PQ0b!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2186f57f-843d-4131-a91e-1e72bd767d42_1912x4023.png 424w, https://substackcdn.com/image/fetch/$s_!PQ0b!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2186f57f-843d-4131-a91e-1e72bd767d42_1912x4023.png 848w, https://substackcdn.com/image/fetch/$s_!PQ0b!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2186f57f-843d-4131-a91e-1e72bd767d42_1912x4023.png 1272w, https://substackcdn.com/image/fetch/$s_!PQ0b!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2186f57f-843d-4131-a91e-1e72bd767d42_1912x4023.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>What it delivers:</strong></p><ul><li><p>Strong consistency: either all commit, or none do.</p></li><li><p>Simplicity in mental model; behaves like a local ACID transaction.</p></li></ul><p><strong>The cost:</strong></p><ul><li><p>Adding more participants degrades performance. Every resource is locked until the final decision.</p></li><li><p>Global locks block unrelated work. A single slow participant stalls the entire transaction.</p></li><li><p>Coordinator failures leave transactions &#8220;in doubt,&#8221; requiring manual intervention or complex recovery logic.</p></li><li><p>If the Coordinator crashes after prepare, but before broadcasting the decision,  the entire algorithm is blocked until the Coordinator recovers.</p></li></ul><p>It&#8217;s like asking every wedding guest to raise their glass for a toast at the exact same moment. The picture looks perfect, until one late uncle delays everyone.</p><p><strong>When to use:</strong><br>Small, short-lived transactions where correctness outweighs throughput, such as seat reservations or atomic money transfers.</p><p><strong>When not to use:</strong><br>Anything requiring scale across services or regions. Throughput will collapse.</p><p></p><h3>Saga with Orchestrator: Control Through Compensation</h3><p>An orchestrator does things differently. Instead of enforcing atomicity with locks, a Saga breaks a workflow into independent steps. A central orchestrator issues commands in order: &#8220;reserve inventory,&#8221; &#8220;charge payment,&#8221; &#8220;create shipment.&#8221; Each step has a compensating action (undo payment, restock inventory) if something fails.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jKXx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdff57693-5185-42dd-a144-1cc912ea3e03_1100x803.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jKXx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdff57693-5185-42dd-a144-1cc912ea3e03_1100x803.png 424w, https://substackcdn.com/image/fetch/$s_!jKXx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdff57693-5185-42dd-a144-1cc912ea3e03_1100x803.png 848w, https://substackcdn.com/image/fetch/$s_!jKXx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdff57693-5185-42dd-a144-1cc912ea3e03_1100x803.png 1272w, https://substackcdn.com/image/fetch/$s_!jKXx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdff57693-5185-42dd-a144-1cc912ea3e03_1100x803.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jKXx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdff57693-5185-42dd-a144-1cc912ea3e03_1100x803.png" width="1100" height="803" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dff57693-5185-42dd-a144-1cc912ea3e03_1100x803.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:803,&quot;width&quot;:1100,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!jKXx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdff57693-5185-42dd-a144-1cc912ea3e03_1100x803.png 424w, https://substackcdn.com/image/fetch/$s_!jKXx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdff57693-5185-42dd-a144-1cc912ea3e03_1100x803.png 848w, https://substackcdn.com/image/fetch/$s_!jKXx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdff57693-5185-42dd-a144-1cc912ea3e03_1100x803.png 1272w, https://substackcdn.com/image/fetch/$s_!jKXx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdff57693-5185-42dd-a144-1cc912ea3e03_1100x803.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>What it delivers:</strong></p><ul><li><p>Business-level atomicity. Failures unwind with compensations rather than strict rollbacks.</p></li><li><p>Visibility: the orchestrator provides a timeline, retry logic, and consolidated monitoring.</p></li><li><p>Reliability under flaky conditions: compensating actions make the system resilient to partial failures.</p></li></ul><p><strong>The cost:</strong></p><ul><li><p>The orchestrator itself becomes a target for scaling and reliability.</p></li><li><p>Every service must implement both &#8220;do&#8221; and &#8220;undo,&#8221; doubling the contract surface area and the testing burden.</p></li><li><p>State persistence, retry policies, and orchestration logic are non-trivial engineering work.</p></li></ul><p><br>Think of a travel agent. They book your flight, hotel, and car in sequence. If the hotel fails, they cancel the car and refund the flight. The customer never sees the failure; they just get a consistent experience.</p><p><br>It is perfect for complex, multi-step workflows that map to real-world business processes, like e-commerce orders or financial transactions.</p><p></p><h3>Saga with Choreography: Autonomy at Scale</h3><p>Choreography removes the central brain. Services publish events, and other services react. For example:</p><ul><li><p>Order Service publishes &#8220;Order Created.&#8221;</p></li><li><p>Payment Service reacts and emits &#8220;Payment Completed.&#8221;</p></li><li><p>Shipping Service reacts and schedules delivery.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!krPT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b763d04-608d-404b-ac98-c14e8e141b48_986x745.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!krPT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b763d04-608d-404b-ac98-c14e8e141b48_986x745.png 424w, https://substackcdn.com/image/fetch/$s_!krPT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b763d04-608d-404b-ac98-c14e8e141b48_986x745.png 848w, https://substackcdn.com/image/fetch/$s_!krPT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b763d04-608d-404b-ac98-c14e8e141b48_986x745.png 1272w, https://substackcdn.com/image/fetch/$s_!krPT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b763d04-608d-404b-ac98-c14e8e141b48_986x745.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!krPT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b763d04-608d-404b-ac98-c14e8e141b48_986x745.png" width="986" height="745" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3b763d04-608d-404b-ac98-c14e8e141b48_986x745.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:745,&quot;width&quot;:986,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:139542,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/173745669?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b763d04-608d-404b-ac98-c14e8e141b48_986x745.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!krPT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b763d04-608d-404b-ac98-c14e8e141b48_986x745.png 424w, https://substackcdn.com/image/fetch/$s_!krPT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b763d04-608d-404b-ac98-c14e8e141b48_986x745.png 848w, https://substackcdn.com/image/fetch/$s_!krPT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b763d04-608d-404b-ac98-c14e8e141b48_986x745.png 1272w, https://substackcdn.com/image/fetch/$s_!krPT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b763d04-608d-404b-ac98-c14e8e141b48_986x745.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p></li></ul><p>The workflow emerges from the event flow rather than a central authority.</p><p><strong>What it delivers:</strong></p><ul><li><p>Loose coupling. Teams own services independently and deploy without coordination.</p></li><li><p>Horizontal scalability. Adding new participants is as simple as subscribing to the event stream.</p></li><li><p>High autonomy. Systems evolve faster because no single orchestrator dictates flow.</p></li></ul><p><strong>The cost:</strong></p><ul><li><p>Eventual consistency. Data may take time to settle, and systems must be able to tolerate temporary divergence.</p></li><li><p>Debugging becomes difficult. Tracking who triggered what and when requires strong observability.</p></li><li><p>Each service manages its own compensations; it must know how to undo its own work.</p></li><li><p>Adding more services increases the risks of event storms, feedback loops, and hidden dependencies.</p></li></ul><p>It works really well for autonomy. Large-scale systems with autonomous teams, where independence and scale are more important than immediate consistency.</p><p></p><h3>Practical Considerations Beyond the Patterns</h3><h4>Event Storms and Hidden Dependencies</h4><p>Choreography scales by removing the central brain, but the price is unpredictability. Poorly designed event chains can create storms: one service reacts, triggers another, which triggers the first again. </p><p>The loop grows until queues overflow. This isn&#8217;t theory; it happens when services emit broad events like <em>Order Updated</em> without clear contracts. </p><p><strong>The fix:</strong> design events narrowly, enforce idempotency, and monitor for abnormal event volume.</p><h4>Observability and Debugging</h4><p>Distributed workflows are only as reliable as your ability to see them. Without end-to-end tracing, you must guess which service failed and when. Use correlation IDs in every event. Centralize logs for compensations and retries. </p><p>Add distributed tracing to visualize entire sagas across services. And don&#8217;t stop there, automated anomaly detection can catch unusual retry patterns before they become outages.</p><h4>Choosing the Right Pattern</h4><p>No single approach wins everywhere.<br>2PC fits short, critical operations where correctness beats throughput.<br>Orchestrator sagas shine when workflows need predictable undo steps.<br>Choreography works when autonomy and scale outweigh strict consistency.</p><p>Most real systems mix patterns. Payments might use strong consistency, while downstream shipping notifications settle eventually. </p><p>Map requirements, data criticality, latency tolerance, traffic volume, to the pattern that fits.</p><h4>Failure Recovery in Practice</h4><p>Every system fails. Recovery is the differentiator.</p><p>2PC needs recovery logs and leader election to survive Coordinator crashes.</p><p>Sagas need thoroughly tested compensations and idempotent steps so retries don&#8217;t double-charge or restock twice.</p><p>Transactional outbox and idempotency keys are battle-tested tools that make retries safe and events reliable.</p><h4>Where the Industry is Heading</h4><p>Modern systems rarely stop at 2PC or Sagas. Patterns like CQRS, event sourcing, and the transactional outbox are becoming standard ways to balance consistency with scalability. </p><p>They don&#8217;t eliminate the trade-offs; you still pay, but they shift the costs to places you can manage more easily. </p><p>If your system is stretching, these are the next patterns to explore.</p><p></p><h3>The Trade-offs You Cannot Escape</h3><p>Each pattern buys you one benefit by forcing you to accept a cost.</p><p><strong>Two-Phase Commit gives you the strongest consistency</strong> guarantees: either all participants commit, or none do. That makes it the safest option when correctness is non-negotiable. </p><p>But the cost is scalability. Global locks stall unrelated work, a single slow participant blocks the group, and cross-region use is nearly impossible. You trade throughput and resilience for atomic truth.</p><p><strong>The Orchestrator Saga provides centralized control.</strong> The workflow is visible, compensations are predictable, and the system mirrors real business logic, refunds, cancellations, and restocks. </p><p>The downside is complexity. You must build and operate the orchestrator itself, and every service must support both forward and undo actions. The price of control is additional engineering overhead.</p><p><strong>Choreography pushes autonomy and scale.</strong> Services react to events, teams ship independently, and you can add new capabilities without central coordination. </p><p>But you inherit the mess of distributed compensations and debugging event chains. Consistency becomes eventual, not immediate. The gain is speed and independence; the trade-off is clarity.</p><p><strong>In short:</strong></p><ul><li><p><strong>2PC</strong> &#8594; Strong guarantees, but poor scalability.</p></li><li><p><strong>Orchestrator Saga</strong> &#8594; Predictable rollbacks, but central complexity.</p></li><li><p><strong>Choreography Saga</strong> &#8594; Scalable autonomy, but messy debugging.</p></li></ul><p>The real question is which cost you&#8217;re willing to pay: latency, complexity, or chaos.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!fN4-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ad43eb3-5457-4dba-9a65-b59589b1ee34_767x242.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fN4-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ad43eb3-5457-4dba-9a65-b59589b1ee34_767x242.png 424w, https://substackcdn.com/image/fetch/$s_!fN4-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ad43eb3-5457-4dba-9a65-b59589b1ee34_767x242.png 848w, https://substackcdn.com/image/fetch/$s_!fN4-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ad43eb3-5457-4dba-9a65-b59589b1ee34_767x242.png 1272w, https://substackcdn.com/image/fetch/$s_!fN4-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ad43eb3-5457-4dba-9a65-b59589b1ee34_767x242.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!fN4-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ad43eb3-5457-4dba-9a65-b59589b1ee34_767x242.png" width="767" height="242" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0ad43eb3-5457-4dba-9a65-b59589b1ee34_767x242.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:242,&quot;width&quot;:767,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:49940,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/173745669?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ad43eb3-5457-4dba-9a65-b59589b1ee34_767x242.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!fN4-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ad43eb3-5457-4dba-9a65-b59589b1ee34_767x242.png 424w, https://substackcdn.com/image/fetch/$s_!fN4-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ad43eb3-5457-4dba-9a65-b59589b1ee34_767x242.png 848w, https://substackcdn.com/image/fetch/$s_!fN4-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ad43eb3-5457-4dba-9a65-b59589b1ee34_767x242.png 1272w, https://substackcdn.com/image/fetch/$s_!fN4-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ad43eb3-5457-4dba-9a65-b59589b1ee34_767x242.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><blockquote><p>Outages don&#8217;t come from picking the wrong pattern. They come from pretending trade-offs don&#8217;t exist</p></blockquote><p></p><p>Until next time,<br>&#8212; Raul</p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[To Cache or Not to Cache]]></title><description><![CDATA[A 7-question framework for making caching a design decision, not a default.]]></description><link>https://newsletter.systemdesignclassroom.com/p/to-cache-or-not-to-cache</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/to-cache-or-not-to-cache</guid><dc:creator><![CDATA[Raul Junco]]></dc:creator><pubDate>Tue, 16 Sep 2025 15:02:09 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!D3QO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a0c7313-061b-4d1a-a6c0-7be4fff4afcd_3421x5796.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Most caching bugs don't come from Redis or Memcached.</p><p>They come from bad judgment, caching the wrong thing, caching too soon, or caching without a clear reason.</p><p>You added Redis. Slapped a <code>.get()</code> around a slow query. Threw in a <code>.set()</code> after it. The app got faster.</p><p>So you did it again. And again. Until cache wrapped everything.</p><p>Now you've got problems no profiler will catch:</p><ul><li><p>Users see outdated prices</p></li><li><p>Debugging is a coin toss. Was that from the DB or cache?</p></li><li><p>Your memory footprint tripled, and eviction is eating the wrong keys</p></li><li><p>No one knows which keys still matter, or if they ever did</p></li></ul><p>This is what happens when caching becomes a reflex instead of a decision.</p><p>It's not that caching doesn't work. It's that most engineers cache before they think.</p><p>Caching decisions shouldn't be ad hoc. To avoid that, start here:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!D3QO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a0c7313-061b-4d1a-a6c0-7be4fff4afcd_3421x5796.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!D3QO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a0c7313-061b-4d1a-a6c0-7be4fff4afcd_3421x5796.png 424w, https://substackcdn.com/image/fetch/$s_!D3QO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a0c7313-061b-4d1a-a6c0-7be4fff4afcd_3421x5796.png 848w, https://substackcdn.com/image/fetch/$s_!D3QO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a0c7313-061b-4d1a-a6c0-7be4fff4afcd_3421x5796.png 1272w, https://substackcdn.com/image/fetch/$s_!D3QO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a0c7313-061b-4d1a-a6c0-7be4fff4afcd_3421x5796.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!D3QO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a0c7313-061b-4d1a-a6c0-7be4fff4afcd_3421x5796.png" width="1456" height="2467" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2a0c7313-061b-4d1a-a6c0-7be4fff4afcd_3421x5796.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:2467,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1349102,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/171523366?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a0c7313-061b-4d1a-a6c0-7be4fff4afcd_3421x5796.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!D3QO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a0c7313-061b-4d1a-a6c0-7be4fff4afcd_3421x5796.png 424w, https://substackcdn.com/image/fetch/$s_!D3QO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a0c7313-061b-4d1a-a6c0-7be4fff4afcd_3421x5796.png 848w, https://substackcdn.com/image/fetch/$s_!D3QO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a0c7313-061b-4d1a-a6c0-7be4fff4afcd_3421x5796.png 1272w, https://substackcdn.com/image/fetch/$s_!D3QO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a0c7313-061b-4d1a-a6c0-7be4fff4afcd_3421x5796.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now let's break it down, question by question.</p><div><hr></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!x8JT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!x8JT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 424w, https://substackcdn.com/image/fetch/$s_!x8JT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 848w, https://substackcdn.com/image/fetch/$s_!x8JT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 1272w, https://substackcdn.com/image/fetch/$s_!x8JT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!x8JT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png" width="1456" height="879" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:879,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!x8JT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 424w, https://substackcdn.com/image/fetch/$s_!x8JT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 848w, https://substackcdn.com/image/fetch/$s_!x8JT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 1272w, https://substackcdn.com/image/fetch/$s_!x8JT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01018fb-6752-40f8-8c01-8855ae97be84_1600x966.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>As developers increasingly turn to CLI coding agents like Claude Code for rapid development, a critical gap emerges: <strong>who reviews the AI-generated code?</strong> </p><p>CodeRabbit CLI fills this void by delivering senior-level code reviews directly in your terminal, creating a seamless workflow where code generation flows directly into automated validation. Review uncommitted changes, catch AI hallucinations, and get one-click fixes - all without leaving your command line. </p><p>It's the quality gate that makes autonomous coding truly possible, ensuring every line of AI-generated code meets production standards before it ships.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://coderabbit.link/jG7lcRZ&quot;,&quot;text&quot;:&quot;Install CodeRabbit CLI&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://coderabbit.link/jG7lcRZ"><span>Install CodeRabbit CLI</span></a></p><div><hr></div><h3>1. Is the data accessed frequently?</h3><p>If a piece of data is rarely used, caching it doesn't help, it just takes up space.</p><p>But if it's hit constantly, by the same user or across many users, then caching saves real work.</p><p><strong>Example:</strong></p><p>Caching the homepage's product recommendations makes sense; they're requested thousands of times an hour.</p><p>But a one-time CSV export from an internal dashboard? That'll never be read again. Let it hit the database.</p><p>You don't batch-cook a meal no one orders. Cache is like a prep kitchen; only prep what is popular.</p><p>Simply put: the more traffic a key absorbs, the more return you get per byte of cache.</p><p></p><h3>2. Is it expensive to retrieve?</h3><p>Not all reads are equal. Some come cheap. Others hit external services ($$$), three databases, join ten tables, and compute summaries that cost real CPU.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!L7G7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0860f59f-742b-4b54-bd27-4564f6a3c863_1336x614.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!L7G7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0860f59f-742b-4b54-bd27-4564f6a3c863_1336x614.png 424w, https://substackcdn.com/image/fetch/$s_!L7G7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0860f59f-742b-4b54-bd27-4564f6a3c863_1336x614.png 848w, https://substackcdn.com/image/fetch/$s_!L7G7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0860f59f-742b-4b54-bd27-4564f6a3c863_1336x614.png 1272w, https://substackcdn.com/image/fetch/$s_!L7G7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0860f59f-742b-4b54-bd27-4564f6a3c863_1336x614.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!L7G7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0860f59f-742b-4b54-bd27-4564f6a3c863_1336x614.png" width="1336" height="614" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0860f59f-742b-4b54-bd27-4564f6a3c863_1336x614.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:614,&quot;width&quot;:1336,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!L7G7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0860f59f-742b-4b54-bd27-4564f6a3c863_1336x614.png 424w, https://substackcdn.com/image/fetch/$s_!L7G7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0860f59f-742b-4b54-bd27-4564f6a3c863_1336x614.png 848w, https://substackcdn.com/image/fetch/$s_!L7G7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0860f59f-742b-4b54-bd27-4564f6a3c863_1336x614.png 1272w, https://substackcdn.com/image/fetch/$s_!L7G7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0860f59f-742b-4b54-bd27-4564f6a3c863_1336x614.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>That's where caching makes a difference.</p><p><strong>Example:</strong><br>Generating a user's analytics dashboard might involve multiple service calls and heavy aggregation. Cache the final payload.<br>But fetching a flat record by primary key from a well-indexed table? It's already fast. Skip the cache.</p><p>Cache is a shortcut. Use it where the path is long.</p><p></p><h3>3. Is the data stable or volatile?</h3><p>Stable data makes a great cache. It can sit there for minutes, even hours, without anyone noticing.<br>Volatile data? Not so much. If it's stale, it's wrong, and now you're in trouble.</p><p><strong>Example:</strong></p><p>The list of supported countries won't change mid-session. Cache it for days.</p><p>But stock levels on a flash-sale item? That can change every second. Caching it without real-time invalidation will cost you trust and money.</p><p>If you cache volatile data, you either need:</p><ul><li><p>A <strong>short TTL</strong> (Time-To-Live)</p></li><li><p>Or an <strong>explicit invalidation hook</strong> (e.g., when the DB updates)</p></li></ul><p>If you can't tolerate being a little wrong, don't cache it at all; or cache it with a plan.</p><p>Once you've decided to cache something, the next question is:<br><strong>How do you keep it fresh?</strong></p><p>You have two main tools:</p><ul><li><p><strong>TTL (Time-To-Live):</strong> Set it and forget it. Let the data expire after a fixed time.</p></li><li><p><strong>Invalidation:</strong> Explicitly remove or update the cache when the data changes.</p></li></ul><p>Each has trade-offs. Use the wrong one, and you'll either serve stale data or waste cache space.</p><p>Here's a simple matrix to help you choose the right approach based on how the data behaves:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_Pq4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb1e31f2-c52d-4aba-bb24-b131c7075392_819x441.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_Pq4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb1e31f2-c52d-4aba-bb24-b131c7075392_819x441.png 424w, https://substackcdn.com/image/fetch/$s_!_Pq4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb1e31f2-c52d-4aba-bb24-b131c7075392_819x441.png 848w, https://substackcdn.com/image/fetch/$s_!_Pq4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb1e31f2-c52d-4aba-bb24-b131c7075392_819x441.png 1272w, https://substackcdn.com/image/fetch/$s_!_Pq4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb1e31f2-c52d-4aba-bb24-b131c7075392_819x441.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_Pq4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb1e31f2-c52d-4aba-bb24-b131c7075392_819x441.png" width="819" height="441" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/db1e31f2-c52d-4aba-bb24-b131c7075392_819x441.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:441,&quot;width&quot;:819,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:55584,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/171523366?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb1e31f2-c52d-4aba-bb24-b131c7075392_819x441.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_Pq4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb1e31f2-c52d-4aba-bb24-b131c7075392_819x441.png 424w, https://substackcdn.com/image/fetch/$s_!_Pq4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb1e31f2-c52d-4aba-bb24-b131c7075392_819x441.png 848w, https://substackcdn.com/image/fetch/$s_!_Pq4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb1e31f2-c52d-4aba-bb24-b131c7075392_819x441.png 1272w, https://substackcdn.com/image/fetch/$s_!_Pq4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb1e31f2-c52d-4aba-bb24-b131c7075392_819x441.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><h3>4. Is the data small and simple?</h3><p>How big is this data object? Is it cheap to serialize and deserialize?</p><p>Big, messy data doesn't belong in fast memory.</p><p>Large payloads eat up space, increase GC pressure, and slow down serialization and deserialization.<br>Small, flat data is faster to work with and easier to evict if needed.</p><p><strong>Example:</strong></p><p>A compact JSON with 10 fields &#8594; good candidate</p><p>A massive blob with 1,000 nested items &#8594; probably not</p><p><strong>A classic antipattern is </strong>caching the entire product catalog (100K items) instead of caching paginated views or product summaries.</p><p>Cache is a fast-access shelf, not cold storage. Store what fits and what you'll grab often.</p><p>Small keys, simple shapes. That's how cache stays fast.</p><p></p><h3>5. Does it directly impact user experience?</h3><p>Not all latency matters. But when it does, it matters a lot.</p><p>Anything on the critical path of a user interaction, loading a page, rendering a component, or hitting &#8220;submit&#8221; should feel instant.<br>If caching makes that possible, use it there.</p><p><strong>Example:</strong></p><p>The response time for a search query or product page load directly affects conversion.<br>But a background sync task running at 2AM? No one's waiting on it.</p><p>Cache where speed is felt, not just where it's measured.</p><p></p><h3>6. Is it safe to cache?</h3><p>Fast is good. Leaky is not.</p><p>Caching user-specific or sensitive data, PII, tokens, and financials without scoping or encryption is a security risk. One bad key and someone sees what they shouldn't.</p><p><strong>Examples:</strong></p><p>A shared cache key for <code>user:profile</code> might accidentally leak another user's data in a multi-tenant app.<br>Always scope keys and apply access control if needed.</p><p><strong>Mitigations:</strong></p><ul><li><p>Use per-user or per-session cache keys</p></li><li><p>Encrypt values when possible</p></li><li><p>Set short TTLs for sensitive data</p></li></ul><p>A rule of thumb: If it can't go in a log file, it doesn't belong in a shared cache.</p><p></p><h3>7. Will this scale?</h3><p>Caching that works for 1,000 users can collapse at 1 million.</p><p>Unbounded keys, high churn, or poorly managed TTLs can overwhelm memory, reduce hit ratios, and cause eviction storms.</p><p><strong>Example:</strong></p><p>A per-search query cache key (<code>search?q=...</code>) sounds harmless&#8212;until it creates millions of one-time keys.<br>Normalize input. Bound cardinality. Use sensible TTLs.</p><p><strong>Tactics:</strong></p><ul><li><p>Use eviction policies (LRU, LFU)</p></li><li><p>Set size limits</p></li><li><p>Monitor hit/miss ratio and eviction churn</p></li></ul><p>Don't keep every conversation in memory, just the most recent ones.</p><p>These questions work well when you can reason through them case by case.<br>But if you want a quick gut-check, here's a mental model to remember:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!h5IV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1512ad5-4ca6-4cb5-b236-1ffbe0d78b85_1134x413.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!h5IV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1512ad5-4ca6-4cb5-b236-1ffbe0d78b85_1134x413.png 424w, https://substackcdn.com/image/fetch/$s_!h5IV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1512ad5-4ca6-4cb5-b236-1ffbe0d78b85_1134x413.png 848w, https://substackcdn.com/image/fetch/$s_!h5IV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1512ad5-4ca6-4cb5-b236-1ffbe0d78b85_1134x413.png 1272w, https://substackcdn.com/image/fetch/$s_!h5IV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1512ad5-4ca6-4cb5-b236-1ffbe0d78b85_1134x413.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!h5IV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1512ad5-4ca6-4cb5-b236-1ffbe0d78b85_1134x413.png" width="1134" height="413" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b1512ad5-4ca6-4cb5-b236-1ffbe0d78b85_1134x413.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:413,&quot;width&quot;:1134,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:87803,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/171523366?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1512ad5-4ca6-4cb5-b236-1ffbe0d78b85_1134x413.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!h5IV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1512ad5-4ca6-4cb5-b236-1ffbe0d78b85_1134x413.png 424w, https://substackcdn.com/image/fetch/$s_!h5IV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1512ad5-4ca6-4cb5-b236-1ffbe0d78b85_1134x413.png 848w, https://substackcdn.com/image/fetch/$s_!h5IV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1512ad5-4ca6-4cb5-b236-1ffbe0d78b85_1134x413.png 1272w, https://substackcdn.com/image/fetch/$s_!h5IV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1512ad5-4ca6-4cb5-b236-1ffbe0d78b85_1134x413.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>If any of these are near zero, caching that data won't give you much back.<br>If all three are high, you're sitting on a high-leverage cache opportunity.</p><p></p><h3>Final Takeaways</h3><p>Caching works best when it's boring, predictable, scoped, and justified.<br>Not clever. Not magical. Just correct.</p><p>Here's what separates high-leverage caching from tech debt in disguise:</p><ul><li><p>Cache what's used frequently</p></li><li><p>Cache what's expensive to fetch</p></li><li><p>Cache what stays valid long enough to be worth it</p></li><li><p>Cache what improves something a user can actually feel</p></li><li><p>And never cache what you can't safely explain or scale</p></li></ul><p>Every cached key is a liability until it proves its value.<br>Design each one with the same intent you'd give a database schema or API contract.</p><p>If you can't answer <em>why</em> something is in the cache, it probably shouldn't be.</p><p>In high-performing systems, caching isn't an afterthought.<br>It's a deliberate, visible part of the architecture, with trade-offs, constraints, and clear justification.</p><blockquote><p>Smart systems don't cache more.<br>They cache better.</p></blockquote><p>Until next time,<br>&#8212; Raul</p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[Every repeated LLM call is money on fire]]></title><description><![CDATA[Redis 8 just changed the game with semantic caching that understands meaning, not just keys.]]></description><link>https://newsletter.systemdesignclassroom.com/p/every-repeated-llm-call-is-money-on-fire</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/every-repeated-llm-call-is-money-on-fire</guid><dc:creator><![CDATA[Raul Junco]]></dc:creator><pubDate>Mon, 11 Aug 2025 11:29:18 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/3a1ca257-99ab-40f5-b94e-ed8f11931526_2515x2559.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Your cache may be fast.<br>But it doesn&#8217;t understand your data.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!x4Mu!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b302b33-c9ad-4a85-a587-b1df18ca1b8e_708x528.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!x4Mu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b302b33-c9ad-4a85-a587-b1df18ca1b8e_708x528.png 424w, https://substackcdn.com/image/fetch/$s_!x4Mu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b302b33-c9ad-4a85-a587-b1df18ca1b8e_708x528.png 848w, https://substackcdn.com/image/fetch/$s_!x4Mu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b302b33-c9ad-4a85-a587-b1df18ca1b8e_708x528.png 1272w, https://substackcdn.com/image/fetch/$s_!x4Mu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b302b33-c9ad-4a85-a587-b1df18ca1b8e_708x528.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!x4Mu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b302b33-c9ad-4a85-a587-b1df18ca1b8e_708x528.png" width="708" height="528" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6b302b33-c9ad-4a85-a587-b1df18ca1b8e_708x528.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:528,&quot;width&quot;:708,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!x4Mu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b302b33-c9ad-4a85-a587-b1df18ca1b8e_708x528.png 424w, https://substackcdn.com/image/fetch/$s_!x4Mu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b302b33-c9ad-4a85-a587-b1df18ca1b8e_708x528.png 848w, https://substackcdn.com/image/fetch/$s_!x4Mu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b302b33-c9ad-4a85-a587-b1df18ca1b8e_708x528.png 1272w, https://substackcdn.com/image/fetch/$s_!x4Mu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b302b33-c9ad-4a85-a587-b1df18ca1b8e_708x528.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>That&#8217;s been the hidden flaw in conventional caching, especially in AI and search-heavy systems.<br>You can store the output. You can key it smartly. But unless the input <em>exactly</em> matches, you're back to a cache miss.</p><p>The result?</p><p>LLMs answering the same questions phrased 100 ways.<br>Search engines recomputing nearly identical vector queries.<br>Agents re-processing states they&#8217;ve already seen.</p><p>Caching by key doesn&#8217;t work when your users speak in meaning.</p><p>Redis 8 offers a serious upgrade: <strong>semantic caching</strong>, made practical with new native features like <strong>Vector Sets</strong>, <strong>LangCache</strong>, and to also help, <strong>Redis Flex</strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!qdMk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7892587-b22b-4749-8e00-2719f5642b1a_708x471.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qdMk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7892587-b22b-4749-8e00-2719f5642b1a_708x471.png 424w, https://substackcdn.com/image/fetch/$s_!qdMk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7892587-b22b-4749-8e00-2719f5642b1a_708x471.png 848w, https://substackcdn.com/image/fetch/$s_!qdMk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7892587-b22b-4749-8e00-2719f5642b1a_708x471.png 1272w, https://substackcdn.com/image/fetch/$s_!qdMk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7892587-b22b-4749-8e00-2719f5642b1a_708x471.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qdMk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7892587-b22b-4749-8e00-2719f5642b1a_708x471.png" width="708" height="471" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a7892587-b22b-4749-8e00-2719f5642b1a_708x471.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:471,&quot;width&quot;:708,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:232921,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/170391808?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7892587-b22b-4749-8e00-2719f5642b1a_708x471.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!qdMk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7892587-b22b-4749-8e00-2719f5642b1a_708x471.png 424w, https://substackcdn.com/image/fetch/$s_!qdMk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7892587-b22b-4749-8e00-2719f5642b1a_708x471.png 848w, https://substackcdn.com/image/fetch/$s_!qdMk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7892587-b22b-4749-8e00-2719f5642b1a_708x471.png 1272w, https://substackcdn.com/image/fetch/$s_!qdMk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7892587-b22b-4749-8e00-2719f5642b1a_708x471.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Let&#8217;s break down the shift and what it unlocks.</p><div><hr></div><p><strong>Something I&#8217;m excited to share with you:</strong><br>I&#8217;ve been working with a couple of friends on a platform designed to make us better engineers&#8212;one challenge at a time.</p><p>It&#8217;s called <strong>Join Enginuity</strong>.<br>Every day, you get a <strong>system design problem</strong> that forces you to think, research, and sharpen your instincts.</p><p>No fluff. No endless reading. Just practical challenges that make you better.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!I8I1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ca66c81-4681-48da-9fb5-58caa0051860_2725x2480.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!I8I1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ca66c81-4681-48da-9fb5-58caa0051860_2725x2480.png 424w, https://substackcdn.com/image/fetch/$s_!I8I1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ca66c81-4681-48da-9fb5-58caa0051860_2725x2480.png 848w, https://substackcdn.com/image/fetch/$s_!I8I1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ca66c81-4681-48da-9fb5-58caa0051860_2725x2480.png 1272w, https://substackcdn.com/image/fetch/$s_!I8I1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ca66c81-4681-48da-9fb5-58caa0051860_2725x2480.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!I8I1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ca66c81-4681-48da-9fb5-58caa0051860_2725x2480.png" width="1456" height="1325" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8ca66c81-4681-48da-9fb5-58caa0051860_2725x2480.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1325,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1324680,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/170391808?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ca66c81-4681-48da-9fb5-58caa0051860_2725x2480.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!I8I1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ca66c81-4681-48da-9fb5-58caa0051860_2725x2480.png 424w, https://substackcdn.com/image/fetch/$s_!I8I1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ca66c81-4681-48da-9fb5-58caa0051860_2725x2480.png 848w, https://substackcdn.com/image/fetch/$s_!I8I1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ca66c81-4681-48da-9fb5-58caa0051860_2725x2480.png 1272w, https://substackcdn.com/image/fetch/$s_!I8I1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ca66c81-4681-48da-9fb5-58caa0051860_2725x2480.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://www.joinenginuity.com/signup&quot;,&quot;text&quot;:&quot;Join The Challenge Today!&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://www.joinenginuity.com/signup"><span>Join The Challenge Today!</span></a></p><div><hr></div><h3>The Caching Problem in LLM Systems</h3><p>Caching works great when your input is stable:</p><blockquote><p><code>GET /product?id=123</code></p></blockquote><p>You cache <code>product:123</code> and call it a day.</p><p>Now compare that to an LLM workload:</p><blockquote><p><code>User 1: What is Redis LangCache?</code></p><p><code>User 2: Can you explain how LangCache works in Redis?</code></p><p><code>User 3: Tell me about Redis' new caching for LLMs.</code></p></blockquote><p></p><p>Semantically identical.<br>But unless you normalize or fingerprint aggressively, the cache sees them as totally different.</p><p>That means every slight rephrasing triggers a full LLM call. You pay again. You wait again.<br>Same output, burned compute.</p><p></p><h3>What Redis 8 Introduces (And Why It Matters)</h3><h4>1. <strong>Vector Sets</strong> &#8211; Native Vector Similarity in Redis</h4><p>Previously, you&#8217;d need a bolt-on vector DB like Pinecone or FAISS. Redis had no efficient built-in support.</p><p>Now it does.</p><p><strong>Imagine you have a collection of colored balls. Each ball has:</strong></p><ul><li><p>A label (like "red ball" or "blue ball").</p></li><li><p>A set of numbers describing it (its "vector", which could be like [1.0, 2.0, 3.0]).</p></li><li><p>Extra info, like "size=large" or "owner=John".</p></li></ul><p><strong>What do Redis vector sets do?</strong></p><ul><li><p>They store all these balls, each with their numbers and labels.</p></li><li><p>You can ask Redis: "Which balls are most similar to this one?" &#8212; It compares the numbers (vectors) to find matches.</p></li><li><p>You can also limit your search to certain balls (like only balls with "owner=John").</p></li></ul><p><strong>Why use Redis for this?</strong></p><ul><li><p>It&#8217;s super fast at searching for similar items, which is great for things like recommendations, finding related products, or grouping similar texts/images.</p></li></ul><p><strong>Example in plain steps:</strong></p><ol><li><p>Add balls with their numbers and info.</p></li><li><p>Ask for the most similar balls to a given one.</p></li><li><p>Filter results by extra info ("only large balls").</p></li><li><p>Remove balls or check how many you have.</p></li></ol><p>It&#8217;s just a clever way to quickly store and search for things that are "close" to each other, based on their numbers. Perfect for finding related items, instantly!</p><p>The following commands are available for vector sets:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!E-PP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f8bb57-f502-48d5-bbb3-1b01c487d581_1065x456.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!E-PP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f8bb57-f502-48d5-bbb3-1b01c487d581_1065x456.png 424w, https://substackcdn.com/image/fetch/$s_!E-PP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f8bb57-f502-48d5-bbb3-1b01c487d581_1065x456.png 848w, https://substackcdn.com/image/fetch/$s_!E-PP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f8bb57-f502-48d5-bbb3-1b01c487d581_1065x456.png 1272w, https://substackcdn.com/image/fetch/$s_!E-PP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f8bb57-f502-48d5-bbb3-1b01c487d581_1065x456.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!E-PP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f8bb57-f502-48d5-bbb3-1b01c487d581_1065x456.png" width="1065" height="456" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/95f8bb57-f502-48d5-bbb3-1b01c487d581_1065x456.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:456,&quot;width&quot;:1065,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:268640,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/170391808?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f8bb57-f502-48d5-bbb3-1b01c487d581_1065x456.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!E-PP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f8bb57-f502-48d5-bbb3-1b01c487d581_1065x456.png 424w, https://substackcdn.com/image/fetch/$s_!E-PP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f8bb57-f502-48d5-bbb3-1b01c487d581_1065x456.png 848w, https://substackcdn.com/image/fetch/$s_!E-PP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f8bb57-f502-48d5-bbb3-1b01c487d581_1065x456.png 1272w, https://substackcdn.com/image/fetch/$s_!E-PP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f8bb57-f502-48d5-bbb3-1b01c487d581_1065x456.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><h4>2. <strong>LangCache</strong> &#8211; Caching for Meaning, Not Just Keys</h4><p>LangCache is a <strong>fully managed semantic cache</strong> built on Redis 8.</p><p>It flips the caching model:</p><blockquote><p><code>Instead of:     cache[exact_string] = result</code></p><p><code>Now:            cache[embedding] &#8776; result</code></p></blockquote><p>LangCache uses your existing embedding model (OpenAI, Cohere, etc.) to generate a vector from the prompt. Then it searches the cache for <strong>similar</strong> past entries. If it finds one, it skips the LLM and returns the cached output.</p><p><strong>You just saved money and time</strong>, without losing correctness.</p><p>LangCache is available via REST API and is fully managed on Redis Cloud.</p><p>The request flow looks like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!comW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e74ae6c-14bb-44a0-9c0e-a504df53992a_593x891.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!comW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e74ae6c-14bb-44a0-9c0e-a504df53992a_593x891.png 424w, https://substackcdn.com/image/fetch/$s_!comW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e74ae6c-14bb-44a0-9c0e-a504df53992a_593x891.png 848w, https://substackcdn.com/image/fetch/$s_!comW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e74ae6c-14bb-44a0-9c0e-a504df53992a_593x891.png 1272w, https://substackcdn.com/image/fetch/$s_!comW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e74ae6c-14bb-44a0-9c0e-a504df53992a_593x891.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!comW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e74ae6c-14bb-44a0-9c0e-a504df53992a_593x891.png" width="593" height="891" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6e74ae6c-14bb-44a0-9c0e-a504df53992a_593x891.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:891,&quot;width&quot;:593,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!comW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e74ae6c-14bb-44a0-9c0e-a504df53992a_593x891.png 424w, https://substackcdn.com/image/fetch/$s_!comW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e74ae6c-14bb-44a0-9c0e-a504df53992a_593x891.png 848w, https://substackcdn.com/image/fetch/$s_!comW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e74ae6c-14bb-44a0-9c0e-a504df53992a_593x891.png 1272w, https://substackcdn.com/image/fetch/$s_!comW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e74ae6c-14bb-44a0-9c0e-a504df53992a_593x891.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is ideal for:</p><ul><li><p>Chatbots and support agents</p></li><li><p>RAG pipelines</p></li><li><p>Multi-step planning agents</p></li><li><p>Any system with input redundancy</p></li></ul><p>No key shaping. No hashing. Just raw meaning.</p><p>Use this formula to estimate savings:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ki0-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5e38772-e7f2-4c01-bba1-c13745942fc2_964x331.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ki0-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5e38772-e7f2-4c01-bba1-c13745942fc2_964x331.png 424w, https://substackcdn.com/image/fetch/$s_!ki0-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5e38772-e7f2-4c01-bba1-c13745942fc2_964x331.png 848w, https://substackcdn.com/image/fetch/$s_!ki0-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5e38772-e7f2-4c01-bba1-c13745942fc2_964x331.png 1272w, https://substackcdn.com/image/fetch/$s_!ki0-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5e38772-e7f2-4c01-bba1-c13745942fc2_964x331.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ki0-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5e38772-e7f2-4c01-bba1-c13745942fc2_964x331.png" width="964" height="331" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b5e38772-e7f2-4c01-bba1-c13745942fc2_964x331.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:331,&quot;width&quot;:964,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:73527,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/170391808?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5e38772-e7f2-4c01-bba1-c13745942fc2_964x331.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ki0-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5e38772-e7f2-4c01-bba1-c13745942fc2_964x331.png 424w, https://substackcdn.com/image/fetch/$s_!ki0-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5e38772-e7f2-4c01-bba1-c13745942fc2_964x331.png 848w, https://substackcdn.com/image/fetch/$s_!ki0-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5e38772-e7f2-4c01-bba1-c13745942fc2_964x331.png 1272w, https://substackcdn.com/image/fetch/$s_!ki0-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5e38772-e7f2-4c01-bba1-c13745942fc2_964x331.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Example</strong>: If your monthly LLM spend is $200, 60% of that is output tokens ($120), and you get a 50% hit rate, that&#8217;s $60 saved per month</p><p></p><h4>3. <strong>Redis Flex</strong> &#8211; Cache More for Less</h4><p>Caching gets expensive at scale, especially if everything lives in RAM.</p><p><strong>Redis Flex</strong> lets you offload less-used data to SSD, increasing cache capacity up to 5x without a 5x cost bump.</p><p><strong>RAM storage holds:</strong></p><ul><li><p>All keys (names)</p></li><li><p>Key indexes</p></li><li><p>Dictionaries</p></li><li><p>Hot data (working set)</p></li></ul><p>RAM can handle hot data, while your SSD handles warm data. You control eviction policies, thresholds, and performance trade-offs.</p><p>Frequently accessed data stays fast in RAM; less-demanded data is offloaded to SSD automatically. Applications use the same Redis API and don&#8217;t need to change to take advantage.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lBCA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00234a9d-5417-4509-a15b-85de95f2f07e_986x415.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lBCA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00234a9d-5417-4509-a15b-85de95f2f07e_986x415.png 424w, https://substackcdn.com/image/fetch/$s_!lBCA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00234a9d-5417-4509-a15b-85de95f2f07e_986x415.png 848w, https://substackcdn.com/image/fetch/$s_!lBCA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00234a9d-5417-4509-a15b-85de95f2f07e_986x415.png 1272w, https://substackcdn.com/image/fetch/$s_!lBCA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00234a9d-5417-4509-a15b-85de95f2f07e_986x415.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!lBCA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00234a9d-5417-4509-a15b-85de95f2f07e_986x415.png" width="986" height="415" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/00234a9d-5417-4509-a15b-85de95f2f07e_986x415.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:415,&quot;width&quot;:986,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:58676,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/170391808?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00234a9d-5417-4509-a15b-85de95f2f07e_986x415.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lBCA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00234a9d-5417-4509-a15b-85de95f2f07e_986x415.png 424w, https://substackcdn.com/image/fetch/$s_!lBCA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00234a9d-5417-4509-a15b-85de95f2f07e_986x415.png 848w, https://substackcdn.com/image/fetch/$s_!lBCA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00234a9d-5417-4509-a15b-85de95f2f07e_986x415.png 1272w, https://substackcdn.com/image/fetch/$s_!lBCA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00234a9d-5417-4509-a15b-85de95f2f07e_986x415.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Redis Flex is ideal when your:</strong></p><ul><li><p>working set is significantly smaller than your dataset (high RAM hit rate)</p></li><li><p>average key size is smaller than average value size (all key names are stored in RAM)</p></li><li><p>most recent data is the most frequently used (high RAM hit rate)</p></li></ul><p><strong>Redis Flex is not recommended for:</strong></p><ul><li><p>Long key names (all key names are stored in RAM)</p></li><li><p>Broad access patterns (any value could be pulled into RAM)</p></li><li><p>Large working sets (working set is stored in RAM)</p></li><li><p>Frequently moved data (moving to and from RAM too often can impact performance)</p></li></ul><p>Redis Flex is not intended to be used for persistent storage.</p><p>With Flex + LangCache, you can serve <strong>semantic cache hits at scale</strong> affordably.</p><p></p><h3>Why This Matters (Beyond Buzzwords)</h3><p>Let&#8217;s be blunt: most current AI architectures are duct-taped.</p><p>RAG pipelines re-embed the same documents.<br>Agents reprocess state with no memory.<br>Teams pay LLM costs repeatedly for cached knowledge.</p><p>The tools weren't ready until now.</p><p>Redis 8 changes that:</p><ul><li><p>You can <strong>store and search semantic data</strong> directly.</p></li><li><p>You can <strong>cache LLM responses intelligently</strong>.</p></li><li><p>You can <strong>scale caching affordably</strong> with hybrid RAM/SSD.</p></li></ul><p>It&#8217;s not just faster. It&#8217;s a different model.</p><p></p><h3>What Could Go Wrong?</h3><p>Every system has trade-offs. Here are a few worth flagging:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ATdT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F477d68bf-5dc6-4ebb-a0b3-87f5ccdf9344_824x231.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ATdT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F477d68bf-5dc6-4ebb-a0b3-87f5ccdf9344_824x231.png 424w, https://substackcdn.com/image/fetch/$s_!ATdT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F477d68bf-5dc6-4ebb-a0b3-87f5ccdf9344_824x231.png 848w, https://substackcdn.com/image/fetch/$s_!ATdT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F477d68bf-5dc6-4ebb-a0b3-87f5ccdf9344_824x231.png 1272w, https://substackcdn.com/image/fetch/$s_!ATdT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F477d68bf-5dc6-4ebb-a0b3-87f5ccdf9344_824x231.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ATdT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F477d68bf-5dc6-4ebb-a0b3-87f5ccdf9344_824x231.png" width="824" height="231" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/477d68bf-5dc6-4ebb-a0b3-87f5ccdf9344_824x231.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:231,&quot;width&quot;:824,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:49107,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/170391808?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F477d68bf-5dc6-4ebb-a0b3-87f5ccdf9344_824x231.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ATdT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F477d68bf-5dc6-4ebb-a0b3-87f5ccdf9344_824x231.png 424w, https://substackcdn.com/image/fetch/$s_!ATdT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F477d68bf-5dc6-4ebb-a0b3-87f5ccdf9344_824x231.png 848w, https://substackcdn.com/image/fetch/$s_!ATdT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F477d68bf-5dc6-4ebb-a0b3-87f5ccdf9344_824x231.png 1272w, https://substackcdn.com/image/fetch/$s_!ATdT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F477d68bf-5dc6-4ebb-a0b3-87f5ccdf9344_824x231.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>LangCache offers controls for most of this: TTLs, thresholds, scoped caches, etc.</p><p>Still, it&#8217;s not fire-and-forget. You&#8217;ll need to test thresholds and observe cache hit rates.</p><p></p><h3>Takeaways</h3><ul><li><p><strong>Conventional caches will break under semantic load.</strong> Redis 8 fixes that with new primitives.</p></li><li><p><strong>Vector Sets allow Redis to natively support vector similarity search.</strong></p></li><li><p><strong>LangCache turns prompt caching from string-matching into meaning-matching.</strong></p></li><li><p><strong>Redis Flex makes it scalable without blowing up costs.</strong></p></li><li><p><strong>Semantic cache isn&#8217;t just nice-to-have&#8212;it&#8217;s the only way to avoid repeated LLM waste.</strong></p><p></p></li></ul><h3>Final Thought</h3><p>Caching isn&#8217;t dead.<br>But the old rules don&#8217;t hold when your inputs are probabilistic, fuzzy, or phrased 10 different ways.</p><p>The next generation of infrastructure needs to <strong>understand meaning</strong>, not just match keys.</p><p>Redis 8 is the first real step toward that future.</p><p>If you&#8217;re building anything with LLMs, embeddings, or real-time retrieval, this upgrade isn&#8217;t optional.</p><p>It's overdue.</p><blockquote><p>Every LLM call you make that could&#8217;ve been a cache hit is tech debt you&#8217;re paying in real time.</p></blockquote><p></p><p>Until next time,<br>&#8212; Raul</p><p></p><p><strong>References</strong>:</p><div><hr></div><p><a href="https://redis.io/docs/latest/develop/whats-new/8-0/">https://redis.io/docs/latest/develop/whats-new/8-0/</a></p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[Retries Have an Evil Twin: Duplicates]]></title><description><![CDATA[Every distributed system has a duplication bug; it just hasn&#8217;t been triggered yet.]]></description><link>https://newsletter.systemdesignclassroom.com/p/retries-have-an-evil-twin-duplicates</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/retries-have-an-evil-twin-duplicates</guid><dc:creator><![CDATA[Raul Junco]]></dc:creator><pubDate>Mon, 28 Jul 2025 11:45:23 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!s9me!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78b377b0-2afe-4543-933c-973b1c60f9a0_1036x684.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You've built retries.<br>You've added queues.<br>You think you've made everything '<strong>resilient</strong>.'</p><p>And then a payment went through twice.<br>Two orders shipped.<br>The same email got sent three times.</p><p>Welcome to the ugly side of retries no one warns you about: <strong>duplication.</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!s9me!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78b377b0-2afe-4543-933c-973b1c60f9a0_1036x684.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!s9me!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78b377b0-2afe-4543-933c-973b1c60f9a0_1036x684.png 424w, https://substackcdn.com/image/fetch/$s_!s9me!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78b377b0-2afe-4543-933c-973b1c60f9a0_1036x684.png 848w, https://substackcdn.com/image/fetch/$s_!s9me!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78b377b0-2afe-4543-933c-973b1c60f9a0_1036x684.png 1272w, https://substackcdn.com/image/fetch/$s_!s9me!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78b377b0-2afe-4543-933c-973b1c60f9a0_1036x684.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!s9me!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78b377b0-2afe-4543-933c-973b1c60f9a0_1036x684.png" width="1036" height="684" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/78b377b0-2afe-4543-933c-973b1c60f9a0_1036x684.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:684,&quot;width&quot;:1036,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!s9me!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78b377b0-2afe-4543-933c-973b1c60f9a0_1036x684.png 424w, https://substackcdn.com/image/fetch/$s_!s9me!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78b377b0-2afe-4543-933c-973b1c60f9a0_1036x684.png 848w, https://substackcdn.com/image/fetch/$s_!s9me!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78b377b0-2afe-4543-933c-973b1c60f9a0_1036x684.png 1272w, https://substackcdn.com/image/fetch/$s_!s9me!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78b377b0-2afe-4543-933c-973b1c60f9a0_1036x684.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In distributed systems, <strong>At-Least-Once delivery is the default</strong>. Messages get retried. Requests get replayed. But if your app isn't ready for it, you end up with corrupted data, angry customers, and incomprehensible logic</p><p>This post breaks down <strong>four battle-tested strategies</strong> to handle duplication at the application level, so your systems stay correct, even when the same work shows up more than once.</p><div><hr></div><p>Thanks to our partners who keep this newsletter free for the reader.</p><p><strong>CodeRabbit</strong> &#8594; Free AI Code Reviews in VS Code</p><blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RyNd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RyNd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 424w, https://substackcdn.com/image/fetch/$s_!RyNd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 848w, https://substackcdn.com/image/fetch/$s_!RyNd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 1272w, https://substackcdn.com/image/fetch/$s_!RyNd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RyNd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png" width="1291" height="649" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:649,&quot;width&quot;:1291,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:458953,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/166180627?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RyNd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 424w, https://substackcdn.com/image/fetch/$s_!RyNd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 848w, https://substackcdn.com/image/fetch/$s_!RyNd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 1272w, https://substackcdn.com/image/fetch/$s_!RyNd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></blockquote><p>CodeRabbit brings AI-powered code reviews directly into VS Code, Cursor, and Windsurf. Get free, real-time feedback on every commit, before the PR, helping you catch bugs, security vulnerabilities, and performance issues early.</p><ul><li><p><strong>Per-commit reviews:</strong> Identify issues faster and avoid lengthy PR reviews</p></li><li><p><strong>Context-aware analysis:</strong> Understand code changes deeply for more accurate feedback</p></li><li><p>Fix with AI and get AI-driven suggestions to implement code changes</p></li></ul><p><strong>Multi-Layered Reviews:</strong> Benefit from code reviews both in your IDE (free) and in your PR (paid subscription)</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://coderabbit.link/raul&quot;,&quot;text&quot;:&quot;Install in VS Code&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://coderabbit.link/raul"><span>Install in VS Code</span></a></p><div><hr></div><h2>The Problem: Same Message, Twice the Effect</h2><p>Let's say a user submits a payment. The request goes through your API, but the backend crashes right before saving the result.</p><p>Your retry logic kicks in.</p><p>Now the same request is processed again. And you've:</p><ul><li><p>Charged the user twice.</p></li><li><p>Created two payment records.</p></li><li><p>Triggered two downstream events.</p></li></ul><p>This isn't just bad luck. It's <strong>by design</strong>.</p><blockquote><p>&#9888;&#65039; <strong>At-least-once delivery is the default.</strong><br>Most systems, especially queues, retries, and distributed APIs, guarantee that a message will arrive <strong>at least once</strong>, but may arrive <strong>multiple times</strong>.</p></blockquote><p>Why? Because retries are safer than data loss.<br>It's your job to make sure duplicates don't break your system.</p><h2>What's at Stake?</h2><p>Without duplication control:</p><ul><li><p><strong>Your data becomes unreliable.</strong> Systems that rely on exact state, like billing or inventory, get corrupted.</p></li><li><p><strong>Your code becomes defensive.</strong> Every handler needs if-checks, patches, or compensating logic.</p></li><li><p><strong>Your operations team burns out.</strong> They spend hours deduplicating rows, refunding customers, and triaging inconsistencies.</p></li></ul><p>You don't just lose trust. You will lose time.</p><h2>4 Ways to Stop Duplication at the Application Layer</h2><p>These approaches aren't theoretical. They show up in real production systems, depending on scale, latency tolerance, and system design.</p><p></p><h4>1. Database Unique Constraints</h4><p><strong>Concept:</strong> Use a <code>UNIQUE</code> constraint in the database to prevent duplicate operations, backed by an <strong>idempotency key</strong>.</p><p>Let's say a user places an order.<br>The client generates a unique <code>idempotency_key</code> and sends it with the request:</p><pre><code>CREATE TABLE orders (
  id UUID PRIMARY KEY,
  idempotency_key TEXT UNIQUE,
  ...
);</code></pre><p>The server attempts to insert the order using this key. If the same request is retried (e.g. due to a timeout), the database will reject the duplicate with a constraint violation.</p><p>You catch that error and fetch the original order.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ABZT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f113684-5150-48b2-9fe2-c3b52f9be86a_771x797.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ABZT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f113684-5150-48b2-9fe2-c3b52f9be86a_771x797.png 424w, https://substackcdn.com/image/fetch/$s_!ABZT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f113684-5150-48b2-9fe2-c3b52f9be86a_771x797.png 848w, https://substackcdn.com/image/fetch/$s_!ABZT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f113684-5150-48b2-9fe2-c3b52f9be86a_771x797.png 1272w, https://substackcdn.com/image/fetch/$s_!ABZT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f113684-5150-48b2-9fe2-c3b52f9be86a_771x797.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ABZT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f113684-5150-48b2-9fe2-c3b52f9be86a_771x797.png" width="771" height="797" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4f113684-5150-48b2-9fe2-c3b52f9be86a_771x797.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:797,&quot;width&quot;:771,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:93661,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/169128569?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f113684-5150-48b2-9fe2-c3b52f9be86a_771x797.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ABZT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f113684-5150-48b2-9fe2-c3b52f9be86a_771x797.png 424w, https://substackcdn.com/image/fetch/$s_!ABZT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f113684-5150-48b2-9fe2-c3b52f9be86a_771x797.png 848w, https://substackcdn.com/image/fetch/$s_!ABZT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f113684-5150-48b2-9fe2-c3b52f9be86a_771x797.png 1272w, https://substackcdn.com/image/fetch/$s_!ABZT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f113684-5150-48b2-9fe2-c3b52f9be86a_771x797.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4>&#9989; Pros</h4><ul><li><p>Ensures <strong>only one successful insert</strong> per key. Potential performance impact from high-concurrency insert conflicts or deadlocks.</p></li><li><p>Clean fallback path for retries, return the existing result.</p></li><li><p>Ideal for operations like <strong>checkout, registration, or payment initiation</strong>.</p></li></ul><h4>&#9888;&#65039; Cons</h4><ul><li><p>Adds write pressure to the database. In </p></li><li><p>Doesn't protect downstream effects unless guarded (e.g. emails, inventory).</p></li><li><p>Needs good <strong>key generation hygiene</strong> on the client or gateway.</p></li></ul><p>&#128204; <strong>Key insight:</strong> The database isn't just for persistence. It's a <strong>gatekeeper</strong> that protects your system from replayed requests, <em>as long as you give it something to gate on.</em></p><h4>2. In-Memory Deduplication</h4><p><strong>Concept:</strong> Track processed request IDs in memory using a <code>Set</code>, Map, or LRU cache. On each request, check if the ID was seen before.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dbX9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faec29802-c453-45f0-ad76-14be6b29e45a_651x307.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dbX9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faec29802-c453-45f0-ad76-14be6b29e45a_651x307.png 424w, https://substackcdn.com/image/fetch/$s_!dbX9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faec29802-c453-45f0-ad76-14be6b29e45a_651x307.png 848w, https://substackcdn.com/image/fetch/$s_!dbX9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faec29802-c453-45f0-ad76-14be6b29e45a_651x307.png 1272w, https://substackcdn.com/image/fetch/$s_!dbX9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faec29802-c453-45f0-ad76-14be6b29e45a_651x307.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dbX9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faec29802-c453-45f0-ad76-14be6b29e45a_651x307.png" width="651" height="307" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aec29802-c453-45f0-ad76-14be6b29e45a_651x307.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:307,&quot;width&quot;:651,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:28384,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/169128569?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faec29802-c453-45f0-ad76-14be6b29e45a_651x307.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!dbX9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faec29802-c453-45f0-ad76-14be6b29e45a_651x307.png 424w, https://substackcdn.com/image/fetch/$s_!dbX9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faec29802-c453-45f0-ad76-14be6b29e45a_651x307.png 848w, https://substackcdn.com/image/fetch/$s_!dbX9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faec29802-c453-45f0-ad76-14be6b29e45a_651x307.png 1272w, https://substackcdn.com/image/fetch/$s_!dbX9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faec29802-c453-45f0-ad76-14be6b29e45a_651x307.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>It's fast. It's simple. But it's <strong>only safe if your service is single-instance</strong> and doesn't restart frequently.</p><p><strong>Why it works:</strong> The process itself remembers what it's already done, no I/O needed.</p><h4>&#9989; Pros</h4><ul><li><p>Blazing fast.</p></li><li><p>No infrastructure dependency.</p></li><li><p>Great for <strong>short-lived</strong> tools and <strong>batch processes.</strong></p></li></ul><h4>&#9888;&#65039; Cons</h4><ul><li><p><strong>Volatile memory</strong>: everything is wiped on restart or crash.</p></li><li><p>Doesn't work in <strong>multi-threaded</strong> or <strong>multi-node</strong> systems without coordination.</p></li><li><p>You need to <strong>manually clean up</strong> old keys or use a TTL mechanism.</p></li></ul><p>&#128204;&nbsp;<strong>Best for:</strong>&nbsp;One-off scripts, CLI tools, test environments, or internal utilities where reliability isn't mission-critical, monoliths with low/moderate operation frequency.</p><p></p><h4>3. Distributed Cache (Redis)</h4><p><strong>Concept:</strong> Use Redis to track processed operations across distributed nodes. Store a key for each request ID with a TTL:</p><pre><code>SETNX request:&lt;id&gt; "processed"    # Only set if not exists
EXPIRE request:&lt;id&gt; 600           # Auto-expire in 10 minutes</code></pre><p>This ensures:</p><ul><li><p>Only one node processes the request.</p></li><li><p>Future retries are blocked.</p></li><li><p>The de-dup record eventually expires to free memory.</p></li></ul><p><strong>Why it works:</strong> Redis becomes a <strong>shared memory layer</strong> across services and instances.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xx_f!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34094780-0221-4b47-8879-e2a6e58928b5_1189x668.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xx_f!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34094780-0221-4b47-8879-e2a6e58928b5_1189x668.png 424w, https://substackcdn.com/image/fetch/$s_!xx_f!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34094780-0221-4b47-8879-e2a6e58928b5_1189x668.png 848w, https://substackcdn.com/image/fetch/$s_!xx_f!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34094780-0221-4b47-8879-e2a6e58928b5_1189x668.png 1272w, https://substackcdn.com/image/fetch/$s_!xx_f!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34094780-0221-4b47-8879-e2a6e58928b5_1189x668.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xx_f!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34094780-0221-4b47-8879-e2a6e58928b5_1189x668.png" width="1189" height="668" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/34094780-0221-4b47-8879-e2a6e58928b5_1189x668.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:668,&quot;width&quot;:1189,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!xx_f!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34094780-0221-4b47-8879-e2a6e58928b5_1189x668.png 424w, https://substackcdn.com/image/fetch/$s_!xx_f!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34094780-0221-4b47-8879-e2a6e58928b5_1189x668.png 848w, https://substackcdn.com/image/fetch/$s_!xx_f!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34094780-0221-4b47-8879-e2a6e58928b5_1189x668.png 1272w, https://substackcdn.com/image/fetch/$s_!xx_f!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34094780-0221-4b47-8879-e2a6e58928b5_1189x668.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4>&#9989; Pros</h4><ul><li><p>Fast lookup and write.</p></li><li><p>Survives restarts and horizontal scaling.</p></li><li><p>TTL provides automatic cleanup.</p></li></ul><h4>&#9888;&#65039; Cons</h4><ul><li><p>TTL tuning is <strong>non-trivial</strong>. Too short and legit retries slip through; too long and Redis bloats.</p></li><li><p><strong>Network partitioning or Redis downtime</strong> means you may process duplicates.</p></li><li><p>You'll need to deploy and monitor Redis reliably. It can become a single point of failure.</p></li></ul><p>&#128204; <strong>Tradeoff tip:</strong><br>Pair Redis deduplication with a <strong>fallback to DB uniqueness</strong> to catch any misses due to cache failures or TTL gaps.</p><p>&#128204; <strong>Best for:</strong> API services, job processors, microservices with retry logic.</p><p></p><h4>4. Message Broker Deduplication</h4><p><strong>Concept:</strong> Some brokers (e.g., Azure Service Bus, Pulsar) support built-in duplicate detection.</p><p>You assign a <code>MessageId</code> to each message. The broker keeps a <strong>deduplication window</strong> (e.g. 10 minutes). If the same ID appears again, it discards the message.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!SbUr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b748136-9766-4025-b99f-dafc8a116bed_1043x676.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!SbUr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b748136-9766-4025-b99f-dafc8a116bed_1043x676.png 424w, https://substackcdn.com/image/fetch/$s_!SbUr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b748136-9766-4025-b99f-dafc8a116bed_1043x676.png 848w, https://substackcdn.com/image/fetch/$s_!SbUr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b748136-9766-4025-b99f-dafc8a116bed_1043x676.png 1272w, https://substackcdn.com/image/fetch/$s_!SbUr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b748136-9766-4025-b99f-dafc8a116bed_1043x676.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!SbUr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b748136-9766-4025-b99f-dafc8a116bed_1043x676.png" width="1043" height="676" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4b748136-9766-4025-b99f-dafc8a116bed_1043x676.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:676,&quot;width&quot;:1043,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:117394,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/169128569?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b748136-9766-4025-b99f-dafc8a116bed_1043x676.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!SbUr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b748136-9766-4025-b99f-dafc8a116bed_1043x676.png 424w, https://substackcdn.com/image/fetch/$s_!SbUr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b748136-9766-4025-b99f-dafc8a116bed_1043x676.png 848w, https://substackcdn.com/image/fetch/$s_!SbUr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b748136-9766-4025-b99f-dafc8a116bed_1043x676.png 1272w, https://substackcdn.com/image/fetch/$s_!SbUr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b748136-9766-4025-b99f-dafc8a116bed_1043x676.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p><strong>Why it works:</strong> The <strong>message infrastructure</strong> becomes the gatekeeper; duplicates don't even hit your app.</p><h4>&#9989; Pros</h4><ul><li><p><strong>No application logic</strong> required.</p></li><li><p>Prevents duplicate <strong>delivery</strong>, not just processing.</p></li><li><p>Works great with <strong>at-least-once</strong> brokers.</p></li></ul><h4>&#9888;&#65039; Cons</h4><ul><li><p>Requires proper configuration (de-dup window, clock sync).</p></li><li><p>Doesn't help if your app publishes <strong>duplicate downstream events</strong>.</p></li><li><p>Broker-specific &#8212; not portable across infra.</p></li></ul><p>&#128204; <strong>Best for:</strong> Event-driven architectures, high-throughput pipelines, or systems with built-in broker support.</p><p></p><h3>Trade-Off Comparison</h3><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!iivI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01a8b22e-709a-43b0-a52d-c5b0225b7ec9_801x209.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!iivI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01a8b22e-709a-43b0-a52d-c5b0225b7ec9_801x209.png 424w, https://substackcdn.com/image/fetch/$s_!iivI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01a8b22e-709a-43b0-a52d-c5b0225b7ec9_801x209.png 848w, https://substackcdn.com/image/fetch/$s_!iivI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01a8b22e-709a-43b0-a52d-c5b0225b7ec9_801x209.png 1272w, https://substackcdn.com/image/fetch/$s_!iivI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01a8b22e-709a-43b0-a52d-c5b0225b7ec9_801x209.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!iivI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01a8b22e-709a-43b0-a52d-c5b0225b7ec9_801x209.png" width="801" height="209" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/01a8b22e-709a-43b0-a52d-c5b0225b7ec9_801x209.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:209,&quot;width&quot;:801,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:16312,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/169128569?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01a8b22e-709a-43b0-a52d-c5b0225b7ec9_801x209.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!iivI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01a8b22e-709a-43b0-a52d-c5b0225b7ec9_801x209.png 424w, https://substackcdn.com/image/fetch/$s_!iivI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01a8b22e-709a-43b0-a52d-c5b0225b7ec9_801x209.png 848w, https://substackcdn.com/image/fetch/$s_!iivI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01a8b22e-709a-43b0-a52d-c5b0225b7ec9_801x209.png 1272w, https://substackcdn.com/image/fetch/$s_!iivI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01a8b22e-709a-43b0-a52d-c5b0225b7ec9_801x209.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p></p><h3>Final Takeaways</h3><ul><li><p><strong>Duplication is a design reality</strong>, not a bug. Plan for it.</p></li><li><p><strong>At-least-once delivery</strong> means your systems will get the same input more than once. Act accordingly.</p></li><li><p><strong>Use the database for strong guarantees</strong>, Redis for fast coordination, and brokers for message-level protection.</p></li><li><p><strong>TTL-based deduplication</strong> is usually good enough. Start there.</p></li><li><p><strong>Combine layers</strong> (e.g., broker de-dup + Redis + DB constraint) for critical flows.</p></li></ul><p></p><blockquote><p>You can't prevent retries, but you can prevent rework.</p><p>Resilience without deduplication is just chaos with retries.</p></blockquote><p></p><p>Until next time,<br>&#8212; Raul</p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[Your Database Doesn't Trust the Server. That's Why It Writes Everything Twice.]]></title><description><![CDATA[What Every Backend Engineer Should Know About Write-Ahead Logs]]></description><link>https://newsletter.systemdesignclassroom.com/p/postgresql-write-ahead-logs-wal-durability-replication</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/postgresql-write-ahead-logs-wal-durability-replication</guid><dc:creator><![CDATA[Raul Junco]]></dc:creator><pubDate>Wed, 09 Jul 2025 11:30:13 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/03e09648-ebb3-4872-a25a-5dd8b7edd33c_2052x2093.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3>When Systems Lie to You</h3><p>Let's say your app submits a critical order update to your PostgreSQL database.</p><p>The API returns 200 OK. You move on.</p><p>But then the server crashes.</p><p>You restart the database and check the orders table. No record.</p><p><strong>What happened?</strong></p><p>It turns out, the database acknowledged your write <em>before</em> it had truly committed the data to disk.</p><p>That&#8217;s the pain point that Write-Ahead Logs (WAL) solve.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vhRI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0db16040-a37e-4dd9-92bc-686c825a5d7d_717x843.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vhRI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0db16040-a37e-4dd9-92bc-686c825a5d7d_717x843.png 424w, https://substackcdn.com/image/fetch/$s_!vhRI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0db16040-a37e-4dd9-92bc-686c825a5d7d_717x843.png 848w, https://substackcdn.com/image/fetch/$s_!vhRI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0db16040-a37e-4dd9-92bc-686c825a5d7d_717x843.png 1272w, https://substackcdn.com/image/fetch/$s_!vhRI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0db16040-a37e-4dd9-92bc-686c825a5d7d_717x843.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vhRI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0db16040-a37e-4dd9-92bc-686c825a5d7d_717x843.png" width="717" height="843" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0db16040-a37e-4dd9-92bc-686c825a5d7d_717x843.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:843,&quot;width&quot;:717,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:683066,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/167588204?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0db16040-a37e-4dd9-92bc-686c825a5d7d_717x843.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vhRI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0db16040-a37e-4dd9-92bc-686c825a5d7d_717x843.png 424w, https://substackcdn.com/image/fetch/$s_!vhRI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0db16040-a37e-4dd9-92bc-686c825a5d7d_717x843.png 848w, https://substackcdn.com/image/fetch/$s_!vhRI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0db16040-a37e-4dd9-92bc-686c825a5d7d_717x843.png 1272w, https://substackcdn.com/image/fetch/$s_!vhRI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0db16040-a37e-4dd9-92bc-686c825a5d7d_717x843.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Ignoring WAL = Risky Assumptions</h3><p>If a system writes data directly and crashes before syncing to disk:</p><ul><li><p>Records can be half-written or corrupted</p></li><li><p>Acknowledged writes may vanish</p></li><li><p>Recovery might leave the system inconsistent</p></li></ul><p>This isn't just a rare edge case. It's a recurring risk in any stateful system. Imagine a payment system that marks an order as paid but loses the transaction record after a crash. Or a logistics platform that acknowledges a shipment but forgets to actually persist the dispatch event.</p><p>The higher your write throughput, the more frequently this risk shows up, and the more expensive the consequences.</p><p>But how does PostgreSQL solve this problem?</p><div><hr></div><p>Thanks to our partners who keep this newsletter free for the reader.</p><p><strong>CodeRabbit</strong> &#8594; Free AI Code Reviews in VS Code</p><blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RyNd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RyNd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 424w, https://substackcdn.com/image/fetch/$s_!RyNd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 848w, https://substackcdn.com/image/fetch/$s_!RyNd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 1272w, https://substackcdn.com/image/fetch/$s_!RyNd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RyNd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png" width="1291" height="649" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:649,&quot;width&quot;:1291,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:458953,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/166180627?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RyNd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 424w, https://substackcdn.com/image/fetch/$s_!RyNd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 848w, https://substackcdn.com/image/fetch/$s_!RyNd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 1272w, https://substackcdn.com/image/fetch/$s_!RyNd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></blockquote><p>CodeRabbit brings AI-powered code reviews directly into VS Code, Cursor, and Windsurf. Get free, real-time feedback on every commit, before the PR, helping you catch bugs, security vulnerabilities, and performance issues early.</p><ul><li><p><strong>Per-commit reviews:</strong> Identify issues faster and avoid lengthy PR reviews</p></li><li><p><strong>Context-aware analysis:</strong> Understand code changes deeply for more accurate feedback</p></li><li><p>Fix with AI and get AI-driven suggestions to implement code changes</p></li></ul><p><strong>Multi-Layered Reviews:</strong> Benefit from code reviews both in your IDE (free) and in your PR (paid subscription)</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://coderabbit.link/raul&quot;,&quot;text&quot;:&quot;Install in VS Code&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://coderabbit.link/raul"><span>Install in VS Code</span></a></p><div><hr></div><h3>The solution was the WALs</h3><p>Write-Ahead Logging flips the order of operations. Instead of writing data directly, the system logs the <em>intent to change</em> first. Let's see a classic example; I bet you&#8217;ve used it without knowing.</p><h4>Here's the general flow (PostgreSQL example):</h4><ol><li><p>Receive a change request (e.g. INSERT)</p></li><li><p>Write the change to a WAL buffer</p></li><li><p>Flush the WAL buffer to disk (fsync)</p></li><li><p>Acknowledge the write to the client</p></li><li><p>Later, apply changes to the actual data files</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5Ivd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98a2fa5-a131-4c18-a70d-0abb6f7bc3ab_2506x1506.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5Ivd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98a2fa5-a131-4c18-a70d-0abb6f7bc3ab_2506x1506.png 424w, https://substackcdn.com/image/fetch/$s_!5Ivd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98a2fa5-a131-4c18-a70d-0abb6f7bc3ab_2506x1506.png 848w, https://substackcdn.com/image/fetch/$s_!5Ivd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98a2fa5-a131-4c18-a70d-0abb6f7bc3ab_2506x1506.png 1272w, https://substackcdn.com/image/fetch/$s_!5Ivd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98a2fa5-a131-4c18-a70d-0abb6f7bc3ab_2506x1506.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5Ivd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98a2fa5-a131-4c18-a70d-0abb6f7bc3ab_2506x1506.png" width="1456" height="875" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e98a2fa5-a131-4c18-a70d-0abb6f7bc3ab_2506x1506.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:875,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:451940,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/167588204?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98a2fa5-a131-4c18-a70d-0abb6f7bc3ab_2506x1506.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5Ivd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98a2fa5-a131-4c18-a70d-0abb6f7bc3ab_2506x1506.png 424w, https://substackcdn.com/image/fetch/$s_!5Ivd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98a2fa5-a131-4c18-a70d-0abb6f7bc3ab_2506x1506.png 848w, https://substackcdn.com/image/fetch/$s_!5Ivd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98a2fa5-a131-4c18-a70d-0abb6f7bc3ab_2506x1506.png 1272w, https://substackcdn.com/image/fetch/$s_!5Ivd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98a2fa5-a131-4c18-a70d-0abb6f7bc3ab_2506x1506.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Step 3 is the critical point. Until the WAL is safely flushed to disk, nothing is considered durable.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!AaAP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58d48a2c-8821-4a37-956f-9c3817b114b9_920x85.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AaAP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58d48a2c-8821-4a37-956f-9c3817b114b9_920x85.png 424w, https://substackcdn.com/image/fetch/$s_!AaAP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58d48a2c-8821-4a37-956f-9c3817b114b9_920x85.png 848w, https://substackcdn.com/image/fetch/$s_!AaAP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58d48a2c-8821-4a37-956f-9c3817b114b9_920x85.png 1272w, https://substackcdn.com/image/fetch/$s_!AaAP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58d48a2c-8821-4a37-956f-9c3817b114b9_920x85.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!AaAP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58d48a2c-8821-4a37-956f-9c3817b114b9_920x85.png" width="920" height="85" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/58d48a2c-8821-4a37-956f-9c3817b114b9_920x85.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:85,&quot;width&quot;:920,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:22481,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/167588204?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58d48a2c-8821-4a37-956f-9c3817b114b9_920x85.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!AaAP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58d48a2c-8821-4a37-956f-9c3817b114b9_920x85.png 424w, https://substackcdn.com/image/fetch/$s_!AaAP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58d48a2c-8821-4a37-956f-9c3817b114b9_920x85.png 848w, https://substackcdn.com/image/fetch/$s_!AaAP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58d48a2c-8821-4a37-956f-9c3817b114b9_920x85.png 1272w, https://substackcdn.com/image/fetch/$s_!AaAP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58d48a2c-8821-4a37-956f-9c3817b114b9_920x85.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><blockquote><p><strong>Nothing is acknowledged until the log is safely on disk.</strong></p></blockquote><p>Even if the system crashes right after step 3, PostgreSQL is able to replay the WAL on startup and restore the exact state before the crash.</p><p>This mechanism transforms potential data loss into a recoverable state.</p><h3>WAL Is Your Database's Black Box</h3><p>When a plane crashes, investigators use the flight recorder (aka "the black box") to reconstruct what happened.</p><p>WAL is the equivalent for your database.</p><p>It captures every intended change, insert, update, and delete in a sequential, append-only format.</p><p>Even if your heap or index pages are inconsistent due to a crash, the WAL gives the system a source of truth to rebuild from.</p><p>That's how PostgreSQL achieves ACID durability guarantees. Without it, every crash would be a data loss lottery.</p><h3>What's Inside a WAL Entry?</h3><p>In PostgreSQL, a WAL entry for an <code>INSERT</code> may include:</p><ul><li><p>Table/relation ID</p></li><li><p>Page number and offset</p></li><li><p>The tuple data being inserted</p></li></ul><p>WAL entries are not SQL statements. They are low-level descriptions of the physical or logical changes needed to replay the operation.</p><p>This structure ensures that recovery doesn't require full query re-execution, just a scan of the WAL entries.</p><p>PostgreSQL stores WAL data in files typically <strong>16MB</strong> in size by default. These files are named using a 24-character hexadecimal format like:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dTVT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F141b8221-272d-4efa-a066-9229f61fb82d_485x150.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dTVT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F141b8221-272d-4efa-a066-9229f61fb82d_485x150.png 424w, https://substackcdn.com/image/fetch/$s_!dTVT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F141b8221-272d-4efa-a066-9229f61fb82d_485x150.png 848w, https://substackcdn.com/image/fetch/$s_!dTVT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F141b8221-272d-4efa-a066-9229f61fb82d_485x150.png 1272w, https://substackcdn.com/image/fetch/$s_!dTVT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F141b8221-272d-4efa-a066-9229f61fb82d_485x150.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dTVT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F141b8221-272d-4efa-a066-9229f61fb82d_485x150.png" width="485" height="150" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/141b8221-272d-4efa-a066-9229f61fb82d_485x150.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:150,&quot;width&quot;:485,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:33383,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/167588204?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F141b8221-272d-4efa-a066-9229f61fb82d_485x150.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dTVT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F141b8221-272d-4efa-a066-9229f61fb82d_485x150.png 424w, https://substackcdn.com/image/fetch/$s_!dTVT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F141b8221-272d-4efa-a066-9229f61fb82d_485x150.png 848w, https://substackcdn.com/image/fetch/$s_!dTVT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F141b8221-272d-4efa-a066-9229f61fb82d_485x150.png 1272w, https://substackcdn.com/image/fetch/$s_!dTVT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F141b8221-272d-4efa-a066-9229f61fb82d_485x150.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>This name breaks down into:</p><ul><li><p><code>00000001</code>: Timeline ID</p></li><li><p><code>00000003</code>: WAL segment log ID</p></li><li><p><code>00000065</code>: Segment within the log</p></li></ul><p>These filenames are critical for:</p><ul><li><p><strong>Streaming replication</strong> (so replicas request the right segment)</p></li><li><p><strong>Archiving</strong> (for point-in-time recovery)</p></li><li><p><strong>Monitoring</strong> (to detect lag or growth)</p></li></ul><p>If you see a folder full of these files growing rapidly, that's either a high write workload, a replication lag, a misconfiguration, or a broken archiving process. Keep an eye on it.</p><h3>WAL Enables Replication</h3><p>Because WAL is a clean, ordered log of all changes, it's ideal for streaming replication:</p><ul><li><p>PostgreSQL sends WAL segments to replicas over a replication connection</p></li><li><p>Replicas replay the WAL to stay in sync</p></li><li><p>MongoDB uses its oplog the same way</p></li><li><p>Kafka takes this idea further; its entire architecture is built around logs</p></li></ul><p>Instead of building separate change streams, systems reuse their WALs to power real-time data distribution.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!eurJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb963e135-1ebe-4969-aaac-9026da520a7f_1371x655.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!eurJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb963e135-1ebe-4969-aaac-9026da520a7f_1371x655.png 424w, https://substackcdn.com/image/fetch/$s_!eurJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb963e135-1ebe-4969-aaac-9026da520a7f_1371x655.png 848w, https://substackcdn.com/image/fetch/$s_!eurJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb963e135-1ebe-4969-aaac-9026da520a7f_1371x655.png 1272w, https://substackcdn.com/image/fetch/$s_!eurJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb963e135-1ebe-4969-aaac-9026da520a7f_1371x655.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!eurJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb963e135-1ebe-4969-aaac-9026da520a7f_1371x655.png" width="1371" height="655" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b963e135-1ebe-4969-aaac-9026da520a7f_1371x655.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:655,&quot;width&quot;:1371,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!eurJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb963e135-1ebe-4969-aaac-9026da520a7f_1371x655.png 424w, https://substackcdn.com/image/fetch/$s_!eurJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb963e135-1ebe-4969-aaac-9026da520a7f_1371x655.png 848w, https://substackcdn.com/image/fetch/$s_!eurJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb963e135-1ebe-4969-aaac-9026da520a7f_1371x655.png 1272w, https://substackcdn.com/image/fetch/$s_!eurJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb963e135-1ebe-4969-aaac-9026da520a7f_1371x655.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Things That Can Break</h3><p>WAL helps, but it's not bulletproof. Watch for:</p><ul><li><p><strong>fsync disabled</strong>: Some configurations or test environments skip disk flushing, giving a false sense of safety.</p></li><li><p><strong>Slow disks</strong>: Commit performance is gated by how fast you can flush WALs.</p></li><li><p><strong>WAL bloat</strong>: Without cleanup or archiving, logs can consume large amounts of storage.</p></li><li><p><strong>Missing archive strategy</strong>: For point-in-time recovery, you must safely copy old WAL segments to backup storage.</p></li></ul><p>WAL gives you a recovery plan. But it only works if you configure and monitor it properly.</p><h3>Key Takeaways</h3><ul><li><p>WAL logs every change before applying it, which ensures durability and crash safety</p></li><li><p>Writes are acknowledged <em>only</em> after the log hits persistent storage</p></li><li><p>WAL is used for crash recovery, replication, and backup</p></li><li><p>PostgreSQL, MongoDB, Kafka, and many other systems rely on WAL-like designs</p></li><li><p>You must verify your environment uses fsync, manages disk I/O, and handles WAL archiving</p></li></ul><div><hr></div><p>Once you start to see your system as a stream of logged changes, replication, failover, and recovery become easier to reason about.</p><blockquote><p><strong>WALs aren</strong>'<strong>t just a recovery mechanism; they</strong>'<strong>re a design principle.</strong></p></blockquote><p>That's why your database writes everything twice.</p><p>Until next time,<br>&#8212; Raul</p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[High Availability Isn't About Luck]]></title><description><![CDATA[It's About Patterns.]]></description><link>https://newsletter.systemdesignclassroom.com/p/high-availability-isnt-about-luck</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/high-availability-isnt-about-luck</guid><dc:creator><![CDATA[Raul Junco]]></dc:creator><pubDate>Thu, 26 Jun 2025 12:06:21 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/7a639530-45f4-4f88-b193-b7ea1badc3a2_1824x1998.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Downtime isn&#8217;t random. It&#8217;s the result of decisions.</strong></p><p>And so is high availability.</p><p>If your system stays up during failure, it&#8217;s not because the universe smiled on you.<br>It&#8217;s because you made design choices, <strong>failover and replication</strong>, that absorbed the hit.</p><p>Availability isn&#8217;t magic. It&#8217;s math and architecture.</p><p>To design for it, you need to understand two ideas:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_ycy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aca38-b2f9-40cc-8655-619d5af1e54b_585x72.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_ycy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aca38-b2f9-40cc-8655-619d5af1e54b_585x72.png 424w, https://substackcdn.com/image/fetch/$s_!_ycy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aca38-b2f9-40cc-8655-619d5af1e54b_585x72.png 848w, https://substackcdn.com/image/fetch/$s_!_ycy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aca38-b2f9-40cc-8655-619d5af1e54b_585x72.png 1272w, https://substackcdn.com/image/fetch/$s_!_ycy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aca38-b2f9-40cc-8655-619d5af1e54b_585x72.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_ycy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aca38-b2f9-40cc-8655-619d5af1e54b_585x72.png" width="585" height="72" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6b8aca38-b2f9-40cc-8655-619d5af1e54b_585x72.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:72,&quot;width&quot;:585,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:15245,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/166180627?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aca38-b2f9-40cc-8655-619d5af1e54b_585x72.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_ycy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aca38-b2f9-40cc-8655-619d5af1e54b_585x72.png 424w, https://substackcdn.com/image/fetch/$s_!_ycy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aca38-b2f9-40cc-8655-619d5af1e54b_585x72.png 848w, https://substackcdn.com/image/fetch/$s_!_ycy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aca38-b2f9-40cc-8655-619d5af1e54b_585x72.png 1272w, https://substackcdn.com/image/fetch/$s_!_ycy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aca38-b2f9-40cc-8655-619d5af1e54b_585x72.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><ul><li><p><strong>Failover</strong> is about keeping the service up when a node dies.</p></li><li><p><strong>Replication</strong> is about making sure the data is still there and is fast to access.</p></li></ul><p>They both solve different problems, but both are necessary and must work together. Let&#8217;s break down some key design patterns and their trade-offs for both so you can choose the right one before your pager buzzes.</p><p>They solve different problems but work together.</p><div><hr></div><p>Thanks to our partners who keep this newsletter free for the reader.</p><p><strong>CodeRabbit</strong> &#8594; Free AI Code Reviews in VS Code</p><blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RyNd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RyNd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 424w, https://substackcdn.com/image/fetch/$s_!RyNd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 848w, https://substackcdn.com/image/fetch/$s_!RyNd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 1272w, https://substackcdn.com/image/fetch/$s_!RyNd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RyNd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png" width="1291" height="649" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:649,&quot;width&quot;:1291,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:458953,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/166180627?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RyNd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 424w, https://substackcdn.com/image/fetch/$s_!RyNd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 848w, https://substackcdn.com/image/fetch/$s_!RyNd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 1272w, https://substackcdn.com/image/fetch/$s_!RyNd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec8eb9be-1200-4e2c-9727-41d36fdd4a6c_1291x649.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></blockquote><p>CodeRabbit brings AI-powered code reviews directly into VS Code, Cursor, and Windsurf. Get free, real-time feedback on every commit, before the PR, helping you catch bugs, security vulnerabilities, and performance issues early.</p><ul><li><p><strong>Per-commit reviews:</strong> Identify issues faster and avoid lengthy PR reviews</p></li><li><p><strong>Context-aware analysis:</strong> Understand code changes deeply for more accurate feedback</p></li><li><p>Fix with AI and get AI-driven suggestions to implement code changes</p></li></ul><p><strong>Multi-Layered Reviews:</strong> Benefit from code reviews both in your IDE (free) and in your PR (paid subscription)</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://coderabbit.link/raul&quot;,&quot;text&quot;:&quot;Install in VS Code&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://coderabbit.link/raul"><span>Install in VS Code</span></a></p><div><hr></div><h3>Failover Patterns</h3><p><strong>Failover is your answer to system failure.</strong></p><p>When a node crashes or a zone goes dark, what takes over?</p><p>Failover is your solution to the problem: <strong>keeping the service running when the primary component becomes unavailable</strong>. It&#8217;s about <em>redundancy</em>, having backup instances that can step in without user impact. You don&#8217;t want downtime, so you need a standby.</p><p>It&#8217;s not about preventing failure. It&#8217;s about <strong>absorbing it with minimal disruption</strong>.</p><p>There are two main patterns to implement Failover:</p><ol><li><p><strong>Active-Active:</strong> All instances are live and share the load.</p></li><li><p><strong>Active-Passive:</strong> One instance handles traffic, others stay on standby.</p></li></ol><p>The choice between these two affects everything: <strong>latency, cost, failover time, operational complexity</strong>.</p><p>You don&#8217;t want downtime. So you need a standby.</p><h4>1. <strong>Active-Active Failover</strong></h4><p>In an <strong>active-active</strong> setup, <strong>all nodes are live</strong> and actively serve requests.<br>They share traffic through a load balancer or service mesh. If one node fails, the others continue operating, no warm-up, no handoff.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!OUNT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44787e51-c161-46b7-b537-9bcd646e9943_1054x597.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OUNT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44787e51-c161-46b7-b537-9bcd646e9943_1054x597.png 424w, https://substackcdn.com/image/fetch/$s_!OUNT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44787e51-c161-46b7-b537-9bcd646e9943_1054x597.png 848w, https://substackcdn.com/image/fetch/$s_!OUNT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44787e51-c161-46b7-b537-9bcd646e9943_1054x597.png 1272w, https://substackcdn.com/image/fetch/$s_!OUNT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44787e51-c161-46b7-b537-9bcd646e9943_1054x597.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!OUNT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44787e51-c161-46b7-b537-9bcd646e9943_1054x597.png" width="1054" height="597" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/44787e51-c161-46b7-b537-9bcd646e9943_1054x597.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:597,&quot;width&quot;:1054,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:116893,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/166180627?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44787e51-c161-46b7-b537-9bcd646e9943_1054x597.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OUNT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44787e51-c161-46b7-b537-9bcd646e9943_1054x597.png 424w, https://substackcdn.com/image/fetch/$s_!OUNT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44787e51-c161-46b7-b537-9bcd646e9943_1054x597.png 848w, https://substackcdn.com/image/fetch/$s_!OUNT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44787e51-c161-46b7-b537-9bcd646e9943_1054x597.png 1272w, https://substackcdn.com/image/fetch/$s_!OUNT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44787e51-c161-46b7-b537-9bcd646e9943_1054x597.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This pattern gives you <strong>high availability and high throughput</strong>, but comes at the cost of <strong>complex coordination</strong>:</p><ul><li><p>You need <strong>consistent state</strong> across nodes, or idempotent operations if state sync lags.</p></li><li><p>Your load balancer must detect unhealthy nodes and remove them from rotation fast.</p></li><li><p>If nodes write to shared resources (like a DB), ensure <strong>concurrency safety</strong> and conflict handling.</p></li></ul><p><strong>&#9989; Pros</strong></p><ul><li><p>No downtime on node failure</p></li><li><p>Scales horizontally under load</p></li><li><p>Better resource utilization</p></li></ul><p><strong>&#10008; Cons</strong></p><ul><li><p>Requires robust load balancing</p></li><li><p>Harder to manage stateful workloads</p></li><li><p>Can mask underlying issues due to redundancy</p></li></ul><p><strong>&#128204; Use when:</strong><br>You need zero-downtime failover and your service can tolerate or handle eventual consistency between nodes. Ideal for stateless APIs, edge services, and front-door layers.</p><p>Take into account this pattern maximizes uptime and capacity, but <strong>you&#8217;re also paying for that uptime 24/7</strong>.</p><p></p><p>2. <strong>Active-Passive Failover</strong></p><p>In an <strong>active-passive</strong> setup, only one node serves requests.<br>One or more standby nodes remain idle until the active fails, then a <strong>failover mechanism</strong> promotes a standby to become active.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!IMoA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1a45117-6922-45de-a378-1db97088dad1_1021x614.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IMoA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1a45117-6922-45de-a378-1db97088dad1_1021x614.png 424w, https://substackcdn.com/image/fetch/$s_!IMoA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1a45117-6922-45de-a378-1db97088dad1_1021x614.png 848w, https://substackcdn.com/image/fetch/$s_!IMoA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1a45117-6922-45de-a378-1db97088dad1_1021x614.png 1272w, https://substackcdn.com/image/fetch/$s_!IMoA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1a45117-6922-45de-a378-1db97088dad1_1021x614.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!IMoA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1a45117-6922-45de-a378-1db97088dad1_1021x614.png" width="1021" height="614" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d1a45117-6922-45de-a378-1db97088dad1_1021x614.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:614,&quot;width&quot;:1021,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!IMoA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1a45117-6922-45de-a378-1db97088dad1_1021x614.png 424w, https://substackcdn.com/image/fetch/$s_!IMoA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1a45117-6922-45de-a378-1db97088dad1_1021x614.png 848w, https://substackcdn.com/image/fetch/$s_!IMoA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1a45117-6922-45de-a378-1db97088dad1_1021x614.png 1272w, https://substackcdn.com/image/fetch/$s_!IMoA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1a45117-6922-45de-a378-1db97088dad1_1021x614.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This pattern favors <strong>simplicity and consistency</strong> over speed of recovery.</p><p>But failover isn&#8217;t instant. Depending on detection and promotion logic (manual, DNS TTL, heartbeat monitoring), <strong>recovery can take seconds to minutes</strong>.</p><p><strong>&#9989; Pros</strong></p><ul><li><p>Simple to wrap you head around</p></li><li><p>Easier to implement for stateful systems</p></li><li><p>Reduced risk of data conflicts</p></li></ul><p><strong>&#10008; Cons</strong></p><ul><li><p>Downtime during failover</p></li><li><p>Backup node is underutilized</p></li><li><p>Potential for data loss if replication lags</p></li></ul><p><strong>&#128204; Use when:</strong><br>Failover speed is less critical than <strong>data correctness</strong> and <strong>operational simplicity</strong>. Common in primary-standby databases, DR setups, and tightly coupled monoliths.</p><p></p><h4>3. <strong>Hybrid Active-Passive Failover</strong></h4><p>You don&#8217;t always have to choose between <strong>fully active</strong> or <strong>fully idle</strong> systems.</p><p>A <strong>hybrid model</strong> combines multiple active nodes with one or more passive backups.<br>For example, two nodes actively serve traffic, and a third is passive, ready to take over if either fails</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ya7m!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bfeb8a4-8e4c-4255-9271-de8750190b35_1069x749.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ya7m!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bfeb8a4-8e4c-4255-9271-de8750190b35_1069x749.png 424w, https://substackcdn.com/image/fetch/$s_!ya7m!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bfeb8a4-8e4c-4255-9271-de8750190b35_1069x749.png 848w, https://substackcdn.com/image/fetch/$s_!ya7m!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bfeb8a4-8e4c-4255-9271-de8750190b35_1069x749.png 1272w, https://substackcdn.com/image/fetch/$s_!ya7m!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bfeb8a4-8e4c-4255-9271-de8750190b35_1069x749.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ya7m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bfeb8a4-8e4c-4255-9271-de8750190b35_1069x749.png" width="1069" height="749" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8bfeb8a4-8e4c-4255-9271-de8750190b35_1069x749.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:749,&quot;width&quot;:1069,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!ya7m!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bfeb8a4-8e4c-4255-9271-de8750190b35_1069x749.png 424w, https://substackcdn.com/image/fetch/$s_!ya7m!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bfeb8a4-8e4c-4255-9271-de8750190b35_1069x749.png 848w, https://substackcdn.com/image/fetch/$s_!ya7m!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bfeb8a4-8e4c-4255-9271-de8750190b35_1069x749.png 1272w, https://substackcdn.com/image/fetch/$s_!ya7m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8bfeb8a4-8e4c-4255-9271-de8750190b35_1069x749.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This setup gives you the <strong>throughput and fault tolerance</strong> of active-active,<br>but with <strong>lower cost and simpler coordination</strong>, because not every node is participating at all times.</p><p>You&#8217;ve got:</p><ul><li><p><strong>Redundancy</strong> from the passive instance</p></li><li><p><strong>Load distribution</strong> across the active ones</p></li><li><p><strong>Faster failover</strong> than cold standby</p></li><li><p><strong>Lower cost</strong> than scaling all nodes equally</p></li></ul><p><strong>&#9989; Pros</strong></p><ul><li><p>Load is shared across fewer active nodes &#8594; less infra cost</p></li><li><p>Passive node offers quick recovery without full duplication</p></li><li><p>Easier to understand than full active-active with N nodes</p></li></ul><p><strong>&#10008; Cons</strong></p><ul><li><p>Still requires sync between active and passive</p></li><li><p>Uneven load may bottleneck if one active fails</p></li><li><p>Failover logic must detect and rebalance</p></li></ul><p><strong>&#128176; Cost Consideration:</strong></p><ul><li><p>Lower than full active-active</p></li><li><p>Better utilization than pure passive</p></li><li><p>Scales better as demand grows</p></li></ul><p><strong>&#128204; Use when:</strong><br>You want to reduce infra spend while maintaining high availability and good performance.<br>Ideal for medium-scale services where <strong>failover speed matters</strong>, but <strong>cost discipline is required</strong>.</p><p>Failover can keep your <strong>services available</strong> when components fail.<br>But that&#8217;s only half the story.</p><p>To keep your <strong>data available and consistent</strong>, you need replication.</p><p>Let&#8217;s shift focus from infrastructure failover to <strong>data durability and distribution</strong>, and explore the core replication strategies.</p><p></p><h3>Replication Patterns</h3><p>Failover helps you survive infrastructure failure.<br><strong>Replication helps you survive data loss and scale reads.</strong></p><p>Replication means keeping multiple <strong>copies of your data</strong> in sync across nodes.<br>If one copy is lost, another can take over.<br>If your read traffic spikes, replicas can help offload the pressure.</p><p>There are two primary replication strategies:</p><ul><li><p><strong>Single-leader replication</strong>: one node handles all writes</p></li><li><p><strong>Multileader replication</strong>: multiple nodes accept writes</p></li></ul><p>Let&#8217;s break them down.</p><h4>1. <strong>Single-Leader Replication</strong></h4><p>In this pattern, <strong>only one node accepts writes</strong> (the leader).<br>One or more <strong>read replicas</strong> sync from it asynchronously.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5XDE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c5d5b0-1430-4bf5-b759-0ed755eba9fc_1074x536.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5XDE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c5d5b0-1430-4bf5-b759-0ed755eba9fc_1074x536.png 424w, https://substackcdn.com/image/fetch/$s_!5XDE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c5d5b0-1430-4bf5-b759-0ed755eba9fc_1074x536.png 848w, https://substackcdn.com/image/fetch/$s_!5XDE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c5d5b0-1430-4bf5-b759-0ed755eba9fc_1074x536.png 1272w, https://substackcdn.com/image/fetch/$s_!5XDE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c5d5b0-1430-4bf5-b759-0ed755eba9fc_1074x536.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5XDE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c5d5b0-1430-4bf5-b759-0ed755eba9fc_1074x536.png" width="1074" height="536" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/35c5d5b0-1430-4bf5-b759-0ed755eba9fc_1074x536.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:536,&quot;width&quot;:1074,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:150754,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/166180627?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c5d5b0-1430-4bf5-b759-0ed755eba9fc_1074x536.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5XDE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c5d5b0-1430-4bf5-b759-0ed755eba9fc_1074x536.png 424w, https://substackcdn.com/image/fetch/$s_!5XDE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c5d5b0-1430-4bf5-b759-0ed755eba9fc_1074x536.png 848w, https://substackcdn.com/image/fetch/$s_!5XDE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c5d5b0-1430-4bf5-b759-0ed755eba9fc_1074x536.png 1272w, https://substackcdn.com/image/fetch/$s_!5XDE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c5d5b0-1430-4bf5-b759-0ed755eba9fc_1074x536.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Clients can read from the leader or any replica, but <strong>all writes must go to the leader</strong>.</p><p><strong>&#9989; Pros</strong></p><ul><li><p>Simpler to conceptualize</p></li><li><p>Strong write consistency</p></li><li><p>Works well with read-heavy workloads</p></li></ul><p><strong>&#10008; Cons</strong></p><ul><li><p>Single point of failure (without external failover logic)</p></li><li><p>Replication lag &#8594; stale reads</p></li><li><p>Leader can become a write bottleneck under heavy load</p></li><li><p>Failover requires promotion and reconfiguration</p></li></ul><p><strong>&#128204; Use when:</strong><br>You care about <strong>data consistency</strong>, <strong>simplicity</strong>, and <strong>read scalability</strong>.<br>Common in OLTP systems, dashboards, and APIs where write throughput is moderate.</p><p></p><h4>2. <strong>Multileader Replication</strong></h4><p>In a multileader setup, <strong>multiple nodes can accept writes</strong>.<br>Each node replicates its changes to the others.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PZW1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff1d94f7-a563-4c0f-83b8-cddbcf0ce416_1083x596.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PZW1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff1d94f7-a563-4c0f-83b8-cddbcf0ce416_1083x596.png 424w, https://substackcdn.com/image/fetch/$s_!PZW1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff1d94f7-a563-4c0f-83b8-cddbcf0ce416_1083x596.png 848w, https://substackcdn.com/image/fetch/$s_!PZW1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff1d94f7-a563-4c0f-83b8-cddbcf0ce416_1083x596.png 1272w, https://substackcdn.com/image/fetch/$s_!PZW1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff1d94f7-a563-4c0f-83b8-cddbcf0ce416_1083x596.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PZW1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff1d94f7-a563-4c0f-83b8-cddbcf0ce416_1083x596.png" width="1083" height="596" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ff1d94f7-a563-4c0f-83b8-cddbcf0ce416_1083x596.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:596,&quot;width&quot;:1083,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!PZW1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff1d94f7-a563-4c0f-83b8-cddbcf0ce416_1083x596.png 424w, https://substackcdn.com/image/fetch/$s_!PZW1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff1d94f7-a563-4c0f-83b8-cddbcf0ce416_1083x596.png 848w, https://substackcdn.com/image/fetch/$s_!PZW1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff1d94f7-a563-4c0f-83b8-cddbcf0ce416_1083x596.png 1272w, https://substackcdn.com/image/fetch/$s_!PZW1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff1d94f7-a563-4c0f-83b8-cddbcf0ce416_1083x596.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Write locally, sync globally.</p><p>Multileader setups are <strong>eventually consistent</strong> by default.<br>You&#8217;ll need logic to resolve <strong>conflicts</strong>, like "last write wins", version vectors, or CRDTs.</p><p><strong>&#9989; Pros</strong></p><ul><li><p>High availability across regions</p></li><li><p>Local write performance (reduced latency for global users)</p></li><li><p>Avoids a single point of failure</p></li></ul><p><strong>&#10008; Cons</strong></p><ul><li><p>Complex conflict resolution</p></li><li><p>Increased write latency due to cross-node sync</p></li><li><p>Harder to figure out the data state</p></li><li><p>Greater operational overhead</p></li></ul><p><strong>&#128204; Use when:</strong><br>You need <strong>multi-region write availability</strong>, or your system must remain writable even during partial outages.<br>Used in collaborative tools, messaging platforms, and edge-aware databases.</p><p></p><h4>Bonus: <strong>Leaderless Replication</strong> (For Context)</h4><p>Some systems (e.g., Cassandra, Dynamo) use <strong>leaderless replication</strong>:<br>Clients write to multiple nodes directly, and consistency is managed via <strong>quorum reads/writes</strong>.</p><p>Trade-offs vary, but typically:</p><ul><li><p>Very high availability</p></li><li><p>Eventual consistency unless tuned carefully</p></li><li><p>Complex consistency guarantees</p></li></ul><p>You likely won&#8217;t build this yourself, but you should at the very least <strong>understand it when choosing infrastructure</strong>.</p><p></p><h3>Trade-offs in a table</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ZaDI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8059885e-4ba5-4811-83bb-852609ca2b19_1059x290.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZaDI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8059885e-4ba5-4811-83bb-852609ca2b19_1059x290.png 424w, https://substackcdn.com/image/fetch/$s_!ZaDI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8059885e-4ba5-4811-83bb-852609ca2b19_1059x290.png 848w, https://substackcdn.com/image/fetch/$s_!ZaDI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8059885e-4ba5-4811-83bb-852609ca2b19_1059x290.png 1272w, https://substackcdn.com/image/fetch/$s_!ZaDI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8059885e-4ba5-4811-83bb-852609ca2b19_1059x290.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZaDI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8059885e-4ba5-4811-83bb-852609ca2b19_1059x290.png" width="1059" height="290" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8059885e-4ba5-4811-83bb-852609ca2b19_1059x290.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:290,&quot;width&quot;:1059,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:166492,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/166180627?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8059885e-4ba5-4811-83bb-852609ca2b19_1059x290.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZaDI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8059885e-4ba5-4811-83bb-852609ca2b19_1059x290.png 424w, https://substackcdn.com/image/fetch/$s_!ZaDI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8059885e-4ba5-4811-83bb-852609ca2b19_1059x290.png 848w, https://substackcdn.com/image/fetch/$s_!ZaDI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8059885e-4ba5-4811-83bb-852609ca2b19_1059x290.png 1272w, https://substackcdn.com/image/fetch/$s_!ZaDI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8059885e-4ba5-4811-83bb-852609ca2b19_1059x290.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Final Thought</h3><p>Systems don't become highly available by accident.<br>They become resilient through <strong>intentional design</strong>.</p><ul><li><p>Failover absorbs failure.</p></li><li><p>Replication protects data.</p></li></ul><p>Here's what that means for you:</p><ol><li><p>Don&#8217;t assume replication means zero data loss.</p></li><li><p>Don&#8217;t assume failover means zero downtime.</p></li><li><p>Don't pick a pattern based on popularity&#8212;pick based on recovery time, latency tolerance, and consistency needs.</p></li></ol><blockquote><p>Good architecture isn't about uptime. It's about controlled failure.</p></blockquote><p>If you don't understand the trade-offs, you're not as "available" as you think.</p><p><strong>What&#8217;s one thing your system can&#8217;t recover from today?</strong></p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[Distributed Transactions Are the Root of All Complexity]]></title><description><![CDATA[SAGAs provides a structured way to deal with them.]]></description><link>https://newsletter.systemdesignclassroom.com/p/distributed-transactions-are-the-root-of-all-complexity</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/distributed-transactions-are-the-root-of-all-complexity</guid><dc:creator><![CDATA[Raul Junco]]></dc:creator><pubDate>Thu, 19 Jun 2025 11:55:52 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!gGrf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4808ab0-f921-4791-b984-d5a32a65edf9_1200x880.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Most software complexity isn&#8217;t in the code. </p><p>It instead lies hidden in the coordination.</p><p>And nothing makes coordination harder than distributed transactions.</p><h3>What <em>Are</em> Distributed Transactions?</h3><p>A <strong>distributed transaction</strong> is a single logical operation that spans multiple services or databases. You typically see this in microservices, where multiple components need to work together to fulfill a single user action.</p><p>For example, placing an order might involve:</p><ul><li><p>Charging a payment method (Payments Service)</p></li><li><p>Reserving stock (Inventory Service)</p></li><li><p>Scheduling delivery (Shipping Service)</p></li></ul><p>Ideally, these should either <strong>all succeed or all roll back</strong>. But in distributed systems, that's far easier said than done. The moment you introduce separate services and network calls, you set the stage for failures, latency spikes, retries, and only partial successes.</p><h3>The Challenge with Traditional Transactions</h3><p>In monoliths, you might solve this with a database transaction (ACID guarantees). But in distributed systems, two-phase commits (2PC) become risky, hard to scale, brittle under failure, and expensive in performance.</p><p>You're left with a painful tradeoff: <strong>consistency vs availability</strong>.</p><p>That's where <strong>sagas</strong> come in.</p><div><hr></div><blockquote><p>&#128073; <strong>Quick sidenote:</strong> if you're gluing together retries, compensations, and half-broken workflows&#8230;</p><p>You might want to check out <strong>Kestra</strong>.</p><p>It's an <strong>open-source</strong>, <strong>event-driven </strong>orchestration platform that makes it way easier to build, monitor, and scale complex flows, including distributed ones like SAGAs. You write in YAML, plug into your existing stack (Terraform, Slack, DBs, etc.), and get full visibility when things go sideways.</p><p>I've been playing with it lately and it just&#8230; clicks.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://fnf.dev/3T4sdqe&quot;,&quot;text&quot;:&quot;Check their open-source repo here&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://fnf.dev/3T4sdqe"><span>Check their open-source repo here</span></a></p><p>They already had my &#11088;&#65039;.</p></blockquote><div><hr></div><h3>What Is a Saga?</h3><p>A <strong>Saga</strong> is a design pattern for managing long-running distributed transactions through a sequence of local transactions, coordinated with events or commands.</p><p>Instead of relying on locks or global transactions, each service performs its own local operation, and if something fails later, a <strong>compensating transaction</strong> is invoked to undo previous steps.</p><blockquote><p>In other words:<br><strong>Forward-only steps, with explicit undo logic.</strong></p></blockquote><p></p><h3>&#129517; Orchestrated Sagas: The Central Brain</h3><p>In an <strong>orchestrated saga</strong>, a central coordinator (called the <em>orchestrator</em>) defines and manages the order of operations.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gGrf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4808ab0-f921-4791-b984-d5a32a65edf9_1200x880.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gGrf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4808ab0-f921-4791-b984-d5a32a65edf9_1200x880.png 424w, https://substackcdn.com/image/fetch/$s_!gGrf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4808ab0-f921-4791-b984-d5a32a65edf9_1200x880.png 848w, https://substackcdn.com/image/fetch/$s_!gGrf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4808ab0-f921-4791-b984-d5a32a65edf9_1200x880.png 1272w, https://substackcdn.com/image/fetch/$s_!gGrf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4808ab0-f921-4791-b984-d5a32a65edf9_1200x880.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gGrf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4808ab0-f921-4791-b984-d5a32a65edf9_1200x880.png" width="1200" height="880" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a4808ab0-f921-4791-b984-d5a32a65edf9_1200x880.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:880,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:171654,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/165797546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4808ab0-f921-4791-b984-d5a32a65edf9_1200x880.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gGrf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4808ab0-f921-4791-b984-d5a32a65edf9_1200x880.png 424w, https://substackcdn.com/image/fetch/$s_!gGrf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4808ab0-f921-4791-b984-d5a32a65edf9_1200x880.png 848w, https://substackcdn.com/image/fetch/$s_!gGrf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4808ab0-f921-4791-b984-d5a32a65edf9_1200x880.png 1272w, https://substackcdn.com/image/fetch/$s_!gGrf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4808ab0-f921-4791-b984-d5a32a65edf9_1200x880.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Think of it like a conductor:</strong><br>&#8220;Service A: place order.&#8221; &#8594; &#8220;Service B: charge payment.&#8221; &#8594; &#8220;Service C: ship package.&#8221;</p><p>The orchestrator explicitly calls each step. If anything fails, the orchestrator triggers the appropriate compensation, like cancelling the order or refunding the payment.</p><h4>&#9989; Pros:</h4><ul><li><p>Clear control flow and centralized logic</p></li><li><p>Easier to test and debug</p></li><li><p>Easier to visualize </p></li></ul><h3>&#10060; Cons:</h3><ul><li><p>Orchestrator becomes a <strong>single point of failure</strong></p></li><li><p>Can become a <strong>coordination bottleneck</strong> between teams</p></li><li><p>Slower to evolve when different teams own services</p></li></ul><p></p><p><strong>Real-world example:</strong><br>An e-commerce company I worked with used orchestrated sagas for order management. It worked well until the orchestrator failed under holiday load. Half-completed orders piled up, and coordination across services broke down. </p><p>The orchestrator was technically fine, but organizationally fragile.</p><p></p><h3>&#128256; Choreographed Sagas: Domain Events + Distributed Ownership</h3><p>In choreographed sagas, there's no central conductor. Each service listens for and emits events to progress the flow.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hVzo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3bbc9d5c-6dfa-4b7e-b28d-927356d09f74_1247x678.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hVzo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3bbc9d5c-6dfa-4b7e-b28d-927356d09f74_1247x678.png 424w, https://substackcdn.com/image/fetch/$s_!hVzo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3bbc9d5c-6dfa-4b7e-b28d-927356d09f74_1247x678.png 848w, https://substackcdn.com/image/fetch/$s_!hVzo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3bbc9d5c-6dfa-4b7e-b28d-927356d09f74_1247x678.png 1272w, https://substackcdn.com/image/fetch/$s_!hVzo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3bbc9d5c-6dfa-4b7e-b28d-927356d09f74_1247x678.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hVzo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3bbc9d5c-6dfa-4b7e-b28d-927356d09f74_1247x678.png" width="1247" height="678" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3bbc9d5c-6dfa-4b7e-b28d-927356d09f74_1247x678.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:678,&quot;width&quot;:1247,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hVzo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3bbc9d5c-6dfa-4b7e-b28d-927356d09f74_1247x678.png 424w, https://substackcdn.com/image/fetch/$s_!hVzo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3bbc9d5c-6dfa-4b7e-b28d-927356d09f74_1247x678.png 848w, https://substackcdn.com/image/fetch/$s_!hVzo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3bbc9d5c-6dfa-4b7e-b28d-927356d09f74_1247x678.png 1272w, https://substackcdn.com/image/fetch/$s_!hVzo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3bbc9d5c-6dfa-4b7e-b28d-927356d09f74_1247x678.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Service A publishes &#8220;Order Created.&#8221;<br>Service B listens and emits &#8220;Inventory Reserved.&#8221;<br>Service C listens and emits &#8220;Order Shipped.&#8221;</p><p>No central logic, just a chain of reactions.</p><h4>&#9989; Pros:</h4><ul><li><p><strong>Team autonomy</strong>: Each team owns its part.</p></li><li><p><strong>Scales across domains</strong>: No need for central coordination.</p></li><li><p><strong>Loose coupling</strong>: Easier to evolve services independently.</p></li></ul><p>&#10060; Cons:</p><ul><li><p><strong>Flow invisibility</strong>: Harder to see the full process in one place.</p></li><li><p><strong>Complex compensation</strong>: Rollbacks require scattered logic.</p></li><li><p><strong>Harder to test end-to-end</strong> without observability tools.</p><p></p></li></ul><h3>Observability: The Missing Map</h3><p>When you're dealing with distributed sagas, especially choreographed ones, <strong>observability isn't optional</strong>. It's how you make sense of chaos.</p><p>You need to answer:</p><ul><li><p>What triggered this flow?</p></li><li><p>Which services ran, in what order?</p></li><li><p>Where did it break?</p></li><li><p>And what needs to be compensated?</p></li></ul><h4>Recommended Tools &amp; Practices:</h4><ul><li><p><strong>Distributed tracing</strong> with <strong>OpenTelemetry</strong>, <strong>Jaeger</strong>, or <strong>Honeycomb</strong>:<br>Trace execution across services end-to-end.</p></li><li><p><strong>Structured logging</strong> with correlation IDs:<br>Pass trace IDs in every request to stitch logs into a coherent narrative.</p></li><li><p><strong>Centralized log aggregation</strong> (ELK, Loki, Datadog):<br>Keep everything searchable across services, regions, and retries.</p></li><li><p><strong>Custom dashboards</strong> for saga metrics:<br>Monitor failure rates, compensation triggers, and flow durations.</p></li></ul><p>Without visibility, sagas devolve into distributed guesswork.</p><p></p><h3>A Quick Cheatsheet</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pMU2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67ef5d78-1283-4aee-889e-0860362adef4_946x420.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pMU2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67ef5d78-1283-4aee-889e-0860362adef4_946x420.png 424w, https://substackcdn.com/image/fetch/$s_!pMU2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67ef5d78-1283-4aee-889e-0860362adef4_946x420.png 848w, https://substackcdn.com/image/fetch/$s_!pMU2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67ef5d78-1283-4aee-889e-0860362adef4_946x420.png 1272w, https://substackcdn.com/image/fetch/$s_!pMU2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67ef5d78-1283-4aee-889e-0860362adef4_946x420.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pMU2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67ef5d78-1283-4aee-889e-0860362adef4_946x420.png" width="946" height="420" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/67ef5d78-1283-4aee-889e-0860362adef4_946x420.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:420,&quot;width&quot;:946,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:134386,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/165797546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67ef5d78-1283-4aee-889e-0860362adef4_946x420.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pMU2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67ef5d78-1283-4aee-889e-0860362adef4_946x420.png 424w, https://substackcdn.com/image/fetch/$s_!pMU2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67ef5d78-1283-4aee-889e-0860362adef4_946x420.png 848w, https://substackcdn.com/image/fetch/$s_!pMU2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67ef5d78-1283-4aee-889e-0860362adef4_946x420.png 1272w, https://substackcdn.com/image/fetch/$s_!pMU2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67ef5d78-1283-4aee-889e-0860362adef4_946x420.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Here is how I decide which one to use </h3><p>Personally, I've leaned more toward <strong>choreographed sagas</strong>, especially when the business process spans multiple teams. It's not perfect, but the autonomy and flexibility it gives outweigh the tracing complexity (most days &#128517;).</p><p>That said, <strong>orchestrated sagas</strong> can be a great choice when one team owns the entire process and wants clarity over autonomy.</p><p><strong>One final tip:</strong> You can combine them by orchestrating critical paths (e.g., payments) with choreography for non-critical actions (e.g., notifications).</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!j_IM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e57b7d0-5dab-4437-8670-07816d4c5fd2_1086x703.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!j_IM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e57b7d0-5dab-4437-8670-07816d4c5fd2_1086x703.png 424w, https://substackcdn.com/image/fetch/$s_!j_IM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e57b7d0-5dab-4437-8670-07816d4c5fd2_1086x703.png 848w, https://substackcdn.com/image/fetch/$s_!j_IM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e57b7d0-5dab-4437-8670-07816d4c5fd2_1086x703.png 1272w, https://substackcdn.com/image/fetch/$s_!j_IM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e57b7d0-5dab-4437-8670-07816d4c5fd2_1086x703.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!j_IM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e57b7d0-5dab-4437-8670-07816d4c5fd2_1086x703.png" width="1086" height="703" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9e57b7d0-5dab-4437-8670-07816d4c5fd2_1086x703.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:703,&quot;width&quot;:1086,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:169176,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/165797546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e57b7d0-5dab-4437-8670-07816d4c5fd2_1086x703.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!j_IM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e57b7d0-5dab-4437-8670-07816d4c5fd2_1086x703.png 424w, https://substackcdn.com/image/fetch/$s_!j_IM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e57b7d0-5dab-4437-8670-07816d4c5fd2_1086x703.png 848w, https://substackcdn.com/image/fetch/$s_!j_IM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e57b7d0-5dab-4437-8670-07816d4c5fd2_1086x703.png 1272w, https://substackcdn.com/image/fetch/$s_!j_IM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e57b7d0-5dab-4437-8670-07816d4c5fd2_1086x703.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>So&#8230; how do </strong><em><strong>you</strong></em><strong> handle distributed transactions?</strong></p><p>Do you lean toward orchestration, choreography, or try to avoid the problem entirely through event stores, retries, or outbox patterns?</p><p>Hit reply or drop a comment, I'd love to hear your war stories.</p><p></p><blockquote><p>&#8220;Most complexity isn't in code or data &#8212; it's in the space between them.&#8221;</p></blockquote><p></p><p>Until next time,<br>&#8212; Raul</p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[Dead Letter Queues Are Not Your Safety Net]]></title><description><![CDATA[They&#8217;re a visibility tool. Most teams misuse them, and lose data silently.]]></description><link>https://newsletter.systemdesignclassroom.com/p/dead-letter-queues-are-not-your-safety-net</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/dead-letter-queues-are-not-your-safety-net</guid><dc:creator><![CDATA[Raul Junco]]></dc:creator><pubDate>Sat, 14 Jun 2025 11:56:58 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!sc9L!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec6d6ea-663f-424a-a181-8e4eb7bdcfa6_883x742.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Dead Letter Queues (DLQs) are designed to catch messages your system can&#8217;t process after a certain number of retries. They&#8217;re supposed to give you breathing room. A second chance to act before data is lost.</p><p>But here&#8217;s what really happens in most systems:</p><ul><li><p>Messages fail.</p></li><li><p>They get moved to a DLQ.</p></li><li><p>No one notices.</p></li><li><p>No one investigates.</p></li><li><p>Messages expire.</p></li><li><p>And the failure becomes permanent.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!sc9L!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec6d6ea-663f-424a-a181-8e4eb7bdcfa6_883x742.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sc9L!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec6d6ea-663f-424a-a181-8e4eb7bdcfa6_883x742.png 424w, https://substackcdn.com/image/fetch/$s_!sc9L!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec6d6ea-663f-424a-a181-8e4eb7bdcfa6_883x742.png 848w, https://substackcdn.com/image/fetch/$s_!sc9L!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec6d6ea-663f-424a-a181-8e4eb7bdcfa6_883x742.png 1272w, https://substackcdn.com/image/fetch/$s_!sc9L!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec6d6ea-663f-424a-a181-8e4eb7bdcfa6_883x742.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sc9L!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec6d6ea-663f-424a-a181-8e4eb7bdcfa6_883x742.png" width="883" height="742" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6ec6d6ea-663f-424a-a181-8e4eb7bdcfa6_883x742.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:742,&quot;width&quot;:883,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:521487,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/165476348?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec6d6ea-663f-424a-a181-8e4eb7bdcfa6_883x742.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!sc9L!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec6d6ea-663f-424a-a181-8e4eb7bdcfa6_883x742.png 424w, https://substackcdn.com/image/fetch/$s_!sc9L!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec6d6ea-663f-424a-a181-8e4eb7bdcfa6_883x742.png 848w, https://substackcdn.com/image/fetch/$s_!sc9L!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec6d6ea-663f-424a-a181-8e4eb7bdcfa6_883x742.png 1272w, https://substackcdn.com/image/fetch/$s_!sc9L!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec6d6ea-663f-424a-a181-8e4eb7bdcfa6_883x742.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Let&#8217;s break down why this happens and how to fix it.</p><div><hr></div><blockquote><p><strong>Cut Code Review Time &amp; Bugs in Half</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dcr1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb22e24ba-eb2c-4ad9-9362-b4d5fea65b5c_1600x800.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dcr1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb22e24ba-eb2c-4ad9-9362-b4d5fea65b5c_1600x800.png 424w, https://substackcdn.com/image/fetch/$s_!dcr1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb22e24ba-eb2c-4ad9-9362-b4d5fea65b5c_1600x800.png 848w, https://substackcdn.com/image/fetch/$s_!dcr1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb22e24ba-eb2c-4ad9-9362-b4d5fea65b5c_1600x800.png 1272w, https://substackcdn.com/image/fetch/$s_!dcr1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb22e24ba-eb2c-4ad9-9362-b4d5fea65b5c_1600x800.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dcr1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb22e24ba-eb2c-4ad9-9362-b4d5fea65b5c_1600x800.png" width="1456" height="728" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b22e24ba-eb2c-4ad9-9362-b4d5fea65b5c_1600x800.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:728,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dcr1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb22e24ba-eb2c-4ad9-9362-b4d5fea65b5c_1600x800.png 424w, https://substackcdn.com/image/fetch/$s_!dcr1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb22e24ba-eb2c-4ad9-9362-b4d5fea65b5c_1600x800.png 848w, https://substackcdn.com/image/fetch/$s_!dcr1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb22e24ba-eb2c-4ad9-9362-b4d5fea65b5c_1600x800.png 1272w, https://substackcdn.com/image/fetch/$s_!dcr1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb22e24ba-eb2c-4ad9-9362-b4d5fea65b5c_1600x800.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Code reviews are critical but time-consuming. CodeRabbit acts as your AI co-pilot, providing instant Code review comments and potential impacts of every pull request.</p><p>Beyond just flagging issues, CodeRabbit provides one-click fix suggestions and lets you define custom code quality rules using AST Grep patterns, catching subtle issues that traditional static analysis tools might miss.</p><p>CodeRabbit has so far reviewed more than 5 million PRs, installed on 1 million repositories, and used by 50 thousand Open-source projects. CodeRabbit is free for all open-source repo's.</p></blockquote><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://coderabbit.link/raul&quot;,&quot;text&quot;:&quot;Get Started Today&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://coderabbit.link/raul"><span>Get Started Today</span></a></p><div><hr></div><h3>&#10060; Problem 1: No Monitoring = No Recovery</h3><p>Most DLQs are unmonitored.</p><p>There&#8217;s no alert when messages arrive. No dashboard tracking queue size. No process to investigate what failed and why.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YFg-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c39d756-be44-4197-a79f-d3120cf99fd8_1959x2126.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YFg-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c39d756-be44-4197-a79f-d3120cf99fd8_1959x2126.png 424w, https://substackcdn.com/image/fetch/$s_!YFg-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c39d756-be44-4197-a79f-d3120cf99fd8_1959x2126.png 848w, https://substackcdn.com/image/fetch/$s_!YFg-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c39d756-be44-4197-a79f-d3120cf99fd8_1959x2126.png 1272w, https://substackcdn.com/image/fetch/$s_!YFg-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c39d756-be44-4197-a79f-d3120cf99fd8_1959x2126.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YFg-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c39d756-be44-4197-a79f-d3120cf99fd8_1959x2126.png" width="1456" height="1580" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3c39d756-be44-4197-a79f-d3120cf99fd8_1959x2126.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1580,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:356127,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/165476348?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c39d756-be44-4197-a79f-d3120cf99fd8_1959x2126.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!YFg-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c39d756-be44-4197-a79f-d3120cf99fd8_1959x2126.png 424w, https://substackcdn.com/image/fetch/$s_!YFg-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c39d756-be44-4197-a79f-d3120cf99fd8_1959x2126.png 848w, https://substackcdn.com/image/fetch/$s_!YFg-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c39d756-be44-4197-a79f-d3120cf99fd8_1959x2126.png 1272w, https://substackcdn.com/image/fetch/$s_!YFg-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c39d756-be44-4197-a79f-d3120cf99fd8_1959x2126.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Failures go unnoticed for days or weeks, until someone stumbles across missing data or a downstream report looks off.</p><p>By then, it&#8217;s often too late.</p><p><strong>Fix:</strong><br>Set up metrics for DLQ depth and message age. Trigger alerts when thresholds are breached. Make the DLQ part of your system health dashboard, not a hidden corner.</p><p></p><h3>&#10060; Problem 2: Blind Redrives Create Loops</h3><p>Some teams automate the reprocessing of messages from the DLQ.<br>It sounds efficient, until it&#8217;s not.</p><p>Redriving a failed message without understanding <em>why</em> it failed is asking for trouble.</p><ul><li><p>If the downstream service is still down, it will fail again.</p></li><li><p>If the payload format changed, it will fail again.</p></li><li><p>If your logic is flawed, it might break more than just that message.</p></li></ul><p>Some systems allow messages to bounce between the main queue and the DLQ indefinitely. Others eventually discard them after repeated failure.</p><p><strong>Fix:</strong><br>Don&#8217;t redrive blindly. Attach metadata when a message is moved to the DLQ: error type, timestamp, originating service, trace ID.<br>Redrive only after the root cause has been addressed.</p><p></p><h3>&#10060; Problem 3: Messages Disappear Without Warning</h3><p>In systems like AWS SQS, messages in the DLQ are deleted after 14 days.<br>That&#8217;s not configurable.</p><p>If no one processes them by then, they&#8217;re gone forever.<br>No reprocessing. No audit trail. No accountability.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dQhR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1344e92f-eaeb-47c2-bde9-f88bc4fc2377_1028x273.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dQhR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1344e92f-eaeb-47c2-bde9-f88bc4fc2377_1028x273.png 424w, https://substackcdn.com/image/fetch/$s_!dQhR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1344e92f-eaeb-47c2-bde9-f88bc4fc2377_1028x273.png 848w, https://substackcdn.com/image/fetch/$s_!dQhR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1344e92f-eaeb-47c2-bde9-f88bc4fc2377_1028x273.png 1272w, https://substackcdn.com/image/fetch/$s_!dQhR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1344e92f-eaeb-47c2-bde9-f88bc4fc2377_1028x273.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dQhR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1344e92f-eaeb-47c2-bde9-f88bc4fc2377_1028x273.png" width="1028" height="273" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1344e92f-eaeb-47c2-bde9-f88bc4fc2377_1028x273.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:273,&quot;width&quot;:1028,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:38094,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/165476348?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1344e92f-eaeb-47c2-bde9-f88bc4fc2377_1028x273.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dQhR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1344e92f-eaeb-47c2-bde9-f88bc4fc2377_1028x273.png 424w, https://substackcdn.com/image/fetch/$s_!dQhR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1344e92f-eaeb-47c2-bde9-f88bc4fc2377_1028x273.png 848w, https://substackcdn.com/image/fetch/$s_!dQhR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1344e92f-eaeb-47c2-bde9-f88bc4fc2377_1028x273.png 1272w, https://substackcdn.com/image/fetch/$s_!dQhR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1344e92f-eaeb-47c2-bde9-f88bc4fc2377_1028x273.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Fix:</strong><br>Track the age of DLQ messages. Alert when messages approach the expiration threshold. Set a regular cadence, weekly or even daily, for reviewing and draining DLQs.</p><p></p><h3>&#10060; Problem 4: DLQs Flatten Context</h3><p>DLQs often act as a catch-all. Every failure, regardless of cause, ends up in the same place, with no context.</p><p>But not all failures are equal:</p><ul><li><p>Some are malformed payloads.</p></li><li><p>Some are caused by missing downstream services.</p></li><li><p>Some are just business rule violations.</p></li></ul><p>And if you treat them all the same, you make triage harder and slower.</p><p><strong>Fix:</strong><br>Tag DLQ messages with structured metadata:</p><ul><li><p>Failure category</p></li><li><p>Originating service</p></li><li><p>Timestamp</p></li><li><p>Retry count</p></li><li><p>Root cause summary (if available)</p></li></ul><p>This turns your DLQ from a black hole into an observable failure pipeline.</p><p>Most systems&#8212;like AWS SQS, Azure Service Bus, Kafka, RabbitMQ&#8212;<strong>automatically move messages</strong> to a DLQ after the max retry threshold is hit. But:</p><p>&#10060; They don&#8217;t let you customize the DLQ message payload during that move.<br>&#9989; They only move the <strong>original message</strong>, untouched.</p><p>So if you want to include useful debugging metadata:</p><ul><li><p>You must intercept the failure and publish to the DLQ yourself. </p></li><li><p>You must implement the logic to inspect, validate, and retry the failed messages.</p></li></ul><p>These are tradeoffs you have to take into account!</p><p></p><h3>&#9878;&#65039; The Tradeoffs: DLQ Pros and Cons</h3><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Z2TP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7963143-2c0a-4920-9e0d-90f4328c0cea_839x216.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Z2TP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7963143-2c0a-4920-9e0d-90f4328c0cea_839x216.png 424w, https://substackcdn.com/image/fetch/$s_!Z2TP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7963143-2c0a-4920-9e0d-90f4328c0cea_839x216.png 848w, https://substackcdn.com/image/fetch/$s_!Z2TP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7963143-2c0a-4920-9e0d-90f4328c0cea_839x216.png 1272w, https://substackcdn.com/image/fetch/$s_!Z2TP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7963143-2c0a-4920-9e0d-90f4328c0cea_839x216.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Z2TP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7963143-2c0a-4920-9e0d-90f4328c0cea_839x216.png" width="839" height="216" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b7963143-2c0a-4920-9e0d-90f4328c0cea_839x216.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:216,&quot;width&quot;:839,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:42725,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/165476348?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7963143-2c0a-4920-9e0d-90f4328c0cea_839x216.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Z2TP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7963143-2c0a-4920-9e0d-90f4328c0cea_839x216.png 424w, https://substackcdn.com/image/fetch/$s_!Z2TP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7963143-2c0a-4920-9e0d-90f4328c0cea_839x216.png 848w, https://substackcdn.com/image/fetch/$s_!Z2TP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7963143-2c0a-4920-9e0d-90f4328c0cea_839x216.png 1272w, https://substackcdn.com/image/fetch/$s_!Z2TP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7963143-2c0a-4920-9e0d-90f4328c0cea_839x216.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><blockquote><p>A DLQ is a <strong>safety </strong><em><strong>valve</strong></em>, not a <strong>safety </strong><em><strong>net</strong></em>.<br>It gives you a buffer, but only if you <strong>actively manage it</strong>.</p></blockquote><p></p><h3>&#9989; What Good DLQ Practice Looks Like</h3><p>Here&#8217;s what a solid DLQ process includes:</p><ul><li><p><strong>Monitoring &amp; Alerting</strong><br>Real-time metrics on DLQ size, age, and throughput.</p></li><li><p><strong>Triage Automation</strong><br>Automatically classify failure reasons and separate transient from permanent.</p></li><li><p><strong>Structured Logging</strong><br>Include trace IDs, service names, error codes, and timestamps in every failed message.</p></li><li><p><strong>Human Ownership</strong><br>Assign a team to own the DLQ and act on it within defined SLAs.</p></li><li><p><strong>Safe Reprocessing</strong><br>Tools that deduplicate, validate, and replay only when the root cause is resolved.</p></li></ul><p></p><blockquote><p><strong>The question is not &#8220;Do you have a DLQ?&#8221;</strong><br>It&#8217;s &#8220;Do you actually know what&#8217;s in it, and are you doing something about it?&#8221;</p></blockquote><p></p><h3>Final Thoughts</h3><p>A DLQ shows you where your system is failing.<br>But only if you&#8217;re looking.</p><p>Most teams aren&#8217;t.</p><p>They quietly lose data, miss signals, and assume everything is fine until a customer reports something missing, and no one knows why.</p><p><strong>DLQs are not backups.</strong><br>They are broken promises waiting to be discovered.<br>Own them. Monitor them. Triage them. Fix the root causes.</p><p>That&#8217;s how you build resilience, for real.</p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[You can learn System Design while waiting for your coffee.]]></title><description><![CDATA[A coffee shop operates like a Distributed System; You will learn how below.]]></description><link>https://newsletter.systemdesignclassroom.com/p/what-a-coffee-shop-taught-me-about-system-design</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/what-a-coffee-shop-taught-me-about-system-design</guid><dc:creator><![CDATA[Raul Junco]]></dc:creator><pubDate>Wed, 11 Jun 2025 11:45:20 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!9gss!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F847417b6-7705-4c79-b791-99f4e7c86aa7_1280x700.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Most engineers think system design is something you only learn from diagrams and textbooks.</p><p>But you&#8217;ve already used a distributed system this week when you ordered coffee.</p><p>Even a coffee shop mirrors core principles of system design: APIs, queues, event-driven processing, bottlenecks, notifications, and more.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9gss!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F847417b6-7705-4c79-b791-99f4e7c86aa7_1280x700.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9gss!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F847417b6-7705-4c79-b791-99f4e7c86aa7_1280x700.png 424w, https://substackcdn.com/image/fetch/$s_!9gss!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F847417b6-7705-4c79-b791-99f4e7c86aa7_1280x700.png 848w, https://substackcdn.com/image/fetch/$s_!9gss!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F847417b6-7705-4c79-b791-99f4e7c86aa7_1280x700.png 1272w, https://substackcdn.com/image/fetch/$s_!9gss!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F847417b6-7705-4c79-b791-99f4e7c86aa7_1280x700.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9gss!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F847417b6-7705-4c79-b791-99f4e7c86aa7_1280x700.png" width="1280" height="700" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/847417b6-7705-4c79-b791-99f4e7c86aa7_1280x700.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:700,&quot;width&quot;:1280,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!9gss!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F847417b6-7705-4c79-b791-99f4e7c86aa7_1280x700.png 424w, https://substackcdn.com/image/fetch/$s_!9gss!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F847417b6-7705-4c79-b791-99f4e7c86aa7_1280x700.png 848w, https://substackcdn.com/image/fetch/$s_!9gss!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F847417b6-7705-4c79-b791-99f4e7c86aa7_1280x700.png 1272w, https://substackcdn.com/image/fetch/$s_!9gss!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F847417b6-7705-4c79-b791-99f4e7c86aa7_1280x700.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Let&#8217;s walk through it, step by step.</p><div><hr></div><blockquote><p><strong>Your Code Can Shape the Future of AI; and Pay Up to $50/hr</strong></p><p><strong>Outlier</strong> is hiring top software engineers to help improve the world&#8217;s leading AI models.</p><p>It&#8217;s freelance, flexible, and remote.</p><p>&#128073; Review and critique AI-generated code.<br>&#128073; Use your expertise to raise the bar on code quality.<br>&#128073; No AI experience needed&#8212;just solid engineering skills.</p><p>If you&#8217;ve built real systems, know your way around Git, and love clean code, this is the smartest side hustle you&#8217;ll find.</p></blockquote><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://tiny.outlier.ai/bdfzbycw&quot;,&quot;text&quot;:&quot;GET PAID TO WRITE AND REVIEW CODE&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://tiny.outlier.ai/bdfzbycw"><span>GET PAID TO WRITE AND REVIEW CODE</span></a></p><div><hr></div><h3>1. <strong>The Cashier = API Gateway</strong></h3><p>The cashier is the system&#8217;s entry point.</p><p>You place a request:</p><blockquote><p>&#8220;One oat milk cappuccino, no sugar.&#8221;</p></blockquote><p>The cashier validates it, logs it, and returns a response:</p><blockquote><p>&#8220;You&#8217;re order #37. Please wait to be called.&#8221;</p></blockquote><p>That&#8217;s exactly how an API works:</p><ul><li><p>Takes in a structured request.</p></li><li><p>Validates and transforms it.</p></li><li><p>Sends back an acknowledgment (order ID).</p></li></ul><p>This is <strong>synchronous</strong>, <strong>stateless</strong>, and <strong>isolated from the backend work</strong>.</p><p>&#128204; <strong>Design Insight:</strong> APIs should validate and log input early, then hand off work to background processes.</p><p></p><h3>2. <strong>The Order Queue = Message Queue</strong></h3><p>Once your order is accepted, it goes into a <strong>queue</strong> for preparation.<br>Orders are processed in <strong>first-in, first-out (FIFO)</strong> order.</p><p>But here&#8217;s the catch:<br>Even if orders arrive in order, <strong>processing time varies</strong>.</p><p>A black coffee takes 1 minute.<br>An iced caramel macchiato with almond milk might take 5.</p><p>So even if you're earlier in the queue, someone after you might get their order first.</p><p>&#128204; <strong>Design Insight: </strong>Queues buffer load, but they don&#8217;t guarantee equal wait times. Task complexity affects throughput.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xoRw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd60cc44b-0b2d-4f91-a11b-74ceedc5861e_1152x511.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xoRw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd60cc44b-0b2d-4f91-a11b-74ceedc5861e_1152x511.png 424w, https://substackcdn.com/image/fetch/$s_!xoRw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd60cc44b-0b2d-4f91-a11b-74ceedc5861e_1152x511.png 848w, https://substackcdn.com/image/fetch/$s_!xoRw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd60cc44b-0b2d-4f91-a11b-74ceedc5861e_1152x511.png 1272w, https://substackcdn.com/image/fetch/$s_!xoRw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd60cc44b-0b2d-4f91-a11b-74ceedc5861e_1152x511.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xoRw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd60cc44b-0b2d-4f91-a11b-74ceedc5861e_1152x511.png" width="1152" height="511" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d60cc44b-0b2d-4f91-a11b-74ceedc5861e_1152x511.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:511,&quot;width&quot;:1152,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:71382,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/165066659?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd60cc44b-0b2d-4f91-a11b-74ceedc5861e_1152x511.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xoRw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd60cc44b-0b2d-4f91-a11b-74ceedc5861e_1152x511.png 424w, https://substackcdn.com/image/fetch/$s_!xoRw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd60cc44b-0b2d-4f91-a11b-74ceedc5861e_1152x511.png 848w, https://substackcdn.com/image/fetch/$s_!xoRw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd60cc44b-0b2d-4f91-a11b-74ceedc5861e_1152x511.png 1272w, https://substackcdn.com/image/fetch/$s_!xoRw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd60cc44b-0b2d-4f91-a11b-74ceedc5861e_1152x511.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>3. <strong>Baristas = Event Consumers</strong></h3><p>Baristas don&#8217;t wait for orders to be assigned.</p><p>They <strong>listen</strong> for new orders, then pull one off the queue when ready.<br>This is <strong>event-driven architecture</strong>: workers subscribe to a stream of tasks and pick them up independently.</p><p>More baristas = higher parallelism = better throughput.</p><p>No need to coordinate who does what. Each instance is stateless and autonomous.</p><p>&#128204; <strong>Design Insight: </strong>Event-driven systems are more scalable and loosely coupled.<br>You can scale consumers horizontally with minimal coordination.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!mUCZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7685f383-82fc-438e-9b70-4a0de8f41547_1075x1114.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mUCZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7685f383-82fc-438e-9b70-4a0de8f41547_1075x1114.png 424w, https://substackcdn.com/image/fetch/$s_!mUCZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7685f383-82fc-438e-9b70-4a0de8f41547_1075x1114.png 848w, https://substackcdn.com/image/fetch/$s_!mUCZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7685f383-82fc-438e-9b70-4a0de8f41547_1075x1114.png 1272w, https://substackcdn.com/image/fetch/$s_!mUCZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7685f383-82fc-438e-9b70-4a0de8f41547_1075x1114.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!mUCZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7685f383-82fc-438e-9b70-4a0de8f41547_1075x1114.png" width="1075" height="1114" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7685f383-82fc-438e-9b70-4a0de8f41547_1075x1114.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1114,&quot;width&quot;:1075,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:142929,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/165066659?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7685f383-82fc-438e-9b70-4a0de8f41547_1075x1114.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!mUCZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7685f383-82fc-438e-9b70-4a0de8f41547_1075x1114.png 424w, https://substackcdn.com/image/fetch/$s_!mUCZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7685f383-82fc-438e-9b70-4a0de8f41547_1075x1114.png 848w, https://substackcdn.com/image/fetch/$s_!mUCZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7685f383-82fc-438e-9b70-4a0de8f41547_1075x1114.png 1272w, https://substackcdn.com/image/fetch/$s_!mUCZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7685f383-82fc-438e-9b70-4a0de8f41547_1075x1114.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>4. <strong>Espresso Machines = Shared Resource Bottleneck</strong></h3><p>Each barista can&#8217;t make every drink right away.</p><p>Espresso drinks rely on shared machines&#8212;typically just one or two in the shop.</p><p>That introduces <strong>resource contention</strong>.<br>Even if you have 5 baristas, only 2 drinks can be brewed simultaneously.</p><p>This is like:</p><ul><li><p>Database connection limits</p></li><li><p>CPU-bound microservices</p></li><li><p>Shared memory or I/O locks</p></li></ul><p>&#128204; <strong>Design Insight: </strong>Systems must manage contention and concurrency carefully.<br>Shared resources need pooling, backpressure, or load shedding.</p><p></p><h3>5. <strong>Order Ready = Push Notification</strong></h3><p>Customers don&#8217;t walk up every 30 seconds asking, &#8220;Is my drink ready?&#8221;</p><p>Instead, the barista calls your name (or order number) when it&#8217;s done.</p><p>This is <strong>push-based notification,</strong> far better than polling.</p><p>Polling wastes bandwidth and computing resources. Push updates are efficient and timely.</p><p>&#128204; <strong>Design Insight: </strong>Use push notifications (WebSockets, SSE, Pub/Sub) over polling where possible, especially for status updates or async task completions.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!1tfj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8950f12c-dc85-473d-8756-cb5ead370d91_707x775.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1tfj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8950f12c-dc85-473d-8756-cb5ead370d91_707x775.png 424w, https://substackcdn.com/image/fetch/$s_!1tfj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8950f12c-dc85-473d-8756-cb5ead370d91_707x775.png 848w, https://substackcdn.com/image/fetch/$s_!1tfj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8950f12c-dc85-473d-8756-cb5ead370d91_707x775.png 1272w, https://substackcdn.com/image/fetch/$s_!1tfj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8950f12c-dc85-473d-8756-cb5ead370d91_707x775.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1tfj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8950f12c-dc85-473d-8756-cb5ead370d91_707x775.png" width="707" height="775" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8950f12c-dc85-473d-8756-cb5ead370d91_707x775.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:775,&quot;width&quot;:707,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:78284,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/165066659?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8950f12c-dc85-473d-8756-cb5ead370d91_707x775.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1tfj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8950f12c-dc85-473d-8756-cb5ead370d91_707x775.png 424w, https://substackcdn.com/image/fetch/$s_!1tfj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8950f12c-dc85-473d-8756-cb5ead370d91_707x775.png 848w, https://substackcdn.com/image/fetch/$s_!1tfj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8950f12c-dc85-473d-8756-cb5ead370d91_707x775.png 1272w, https://substackcdn.com/image/fetch/$s_!1tfj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8950f12c-dc85-473d-8756-cb5ead370d91_707x775.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Real-World Considerations</h3><p>Distributed systems aren't perfect. Coffee shops aren't either.</p><p>Here&#8217;s what can go wrong:</p><ul><li><p><strong>Load spikes:</strong> Morning rush = write spike. Queue fills up, latency increases.</p></li><li><p><strong>Skewed processing:</strong> One complex order delays others. Impacts fairness.</p></li><li><p><strong>Dropped task:</strong> Barista forgets an order. You need <strong>retry or reconciliation</strong> logic.</p></li><li><p><strong>Backpressure:</strong>&nbsp;When the queue is too long, the system should&nbsp;<strong>throttle intake</strong>.</p></li></ul><p>All of these require planning, just like in software systems.</p><p></p><h3>Final Thought</h3><p>Distributed systems don&#8217;t start in the cloud.<br>They start with understanding <strong>how work flows</strong>, <strong>where it gets stuck</strong>, and <strong>who needs to be notified</strong>.</p><p>You don&#8217;t need Kubernetes to learn system design. You just need to watch how a coffee shop works under pressure.</p><p>Next time you're in line, look around and ask:</p><ul><li><p>Where&#8217;s the queue?</p></li><li><p>What&#8217;s async?</p></li><li><p>What&#8217;s the bottleneck?</p></li><li><p>What breaks under load?</p></li></ul><p>If you can model a coffee shop, you can model a backend system.</p><p></p><blockquote><p>System design isn&#8217;t theory; it&#8217;s observation. And the world is full of working systems.</p></blockquote><p></p><p>It&#8217;s all there, hiding in plain sight.</p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[Most Systems Get Consistency Wrong]]></title><description><![CDATA[DynamoDB Shows How to Do It at Scale]]></description><link>https://newsletter.systemdesignclassroom.com/p/most-systems-get-consistency-wrong</link><guid isPermaLink="false">https://newsletter.systemdesignclassroom.com/p/most-systems-get-consistency-wrong</guid><dc:creator><![CDATA[Raul Junco]]></dc:creator><pubDate>Sat, 31 May 2025 12:24:31 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/8af1678a-7c60-4215-ae50-f2c552de9ab3_889x726.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the wild, most systems get consistency wrong. They build a backend that works great  until two components try to write to the same record at the same time. </p><p>Then everything breaks.</p><p>You&#8217;ve seen it:</p><ul><li><p>Double charges in payment systems.</p></li><li><p>Lost edits in collaborative tools.</p></li><li><p>Inventory systems that sell stock that&#8217;s no longer there.</p></li></ul><p>These aren&#8217;t edge cases. They&#8217;re the reality of modern software and will break your business if you ignore them.</p><div><hr></div><blockquote><p>Want to build real-world voice automation with serious engineering behind it?</p><p><strong>Telnyx Voice AI</strong> gives you full-stack tools to launch voice assistants that feel fast, human, and production-ready.</p><ul><li><p><strong>Build AI-powered call flows</strong> with real-time transcription, webhook logic, and natural language understanding.</p></li><li><p><strong>Bring your own model or use native tools</strong> &#8212; no vendor lock-in, full control.</p></li><li><p><strong>Scale instantly</strong> with built-in global telephony, low-latency infrastructure, and seamless fallback to human agents.</p></li></ul><p>Thank you to Telnyx for sponsoring this newsletter and helping us keep it free!</p></blockquote><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://telnyx.com/products/voice-ai?utm_source=sponsored&amp;utm_medium=social&amp;utm_campaign=raul_j&quot;,&quot;text&quot;:&quot;Start Building Today!&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://telnyx.com/products/voice-ai?utm_source=sponsored&amp;utm_medium=social&amp;utm_campaign=raul_j"><span>Start Building Today!</span></a></p><div><hr></div><h3>What&#8217;s at Stake?</h3><p>If you don't handle consistency properly:</p><ol><li><p>You lose data,</p></li><li><p>You break trust,</p></li><li><p>And you create a system that&#8217;s impossible to debug.</p></li></ol><p>But consistency is hard, especially at scale. You're working with multiple nodes and services, often across regions. <strong>Distributed writes</strong> mean several systems may try to update the same data at the same time. Throw in unreliable networks, retries, and partial failures, and suddenly, maintaining a single source of truth becomes a serious challenge.</p><p>Despite the complexity, there are <strong>three ways</strong> to get consistency right:</p><h4>1. Write-Ahead Logging (WAL)</h4><p><strong>Used by:</strong> PostgreSQL, MySQL, etc.</p><p><strong>How it works:</strong></p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PWky!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc539952a-64a3-4b4e-862f-18d48f38cae3_766x53.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PWky!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc539952a-64a3-4b4e-862f-18d48f38cae3_766x53.png 424w, https://substackcdn.com/image/fetch/$s_!PWky!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc539952a-64a3-4b4e-862f-18d48f38cae3_766x53.png 848w, https://substackcdn.com/image/fetch/$s_!PWky!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc539952a-64a3-4b4e-862f-18d48f38cae3_766x53.png 1272w, https://substackcdn.com/image/fetch/$s_!PWky!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc539952a-64a3-4b4e-862f-18d48f38cae3_766x53.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PWky!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc539952a-64a3-4b4e-862f-18d48f38cae3_766x53.png" width="766" height="53" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c539952a-64a3-4b4e-862f-18d48f38cae3_766x53.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:53,&quot;width&quot;:766,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:4128,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/161256748?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc539952a-64a3-4b4e-862f-18d48f38cae3_766x53.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!PWky!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc539952a-64a3-4b4e-862f-18d48f38cae3_766x53.png 424w, https://substackcdn.com/image/fetch/$s_!PWky!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc539952a-64a3-4b4e-862f-18d48f38cae3_766x53.png 848w, https://substackcdn.com/image/fetch/$s_!PWky!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc539952a-64a3-4b4e-862f-18d48f38cae3_766x53.png 1272w, https://substackcdn.com/image/fetch/$s_!PWky!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc539952a-64a3-4b4e-862f-18d48f38cae3_766x53.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>If the system crashes in the middle, you replay the log. That gets you back to a consistent state.</p><p>&#9989; Durable and safe.<br>&#10060; Doesn&#8217;t handle concurrent write conflicts.</p><p></p><h4>2. Locking (Pessimistic Concurrency)</h4><p><strong>Used by:</strong> Traditional RDBMS</p><p><strong>How it works:</strong></p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LfFw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F672ebff5-002d-4595-84c5-97459d863c34_762x76.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LfFw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F672ebff5-002d-4595-84c5-97459d863c34_762x76.png 424w, https://substackcdn.com/image/fetch/$s_!LfFw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F672ebff5-002d-4595-84c5-97459d863c34_762x76.png 848w, https://substackcdn.com/image/fetch/$s_!LfFw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F672ebff5-002d-4595-84c5-97459d863c34_762x76.png 1272w, https://substackcdn.com/image/fetch/$s_!LfFw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F672ebff5-002d-4595-84c5-97459d863c34_762x76.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LfFw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F672ebff5-002d-4595-84c5-97459d863c34_762x76.png" width="762" height="76" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/672ebff5-002d-4595-84c5-97459d863c34_762x76.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:76,&quot;width&quot;:762,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:8539,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/161256748?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F672ebff5-002d-4595-84c5-97459d863c34_762x76.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LfFw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F672ebff5-002d-4595-84c5-97459d863c34_762x76.png 424w, https://substackcdn.com/image/fetch/$s_!LfFw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F672ebff5-002d-4595-84c5-97459d863c34_762x76.png 848w, https://substackcdn.com/image/fetch/$s_!LfFw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F672ebff5-002d-4595-84c5-97459d863c34_762x76.png 1272w, https://substackcdn.com/image/fetch/$s_!LfFw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F672ebff5-002d-4595-84c5-97459d863c34_762x76.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>&#9989; Prevents conflicting updates. </p><p>&#10060; Doesn&#8217;t scale. Blocks fast paths. Poor fit for distributed systems.</p><p></p><h4>3. Data Versioning (Optimistic Concurrency)</h4><p><strong>Used by:</strong> DynamoDB, Cassandra, Event Sourcing</p><p><strong>How it works:</strong></p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4uLQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67a12d8-d3fa-4978-99ca-22c588e2a976_758x82.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4uLQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67a12d8-d3fa-4978-99ca-22c588e2a976_758x82.png 424w, https://substackcdn.com/image/fetch/$s_!4uLQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67a12d8-d3fa-4978-99ca-22c588e2a976_758x82.png 848w, https://substackcdn.com/image/fetch/$s_!4uLQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67a12d8-d3fa-4978-99ca-22c588e2a976_758x82.png 1272w, https://substackcdn.com/image/fetch/$s_!4uLQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67a12d8-d3fa-4978-99ca-22c588e2a976_758x82.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4uLQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67a12d8-d3fa-4978-99ca-22c588e2a976_758x82.png" width="758" height="82" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c67a12d8-d3fa-4978-99ca-22c588e2a976_758x82.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:82,&quot;width&quot;:758,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:8133,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/161256748?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67a12d8-d3fa-4978-99ca-22c588e2a976_758x82.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4uLQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67a12d8-d3fa-4978-99ca-22c588e2a976_758x82.png 424w, https://substackcdn.com/image/fetch/$s_!4uLQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67a12d8-d3fa-4978-99ca-22c588e2a976_758x82.png 848w, https://substackcdn.com/image/fetch/$s_!4uLQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67a12d8-d3fa-4978-99ca-22c588e2a976_758x82.png 1272w, https://substackcdn.com/image/fetch/$s_!4uLQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67a12d8-d3fa-4978-99ca-22c588e2a976_758x82.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>No locks. Just version checks.</p><p>&#9989; Scales well. High throughput.<br>&#10060; You must handle retries and merge conflicts.</p><p></p><h3>Case Study: How DynamoDB Gets Consistency Right</h3><p>Let&#8217;s say you're building a diagram collaborative platform where teams co-edit architecture diagrams in real time.</p><p>Two users, A and B, open the same diagram. User A moves a component and writes it to the database (version 1). At the same time, User B renames that component and also tries to write (still thinking it's version 1).</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rbYO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0eed1e5c-dab7-417b-b753-d75e2b2fa165_956x332.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rbYO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0eed1e5c-dab7-417b-b753-d75e2b2fa165_956x332.png 424w, https://substackcdn.com/image/fetch/$s_!rbYO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0eed1e5c-dab7-417b-b753-d75e2b2fa165_956x332.png 848w, https://substackcdn.com/image/fetch/$s_!rbYO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0eed1e5c-dab7-417b-b753-d75e2b2fa165_956x332.png 1272w, https://substackcdn.com/image/fetch/$s_!rbYO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0eed1e5c-dab7-417b-b753-d75e2b2fa165_956x332.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rbYO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0eed1e5c-dab7-417b-b753-d75e2b2fa165_956x332.png" width="956" height="332" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0eed1e5c-dab7-417b-b753-d75e2b2fa165_956x332.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:332,&quot;width&quot;:956,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:57052,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/161256748?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0eed1e5c-dab7-417b-b753-d75e2b2fa165_956x332.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rbYO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0eed1e5c-dab7-417b-b753-d75e2b2fa165_956x332.png 424w, https://substackcdn.com/image/fetch/$s_!rbYO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0eed1e5c-dab7-417b-b753-d75e2b2fa165_956x332.png 848w, https://substackcdn.com/image/fetch/$s_!rbYO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0eed1e5c-dab7-417b-b753-d75e2b2fa165_956x332.png 1272w, https://substackcdn.com/image/fetch/$s_!rbYO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0eed1e5c-dab7-417b-b753-d75e2b2fa165_956x332.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Without coordination, whichever writer hits the database last will silently overwrite the other, resulting in either the position change or the rename being lost.</p><p>DynamoDB avoids this with <strong>Conditional Writes</strong>:</p><pre><code>**ConditionExpression** &#8212; a clause in DynamoDB that ensures an update only occurs if a specified condition (like a matching version) is true: "version = :expectedVersion"</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!HWgK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ac48adc-56b4-4413-97f9-c47d53495e6e_1742x3076.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HWgK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ac48adc-56b4-4413-97f9-c47d53495e6e_1742x3076.png 424w, https://substackcdn.com/image/fetch/$s_!HWgK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ac48adc-56b4-4413-97f9-c47d53495e6e_1742x3076.png 848w, https://substackcdn.com/image/fetch/$s_!HWgK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ac48adc-56b4-4413-97f9-c47d53495e6e_1742x3076.png 1272w, https://substackcdn.com/image/fetch/$s_!HWgK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ac48adc-56b4-4413-97f9-c47d53495e6e_1742x3076.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!HWgK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ac48adc-56b4-4413-97f9-c47d53495e6e_1742x3076.png" width="1456" height="2571" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3ac48adc-56b4-4413-97f9-c47d53495e6e_1742x3076.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:2571,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:486547,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.systemdesignclassroom.com/i/161256748?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ac48adc-56b4-4413-97f9-c47d53495e6e_1742x3076.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HWgK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ac48adc-56b4-4413-97f9-c47d53495e6e_1742x3076.png 424w, https://substackcdn.com/image/fetch/$s_!HWgK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ac48adc-56b4-4413-97f9-c47d53495e6e_1742x3076.png 848w, https://substackcdn.com/image/fetch/$s_!HWgK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ac48adc-56b4-4413-97f9-c47d53495e6e_1742x3076.png 1272w, https://substackcdn.com/image/fetch/$s_!HWgK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ac48adc-56b4-4413-97f9-c47d53495e6e_1742x3076.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4><strong>Key DynamoDB Features Used</strong></h4><ol><li><p><strong>ConditionExpression</strong><br>Enforces that writes only succeed if the item&#8217;s current version matches the client&#8217;s expected version.</p></li><li><p><strong>Atomic Counters</strong><br>The <code>version</code> attribute acts as an atomic counter, ensuring sequential updates.</p></li><li><p><strong>Optimistic Locking</strong><br>Clients assume no conflicts by default but handle them gracefully when they occur.</p></li></ol><h4><strong>Why This Works</strong></h4><ul><li><p><strong>Prevents Silent Overwrites</strong>: Only one writer succeeds per version, eliminating "last write wins" chaos.</p></li><li><p><strong>Merge Flexibility</strong>: Clients can implement domain-specific merge logic (e.g., Operational Transform for diagrams).</p></li><li><p><strong>Scalability</strong>: No centralized locking, making it suitable for globally distributed teams.</p></li></ul><h3>Trade-offs in Practice</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Zpqs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58af9cd8-3bfa-4c5b-85ce-a40139b0b88f_950x329.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Zpqs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58af9cd8-3bfa-4c5b-85ce-a40139b0b88f_950x329.png 424w, https://substackcdn.com/image/fetch/$s_!Zpqs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58af9cd8-3bfa-4c5b-85ce-a40139b0b88f_950x329.png 848w, https://substackcdn.com/image/fetch/$s_!Zpqs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58af9cd8-3bfa-4c5b-85ce-a40139b0b88f_950x329.png 1272w, https://substackcdn.com/image/fetch/$s_!Zpqs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58af9cd8-3bfa-4c5b-85ce-a40139b0b88f_950x329.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Zpqs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58af9cd8-3bfa-4c5b-85ce-a40139b0b88f_950x329.png" width="950" height="329" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/58af9cd8-3bfa-4c5b-85ce-a40139b0b88f_950x329.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:329,&quot;width&quot;:950,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!Zpqs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58af9cd8-3bfa-4c5b-85ce-a40139b0b88f_950x329.png 424w, https://substackcdn.com/image/fetch/$s_!Zpqs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58af9cd8-3bfa-4c5b-85ce-a40139b0b88f_950x329.png 848w, https://substackcdn.com/image/fetch/$s_!Zpqs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58af9cd8-3bfa-4c5b-85ce-a40139b0b88f_950x329.png 1272w, https://substackcdn.com/image/fetch/$s_!Zpqs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58af9cd8-3bfa-4c5b-85ce-a40139b0b88f_950x329.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Tools &amp; Frameworks</h3><ul><li><p><strong>Write-Ahead Logging</strong>: Native in PostgreSQL, MySQL, and SQLite</p></li><li><p><strong>Locking</strong>: Handled via transaction isolation levels (e.g., <code>SERIALIZABLE</code>) in most RDBMS</p></li><li><p><strong>Versioning</strong>:</p><ul><li><p>AWS SDKs for DynamoDB support Conditional Writes out of the box</p></li><li><p>Event Sourcing frameworks like Axon (Java), Eventuate (Java), or Marten (C#) enable version-based control</p></li></ul></li></ul><h3>Wrapping up</h3><ul><li><p>There are only 3 ways to ensure consistency: WAL, Locking, and Versioning.</p></li><li><p>DynamoDB scales by choosing versioning and pushing retry logic to clients.</p></li><li><p>Versioning is ideal for distributed, high-throughput systems, but comes with trade-offs.</p></li><li><p>If you're building a system that involves concurrent writes, don't rely on duct tape and blind hope. Rely on versions.</p></li><li><p>Consistency isn&#8217;t magic; it&#8217;s engineering.</p></li></ul><p></p><blockquote><p>Most teams overengineer consistency or overlook it until it breaks. DynamoDB shows that with the right model, you can keep both <strong>scale</strong> and <strong>safety</strong>.</p></blockquote><p></p><p><strong>Your Move:</strong> How does your system manage consistency today? Locking? Logging? Or versioning? </p><p>Shoot me a reply or share your approach; I&#8217;m curious.</p><div><hr></div><p>System Design Classroom is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/subscribe?"><span>Subscribe now</span></a></p><div><hr></div><h3>Articles I enjoyed this week</h3><ul><li><p><a href="https://newsletter.systemdesign.one/p/how-api-gateway-works">How API Gateway Actually Work</a> by <span class="mention-wrap" data-attrs="{&quot;name&quot;:&quot;Neo Kim&quot;,&quot;id&quot;:135589200,&quot;type&quot;:&quot;user&quot;,&quot;url&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c103940f-0d8b-47e7-9a33-013202e17bb8_389x389.jpeg&quot;,&quot;uuid&quot;:&quot;719dfe9e-7f98-4166-b7c5-5e2b961bf7b7&quot;}" data-component-name="MentionToDOM"></span> </p></li><li><p><a href="https://blog.algomaster.io/p/database-types-for-system-design-interviews">10 Must-Know Database Types for System Design Interviews</a> by <span class="mention-wrap" data-attrs="{&quot;name&quot;:&quot;Ashish Pratap Singh&quot;,&quot;id&quot;:83602743,&quot;type&quot;:&quot;user&quot;,&quot;url&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bec4e97e-29d0-4080-b529-db1f5fc4d1d2_1536x1536.jpeg&quot;,&quot;uuid&quot;:&quot;eabe6c46-d402-4cc6-a06a-540cd76e66fa&quot;}" data-component-name="MentionToDOM"></span> </p></li><li><p><a href="https://newsletter.systemdesigncodex.com/p/essential-components-of-a-production">Essential Components of a Production-Ready Web Application</a> by <span class="mention-wrap" data-attrs="{&quot;name&quot;:&quot;Saurabh Dashora&quot;,&quot;id&quot;:97484183,&quot;type&quot;:&quot;user&quot;,&quot;url&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9626145f-2837-4635-becf-04a372de29e2_607x607.jpeg&quot;,&quot;uuid&quot;:&quot;3b54d7a8-ec8f-4ec8-848d-c400d4c6d410&quot;}" data-component-name="MentionToDOM"></span> </p></li><li><p><a href="https://thetshaped.dev/p/why-composition-beats-inheritance-react-projects-extensible-components">Why Composition Beats Inheritance In React</a> by <span class="mention-wrap" data-attrs="{&quot;name&quot;:&quot;Petar Ivanov&quot;,&quot;id&quot;:10269058,&quot;type&quot;:&quot;user&quot;,&quot;url&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b236a7ab-735e-49d2-bbe8-98b1f901b169_500x500.jpeg&quot;,&quot;uuid&quot;:&quot;93982974-3986-472a-a794-c78afce5c9c7&quot;}" data-component-name="MentionToDOM"></span> </p></li></ul><div><hr></div><p>Thank you for reading System Design Classroom. If you like this post, share it with your friends!</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.systemdesignclassroom.com/p/most-systems-get-consistency-wrong?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.systemdesignclassroom.com/p/most-systems-get-consistency-wrong?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><p></p>]]></content:encoded></item></channel></rss>