<?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[Level Up Coding System Design Newsletter]]></title><description><![CDATA[System Design made simple. Get our System Design Handbook for FREE on newsletter signup.]]></description><link>https://blog.levelupcoding.com</link><image><url>https://substackcdn.com/image/fetch/$s_!MHoh!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fedf87a9f-2fe8-4b79-a8a7-25f89f0b0cad_500x500.png</url><title>Level Up Coding System Design Newsletter</title><link>https://blog.levelupcoding.com</link></image><generator>Substack</generator><lastBuildDate>Sat, 25 Jul 2026 16:14:52 GMT</lastBuildDate><atom:link href="https://blog.levelupcoding.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Level Up Coding]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[lucsystemdesign@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[lucsystemdesign@substack.com]]></itunes:email><itunes:name><![CDATA[Nikki Siapno]]></itunes:name></itunes:owner><itunes:author><![CDATA[Nikki Siapno]]></itunes:author><googleplay:owner><![CDATA[lucsystemdesign@substack.com]]></googleplay:owner><googleplay:email><![CDATA[lucsystemdesign@substack.com]]></googleplay:email><googleplay:author><![CDATA[Nikki Siapno]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Vector Databases Clearly Explained]]></title><description><![CDATA[The mental model that makes vector databases click.]]></description><link>https://blog.levelupcoding.com/p/vector-databases-clearly-explained</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/vector-databases-clearly-explained</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Sat, 25 Jul 2026 13:32:58 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/ef38ad84-128a-4acb-9493-a2bf6e605359_2400x1261.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div><hr></div><h2><a href="https://lucode.co/ai-learning-hub-z7nlalhc1">Build AI Apps with MongoDB</a></h2><h5>Presented by MongoDB</h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Hlpw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Hlpw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png 424w, https://substackcdn.com/image/fetch/$s_!Hlpw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png 848w, https://substackcdn.com/image/fetch/$s_!Hlpw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png 1272w, https://substackcdn.com/image/fetch/$s_!Hlpw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Hlpw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png" width="1456" height="562" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:562,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:199786,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:&quot;&quot;,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.levelupcoding.com/i/182433036?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.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_!Hlpw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png 424w, https://substackcdn.com/image/fetch/$s_!Hlpw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png 848w, https://substackcdn.com/image/fetch/$s_!Hlpw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png 1272w, https://substackcdn.com/image/fetch/$s_!Hlpw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.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 aria-hidden="true" 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><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>Looking to stay ahead of the curve on AI? <strong><a href="https://lucode.co/ai-learning-hub-z7nlalhc1">MongoDB AI Learning Hub</a></strong> has the technical training pathways and tools you need to level up your AI app-building game. Explore practical guides, tutorials, and quick starts for all skill levels, from foundational concepts like understanding AI tool stacks to advanced implementations using RAG, Atlas Vector Search, and LLM optimization.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://lucode.co/ai-learning-hub-z7nlalhc1&quot;,&quot;text&quot;:&quot;Explore the AI Hub&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://lucode.co/ai-learning-hub-z7nlalhc1"><span>Explore the AI Hub</span></a></p><div><hr></div><h1>Vector Databases Clearly Explained</h1><p>Your users type a question in plain English.</p><p>Your search returns results that match the words but miss the meaning.</p><p>You add more keywords to the query, tune the weights, and it still feels wrong. Your search engine is treating meaning like a keyword problem.</p><p>And that&#8217;s the key difference: traditional databases search for matching values, while vector databases search for nearby meaning.</p><p>That distinction is the architectural shift behind modern AI-powered search.</p><h2>What a vector database actually stores</h2><p>A vector is just an ordered list of numbers, like <code>[0.12, -0.45, 0.89, ...]</code> stretched across hundreds or thousands of dimensions. An <strong>embedding</strong> is a vector produced by a machine learning model so that similar things end up close together.</p><p>For example, the sentences &#8220;reset my password&#8221; and &#8220;I forgot my login&#8221; may look different as text, but a good embedding model places them near each other because they mean similar things.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!CS7L!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb60bf495-b377-40ea-aef9-255980883f74_2000x822.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CS7L!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb60bf495-b377-40ea-aef9-255980883f74_2000x822.png 424w, https://substackcdn.com/image/fetch/$s_!CS7L!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb60bf495-b377-40ea-aef9-255980883f74_2000x822.png 848w, https://substackcdn.com/image/fetch/$s_!CS7L!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb60bf495-b377-40ea-aef9-255980883f74_2000x822.png 1272w, https://substackcdn.com/image/fetch/$s_!CS7L!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb60bf495-b377-40ea-aef9-255980883f74_2000x822.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!CS7L!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb60bf495-b377-40ea-aef9-255980883f74_2000x822.png" width="1456" height="598" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b60bf495-b377-40ea-aef9-255980883f74_2000x822.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:598,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:330191,&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://blog.levelupcoding.com/i/197293296?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb60bf495-b377-40ea-aef9-255980883f74_2000x822.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_!CS7L!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb60bf495-b377-40ea-aef9-255980883f74_2000x822.png 424w, https://substackcdn.com/image/fetch/$s_!CS7L!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb60bf495-b377-40ea-aef9-255980883f74_2000x822.png 848w, https://substackcdn.com/image/fetch/$s_!CS7L!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb60bf495-b377-40ea-aef9-255980883f74_2000x822.png 1272w, https://substackcdn.com/image/fetch/$s_!CS7L!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb60bf495-b377-40ea-aef9-255980883f74_2000x822.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 aria-hidden="true" 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><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>A regular database can store vectors, but a vector database is built to search them quickly, filter them safely, and rank them by similarity at scale.</p><p>A vector database stores those embeddings alongside useful context:</p><ul><li><p><strong>ID</strong> &#8594; The stable reference back to the original item.</p></li><li><p><strong>Vector</strong> &#8594; The embedding used for similarity search.</p></li><li><p><strong>Metadata</strong> &#8594; The fields used for filtering, permissions, and ranking.</p></li><li><p><strong>Source content</strong> &#8594; The original text, image, document, or a pointer to where it lives.</p></li></ul><p>That metadata matters because real searches rarely ask, &#8220;Find anything similar.&#8221; They ask, &#8220;Find similar support articles for this customer, in English, updated this year, that this user can access.&#8221;</p><p>So the vector database is not just matching meaning. It is combining similarity, filtering, and ranking into one retrieval path.</p><h2>How vector search works</h2><p>Traditional databases are great at exact lookups. You ask for <code>user_id = 123</code>, and the database finds that row.</p><p>Vector search is different.</p><p>You give the database a query vector, and it looks for nearby vectors. &#8220;Nearby&#8221; depends on the distance metric, which is the math rule used to compare vectors.</p><p>Common metrics include:</p><ul><li><p><strong>Cosine similarity &#8594; </strong>Compares vector direction, not size. Common for text embeddings because similar sentences can point the same way even with different magnitudes.</p></li><li><p><strong>Euclidean distance &#8594; </strong>Measures straight-line distance between vectors. The smaller the distance, the more similar the vectors.</p></li><li><p><strong>Dot product &#8594; </strong>Measures direction and magnitude together. Useful when the embedding model treats larger vector values as meaningful.</p></li></ul><p>Use the metric your embedding model expects.</p><p>If the model was trained for cosine similarity and you search with the wrong metric, relevance can drop even if the database is working correctly.</p><p>The embedding model defines the map. The vector database only helps you navigate 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_!tRIg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7e1ffff-1e9c-4406-a339-1ba5c2f8dd03_2000x825.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tRIg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7e1ffff-1e9c-4406-a339-1ba5c2f8dd03_2000x825.png 424w, https://substackcdn.com/image/fetch/$s_!tRIg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7e1ffff-1e9c-4406-a339-1ba5c2f8dd03_2000x825.png 848w, https://substackcdn.com/image/fetch/$s_!tRIg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7e1ffff-1e9c-4406-a339-1ba5c2f8dd03_2000x825.png 1272w, https://substackcdn.com/image/fetch/$s_!tRIg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7e1ffff-1e9c-4406-a339-1ba5c2f8dd03_2000x825.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tRIg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7e1ffff-1e9c-4406-a339-1ba5c2f8dd03_2000x825.png" width="1456" height="601" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f7e1ffff-1e9c-4406-a339-1ba5c2f8dd03_2000x825.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:601,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:357210,&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://blog.levelupcoding.com/i/197293296?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7e1ffff-1e9c-4406-a339-1ba5c2f8dd03_2000x825.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_!tRIg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7e1ffff-1e9c-4406-a339-1ba5c2f8dd03_2000x825.png 424w, https://substackcdn.com/image/fetch/$s_!tRIg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7e1ffff-1e9c-4406-a339-1ba5c2f8dd03_2000x825.png 848w, https://substackcdn.com/image/fetch/$s_!tRIg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7e1ffff-1e9c-4406-a339-1ba5c2f8dd03_2000x825.png 1272w, https://substackcdn.com/image/fetch/$s_!tRIg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7e1ffff-1e9c-4406-a339-1ba5c2f8dd03_2000x825.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 aria-hidden="true" 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><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><h2>Exact vs approximate search</h2><p>The simplest vector search is exact nearest-neighbor search.</p><p>The database takes your query vector, compares it against every stored vector, ranks the results, and returns the closest matches. It is accurate because nothing gets skipped.</p><p>But accuracy has a cost.</p><p>As the dataset grows, comparing against every vector becomes too slow and too expensive. Searching 10,000 vectors is manageable. Searching 100 million vectors this way is not.</p><p>That is why production vector databases usually use approximate nearest-neighbor search, or ANN. ANN does not promise to always find the mathematically closest results. Instead, it finds results that are close enough, much faster.</p><p>For example, a support chatbot does not always need the mathematically closest document. It needs a document that answers the user&#8217;s question quickly and reliably.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5kzb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F928b1a18-e2c3-4677-81fa-638d1835ae41_2000x1017.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5kzb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F928b1a18-e2c3-4677-81fa-638d1835ae41_2000x1017.png 424w, https://substackcdn.com/image/fetch/$s_!5kzb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F928b1a18-e2c3-4677-81fa-638d1835ae41_2000x1017.png 848w, https://substackcdn.com/image/fetch/$s_!5kzb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F928b1a18-e2c3-4677-81fa-638d1835ae41_2000x1017.png 1272w, https://substackcdn.com/image/fetch/$s_!5kzb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F928b1a18-e2c3-4677-81fa-638d1835ae41_2000x1017.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5kzb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F928b1a18-e2c3-4677-81fa-638d1835ae41_2000x1017.png" width="1456" height="740" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/928b1a18-e2c3-4677-81fa-638d1835ae41_2000x1017.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:740,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:540639,&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://blog.levelupcoding.com/i/197293296?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F928b1a18-e2c3-4677-81fa-638d1835ae41_2000x1017.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_!5kzb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F928b1a18-e2c3-4677-81fa-638d1835ae41_2000x1017.png 424w, https://substackcdn.com/image/fetch/$s_!5kzb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F928b1a18-e2c3-4677-81fa-638d1835ae41_2000x1017.png 848w, https://substackcdn.com/image/fetch/$s_!5kzb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F928b1a18-e2c3-4677-81fa-638d1835ae41_2000x1017.png 1272w, https://substackcdn.com/image/fetch/$s_!5kzb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F928b1a18-e2c3-4677-81fa-638d1835ae41_2000x1017.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 aria-hidden="true" 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><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>Most production vector databases use ANN as their default. The important nuance is that &#8220;ANN versus exact&#8221; is not a once-per-database choice; it can be a per-query decision.</p><p>Some systems fall back to exact search automatically when filters make the candidate set small enough. The database is not changing its philosophy. It is choosing the cheaper path for the query in front of it.</p><p>Approximate search works because the database builds an index ahead of time. The index gives the database a faster path through the vector space, so it does not need to scan everything for every query.</p><h2>How vector indexes speed up search</h2><p>A vector database does not always compare your query against every stored vector.</p><p>That would be accurate, but slow. As the dataset grows, the database needs a shortcut: an <strong>index</strong>, which is a data structure that narrows the search space so similar vectors can be found faster.</p><p>Different index types make different tradeoffs between <strong>speed</strong>, <strong>recall</strong>, and <strong>memory</strong>.</p><p>Recall means &#8220;how often the search returns the true nearest results.&#8221; Higher recall usually means better relevance, but it often costs more latency or memory.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!UNBF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9e5354f-a61a-4ac5-84a8-42b7ed0b3f45_2000x1349.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UNBF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9e5354f-a61a-4ac5-84a8-42b7ed0b3f45_2000x1349.png 424w, https://substackcdn.com/image/fetch/$s_!UNBF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9e5354f-a61a-4ac5-84a8-42b7ed0b3f45_2000x1349.png 848w, https://substackcdn.com/image/fetch/$s_!UNBF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9e5354f-a61a-4ac5-84a8-42b7ed0b3f45_2000x1349.png 1272w, https://substackcdn.com/image/fetch/$s_!UNBF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9e5354f-a61a-4ac5-84a8-42b7ed0b3f45_2000x1349.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UNBF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9e5354f-a61a-4ac5-84a8-42b7ed0b3f45_2000x1349.png" width="1456" height="982" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e9e5354f-a61a-4ac5-84a8-42b7ed0b3f45_2000x1349.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:982,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:532883,&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://blog.levelupcoding.com/i/197293296?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9e5354f-a61a-4ac5-84a8-42b7ed0b3f45_2000x1349.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_!UNBF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9e5354f-a61a-4ac5-84a8-42b7ed0b3f45_2000x1349.png 424w, https://substackcdn.com/image/fetch/$s_!UNBF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9e5354f-a61a-4ac5-84a8-42b7ed0b3f45_2000x1349.png 848w, https://substackcdn.com/image/fetch/$s_!UNBF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9e5354f-a61a-4ac5-84a8-42b7ed0b3f45_2000x1349.png 1272w, https://substackcdn.com/image/fetch/$s_!UNBF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9e5354f-a61a-4ac5-84a8-42b7ed0b3f45_2000x1349.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 aria-hidden="true" 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><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 practice, <strong>HNSW is the default workhorse</strong> because its speed-to-recall balance is strong for many production systems.</p><p>But it is not always the right answer.</p><p>When memory cost becomes the bottleneck, <strong>PQ or IVF-PQ can be a better fit</strong> because they shrink the vector footprint.</p><p>Choose based on your bottleneck: <strong>use HNSW when latency matters most; use PQ when memory cost matters most.</strong></p><h2>Production tradeoffs</h2><p>Vector databases look simple in demos.</p><p>You embed the data, store the vectors, run a search, and return the closest results. But production systems have more moving parts.</p><p>New records may not be searchable immediately. Indexes may build in the background. Replicas may lag behind writes. Metadata filters may also change the best search path for each query.</p><p>That is why a vector database should usually be treated as a retrieval index, not the main source of truth.</p><p>Keep the canonical data in your primary database. Store vectors as a derived view of that data.</p><p>This gives you room to rebuild indexes, change embedding models, recover from lag, and compare approximate results against an exact baseline.</p><p>A strong production setup tracks:</p><ul><li><p><strong>Model version</strong> &#8594; Embeddings from different models may not behave the same, so avoid mixing them without a migration plan.</p></li><li><p><strong>Write freshness</strong> &#8594; New or updated records may take time to appear in search, so the app should not assume instant visibility.</p></li><li><p><strong>Filter behavior</strong> &#8594; Metadata filters can speed up retrieval, but they can also make some queries slower depending on the index and candidate set.</p></li><li><p><strong>Recall and latency</strong> &#8594; Fast results do not help if the database misses the documents the user actually needs.</p></li><li><p><strong>Privacy risk</strong> &#8594; Embeddings are derived from data, but they can still reveal information about the original text, behavior, or documents.</p></li></ul><p>Keep the source of truth in your primary database, and use vectors as a searchable layer on top.</p><h2>When not to use a Vector Database</h2><p>A vector database is not the answer to every search problem.</p><p>Do not reach for one when exact structure matters more than similarity.</p><ul><li><p><strong>Exact transactional lookup</strong> &#8594; Use a relational or key-value database because IDs, constraints, and writes matter more than semantic closeness.</p></li><li><p><strong>Range queries</strong> &#8594; Use an ordered index because vector search organizes by similarity, not by business order.</p></li><li><p><strong>Small static datasets</strong> &#8594; Use brute-force search or a simple library because a full database may add unnecessary operational weight.</p></li><li><p><strong>Poor embeddings</strong> &#8594; Fix the model or data pipeline first because no index can rescue bad vector geometry.</p></li><li><p><strong>Strict fresh reads</strong> &#8594; Use a system with stronger consistency guarantees because some vector indexes update asynchronously.</p></li></ul><p>Vector databases shine when &#8220;close enough in meaning&#8221; is the right question. They struggle when the real question is &#8220;exactly this,&#8221; &#8220;strictly ordered,&#8221; or &#8220;immediately consistent.&#8221;</p><h2>Wrapping up</h2><p>Vector databases change what search can mean.</p><p>You no longer need users to type the exact words that appear in your data. You can search by meaning, similarity, behavior, or context.</p><p>But meaning-based search is only as good as the system around it. The embedding model shapes what &#8220;similar&#8221; means. The index controls the speed and accuracy tradeoff. The production setup determines whether results stay fresh, reliable, and safe.</p><p>Use vector databases when &#8220;nearby&#8221; is the right question. Use something else when &#8220;exact,&#8221; &#8220;ordered,&#8221; or &#8220;immediately consistent&#8221; matters more.</p><div><hr></div><p>&#128075; If you found this useful &#8594; Like + Restack to help others learn system design.</p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Subscribe to get high-signal, clear, and visual system design case studies, deep dives, and breakdowns straight to your inbox:&nbsp;</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[What Netflix Live Teaches Us About Building Reliable Systems]]></title><description><![CDATA[How does Netflix stream live events without crashing?]]></description><link>https://blog.levelupcoding.com/p/netflix-case-study-how-netflix-streams-live-events-without-crashing</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/netflix-case-study-how-netflix-streams-live-events-without-crashing</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Sat, 18 Jul 2026 14:46:05 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/6c6e3de6-ba5c-4a84-ab2f-57789387fead_2400x1260.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div><hr></div><h2><a href="https://lucode.co/hybrid-sast-article-checkmarx-z7nl">What If You Didn&#8217;t Have to Choose Between AI and Traditional SAST?</a></h2><h5>Presented by Checkmarx</h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_MqZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F665392a8-160e-495d-9368-b29556687ca4_2074x1026.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_MqZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F665392a8-160e-495d-9368-b29556687ca4_2074x1026.png 424w, https://substackcdn.com/image/fetch/$s_!_MqZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F665392a8-160e-495d-9368-b29556687ca4_2074x1026.png 848w, https://substackcdn.com/image/fetch/$s_!_MqZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F665392a8-160e-495d-9368-b29556687ca4_2074x1026.png 1272w, https://substackcdn.com/image/fetch/$s_!_MqZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F665392a8-160e-495d-9368-b29556687ca4_2074x1026.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_MqZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F665392a8-160e-495d-9368-b29556687ca4_2074x1026.png" width="1456" height="720" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/665392a8-160e-495d-9368-b29556687ca4_2074x1026.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:720,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:670853,&quot;alt&quot;:&quot;&quot;,&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://blog.levelupcoding.com/i/198543543?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F665392a8-160e-495d-9368-b29556687ca4_2074x1026.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_!_MqZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F665392a8-160e-495d-9368-b29556687ca4_2074x1026.png 424w, https://substackcdn.com/image/fetch/$s_!_MqZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F665392a8-160e-495d-9368-b29556687ca4_2074x1026.png 848w, https://substackcdn.com/image/fetch/$s_!_MqZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F665392a8-160e-495d-9368-b29556687ca4_2074x1026.png 1272w, https://substackcdn.com/image/fetch/$s_!_MqZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F665392a8-160e-495d-9368-b29556687ca4_2074x1026.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 aria-hidden="true" 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><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>Checkmarx One&#8217;s new <strong><a href="https://lucode.co/hybrid-sast-article-checkmarx-z7nl">Hybrid SAST engine</a></strong> combines deterministic rules with AI analysis to improve the quality of security findings before they reach developers. In Checkmarx&#8217;s published benchmark, the Hybrid engine achieved <strong>3x the industry&#8217;s average fidelity score while reducing false positives by 60%</strong>.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://lucode.co/hybrid-sast-article-checkmarx-z7nl&quot;,&quot;text&quot;:&quot;See the Results&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://lucode.co/hybrid-sast-article-checkmarx-z7nl"><span>See the Results</span></a></p><div><hr></div><h1>How Netflix Streams Live Events Without Crashing</h1><p><span>Why is live streaming so much harder than video on demand?</span></p><p><span>It&#8217;s not just because more people are watching.</span></p><p><span>It&#8217;s because live streaming removes the one thing on-demand systems rely on most: time.</span></p><p><span>With on-demand video, the content is already finished. Netflix has time to encode it, package it, test it, copy it to servers near viewers, and demand is spread out as people press play at different times.</span></p><p><span>Live has none of those luxuries.</span></p><p><span>The video exists only seconds before it has to reach the audience. Millions of viewers may arrive at the same time. A missing segment cannot be quietly fixed later. And if something goes wrong, every affected device may try to reconnect at once.</span></p><p><span>That changes the engineering problem.</span></p><p><span>Netflix isn&#8217;t just delivering video anymore. It&#8217;s building a system that has to survive unreliable venues, fluctuating networks, mismatched devices, regional traffic spikes, missing segments, retry storms, and operators making decisions while the event is still happening.</span></p><p><span>This is the story of how that system is built, and the more general lesson hiding inside it: at this scale, reliability comes from making failure predictable, contained, and recoverable.</span></p><h2><span>Live vs on-demand streaming</span></h2><p><span>On-demand streaming is hard, but it has one enormous advantage: the video is finished before anyone presses play.</span></p><p><span>Live streaming works differently.</span></p><p><span>The video is created while the audience is watching. A camera captures the event, production systems process the signal, the feed reaches the cloud, encoders create streamable versions, packagers prepare them for devices, origins expose the segments, the CDN distributes them, and players request the right piece at the right time; all running in seconds behind the actual live event.</span></p><p><span>When the benefits of on-demand streaming disappears, different failures start to matter:</span></p><ul><li><p><strong><span>No pre-computation </span></strong><span>&#8594; Encoding happens in real time, so there&#8217;s no batch window to hide mistakes.</span></p></li><li><p><strong><span>Synchronized demand </span></strong><span>&#8594; Everyone arrives near the start, so traffic spikes vertically instead of ramping up.</span></p></li><li><p><strong><span>No do-overs </span></strong><span>&#8594; A bad or missing segment reaches the audience immediately, so correctness has to happen the first time.</span></p></li><li><p><strong><span>Large blast radius </span></strong><span>&#8594; One overloaded component can hit millions of viewers at once.</span></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_!qwna!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b11993-d193-4011-b364-1aeb76696434_2000x706.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qwna!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b11993-d193-4011-b364-1aeb76696434_2000x706.png 424w, https://substackcdn.com/image/fetch/$s_!qwna!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b11993-d193-4011-b364-1aeb76696434_2000x706.png 848w, https://substackcdn.com/image/fetch/$s_!qwna!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b11993-d193-4011-b364-1aeb76696434_2000x706.png 1272w, https://substackcdn.com/image/fetch/$s_!qwna!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b11993-d193-4011-b364-1aeb76696434_2000x706.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qwna!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b11993-d193-4011-b364-1aeb76696434_2000x706.png" width="1456" height="514" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/05b11993-d193-4011-b364-1aeb76696434_2000x706.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:514,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:372687,&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://blog.levelupcoding.com/i/206780840?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b11993-d193-4011-b364-1aeb76696434_2000x706.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_!qwna!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b11993-d193-4011-b364-1aeb76696434_2000x706.png 424w, https://substackcdn.com/image/fetch/$s_!qwna!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b11993-d193-4011-b364-1aeb76696434_2000x706.png 848w, https://substackcdn.com/image/fetch/$s_!qwna!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b11993-d193-4011-b364-1aeb76696434_2000x706.png 1272w, https://substackcdn.com/image/fetch/$s_!qwna!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b11993-d193-4011-b364-1aeb76696434_2000x706.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 aria-hidden="true" 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><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><span>The hard part is that every layer has to work at the same time.</span></p><p><span>If the feed breaks, the cloud pipeline cannot recreate missing video.</span></p><p><span>If the origin cannot publish segments fast enough, the CDN has nothing useful to serve.</span></p><p><span>If players retry too aggressively, recovery traffic can become worse than the original failure.</span></p><p><span>So Netflix&#8217;s live architecture starts with a simple assumption: something will fail while the stream is running.</span></p><p><span>The system has to be ready before that happens.</span></p><h2><span>Getting the signal to the cloud</span></h2><p><span>The first hard problem isn&#8217;t the cloud. It&#8217;s the venue.</span></p><p><span>Live events happen in stadiums, theaters, arenas, studios, and temporary production sites. Some have strong connectivity and broadcast infrastructure. Many don&#8217;t. And if every venue becomes a custom networking project, every live event becomes a new integration risk.</span></p><p><span>For its first live comedy special, Netflix used two dedicated internet circuits from the venue and sent a high-quality mezzanine feed to the cloud.</span></p><p><span>It worked. But it exposed the real risk: every new venue could become its own custom integration.</span></p><p><span>So Netflix moved toward a hub-and-spoke model.</span></p><p><span>Instead of sending every production feed directly from the venue into the cloud, feeds first go to a well-connected broadcast facility. From there, they move into the cloud live pipeline.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!oroc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f31de07-c4a0-4c65-a90e-1b8cf8cba801_2000x878.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oroc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f31de07-c4a0-4c65-a90e-1b8cf8cba801_2000x878.png 424w, https://substackcdn.com/image/fetch/$s_!oroc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f31de07-c4a0-4c65-a90e-1b8cf8cba801_2000x878.png 848w, https://substackcdn.com/image/fetch/$s_!oroc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f31de07-c4a0-4c65-a90e-1b8cf8cba801_2000x878.png 1272w, https://substackcdn.com/image/fetch/$s_!oroc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f31de07-c4a0-4c65-a90e-1b8cf8cba801_2000x878.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!oroc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f31de07-c4a0-4c65-a90e-1b8cf8cba801_2000x878.png" width="1456" height="639" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1f31de07-c4a0-4c65-a90e-1b8cf8cba801_2000x878.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:639,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:347688,&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://blog.levelupcoding.com/i/206780840?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f31de07-c4a0-4c65-a90e-1b8cf8cba801_2000x878.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_!oroc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f31de07-c4a0-4c65-a90e-1b8cf8cba801_2000x878.png 424w, https://substackcdn.com/image/fetch/$s_!oroc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f31de07-c4a0-4c65-a90e-1b8cf8cba801_2000x878.png 848w, https://substackcdn.com/image/fetch/$s_!oroc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f31de07-c4a0-4c65-a90e-1b8cf8cba801_2000x878.png 1272w, https://substackcdn.com/image/fetch/$s_!oroc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f31de07-c4a0-4c65-a90e-1b8cf8cba801_2000x878.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 aria-hidden="true" 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><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><span>The venue becomes the spoke.</span></p><p><span>The broadcast facility becomes the hub.</span></p><p><span>That creates a stable boundary before the core system.</span></p><p><span>And that is the first useful pattern: when the outside world is messy, do not let every variation leak into your architecture. Put a predictable layer in front of it.</span></p><h2><span>Designing for the failure that </span><em><span>will</span></em><span> happen mid-stream</span></h2><p><span>Once the signal reaches the cloud, the next problem is failure during the stream.</span></p><p><span>On-demand video can recover from small network issues by retrying a stable file. Live streaming can&#8217;t rely on that.</span></p><p><span>If a packet drops during a title fight, comedy special, or live game, millions of viewers may see the glitch at roughly the same time. So the live pipeline has to assume something will fail while the event is still running, and keep going anyway.</span></p><p><span>Netflix handles this by sending each live feed into two separate cloud regions. Each region also receives the feed over two different managed network paths, instead of relying on the open internet.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6jjx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e3557ca-620c-4d00-aee3-07f1c522ba21_2000x878.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6jjx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e3557ca-620c-4d00-aee3-07f1c522ba21_2000x878.png 424w, https://substackcdn.com/image/fetch/$s_!6jjx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e3557ca-620c-4d00-aee3-07f1c522ba21_2000x878.png 848w, https://substackcdn.com/image/fetch/$s_!6jjx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e3557ca-620c-4d00-aee3-07f1c522ba21_2000x878.png 1272w, https://substackcdn.com/image/fetch/$s_!6jjx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e3557ca-620c-4d00-aee3-07f1c522ba21_2000x878.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6jjx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e3557ca-620c-4d00-aee3-07f1c522ba21_2000x878.png" width="1456" height="639" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2e3557ca-620c-4d00-aee3-07f1c522ba21_2000x878.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:639,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:314151,&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://blog.levelupcoding.com/i/206780840?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e3557ca-620c-4d00-aee3-07f1c522ba21_2000x878.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_!6jjx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e3557ca-620c-4d00-aee3-07f1c522ba21_2000x878.png 424w, https://substackcdn.com/image/fetch/$s_!6jjx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e3557ca-620c-4d00-aee3-07f1c522ba21_2000x878.png 848w, https://substackcdn.com/image/fetch/$s_!6jjx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e3557ca-620c-4d00-aee3-07f1c522ba21_2000x878.png 1272w, https://substackcdn.com/image/fetch/$s_!6jjx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e3557ca-620c-4d00-aee3-07f1c522ba21_2000x878.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 aria-hidden="true" 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><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><span>That gives Netflix four independent feed paths into the live pipeline.</span></p><p><span>At the packet level, Netflix uses SMPTE 2022-7, a broadcast standard for seamless protection switching. In simpler terms, the system receives duplicate packet streams and picks the best packets in real time. If one path drops packets, the other path can fill the gaps before viewers notice.</span></p><p><span>But the important idea is not simply &#8220;add more copies.&#8221;</span></p><p><span>The important idea is independence.</span></p><p><span>Two backups are not useful if they share the same failure mode.</span></p><ul><li><p><strong><span>Same cloud region</span></strong><span> &#8594; one regional outage can affect both copies.</span></p></li><li><p><strong><span>Same network path</span></strong><span> &#8594; one carrier or routing issue can affect both copies.</span></p></li><li><p><strong><span>Same storage backend</span></strong><span> &#8594; one datastore problem can affect both copies.</span></p></li><li><p><strong><span>Same deployment mistake</span></strong><span> &#8594; one bad rollout can affect both copies.</span></p></li></ul><p><span>Netflix is not just duplicating the stream. It&#8217;s reducing shared failure modes across regions, network paths, and feed candidates.</span></p><p><span>That distinction matters.</span></p><p><span>Not more copies. More independent copies.</span></p><h2><span>The stream still has to work for everyone</span></h2><p><span>Getting a reliable feed into the cloud is only the first part of the problem.</span></p><p><span>Now Netflix has to turn that feed into something viewers can actually watch.</span></p><p><span>A viewer on fiber with a 4K TV shouldn&#8217;t get the same stream as someone on a weak mobile connection. This is where adaptive bitrate streaming comes in: the player switches between quality levels as network conditions change.</span></p><p><span>Netflix tunes its bitrate ladder based on resolution, frame rate, and content complexity. Fast-motion events, like WWE, need higher bitrates because motion is harder to compress cleanly.</span></p><p><span>But quality is not the only constraint.</span></p><p><span>Netflix also has to support a large device ecosystem. Different devices may need different video, audio, language, and caption formats. Older devices may not support newer formats.</span></p><p><span>That device compatibility problem is easy to underestimate.</span></p><p><span>Netflix cannot assume viewers will upgrade their hardware for a live event. The system has to work on the devices people already use.</span></p><p><span>That is one reason Netflix uses HTTPS-based live streaming with 2-second segments. HTTPS is widely supported and fits the delivery infrastructure Netflix already runs.</span></p><p><span>The tradeoff is latency.</span></p><p><span>UDP-based protocols can deliver lower latency, but they are harder to support across every device and network.</span></p><p><span>Netflix chooses reach and stability over the lowest possible delay.</span></p><p><span>That is a recurring pattern in their architecture: the best technical choice is not always the fastest one.</span></p><p><span>Sometimes it&#8217;s the one that works reliably across the messy reality of production.</span></p><h2><span>The better move is not always a new stack</span></h2><p><span>A common mistake in new architecture is rebuilding too much.</span></p><p><span>Netflix didn&#8217;t build a separate live playback stack from scratch. It built custom live components only where it had to, then connected them to systems that already worked for on-demand.</span></p><p><span>The live packager is the best example.</span></p><p><span>Netflix built its own packager so live streams could integrate with existing playback systems, device compatibility work, captions, and Digital Rights Management.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!D3N5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84416cb3-0d86-4c35-94d5-f83ebf2c84ae_2000x933.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!D3N5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84416cb3-0d86-4c35-94d5-f83ebf2c84ae_2000x933.png 424w, https://substackcdn.com/image/fetch/$s_!D3N5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84416cb3-0d86-4c35-94d5-f83ebf2c84ae_2000x933.png 848w, https://substackcdn.com/image/fetch/$s_!D3N5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84416cb3-0d86-4c35-94d5-f83ebf2c84ae_2000x933.png 1272w, https://substackcdn.com/image/fetch/$s_!D3N5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84416cb3-0d86-4c35-94d5-f83ebf2c84ae_2000x933.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!D3N5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84416cb3-0d86-4c35-94d5-f83ebf2c84ae_2000x933.png" width="1456" height="679" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/84416cb3-0d86-4c35-94d5-f83ebf2c84ae_2000x933.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:679,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:292734,&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://blog.levelupcoding.com/i/206780840?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84416cb3-0d86-4c35-94d5-f83ebf2c84ae_2000x933.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_!D3N5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84416cb3-0d86-4c35-94d5-f83ebf2c84ae_2000x933.png 424w, https://substackcdn.com/image/fetch/$s_!D3N5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84416cb3-0d86-4c35-94d5-f83ebf2c84ae_2000x933.png 848w, https://substackcdn.com/image/fetch/$s_!D3N5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84416cb3-0d86-4c35-94d5-f83ebf2c84ae_2000x933.png 1272w, https://substackcdn.com/image/fetch/$s_!D3N5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84416cb3-0d86-4c35-94d5-f83ebf2c84ae_2000x933.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 aria-hidden="true" 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><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><span>That avoided years of repeated compatibility work across Netflix&#8217;s device ecosystem.</span></p><p><span>This is the quieter architectural decision, but it is one of the most useful.</span></p><p><span>Instead of building a parallel live stack, Netflix used the packager as an adapter into proven infrastructure.</span></p><p><span>New requirements often don&#8217;t need a new stack beside the old one. They need the adapter that lets them reuse the stack that already works.</span></p><p><span>The packager does one more quiet but important thing: it generates segment templates for Netflix&#8217;s PlayAPI backend. A segment template lets the player calculate the next segment URL from the current time, instead of repeatedly asking the backend what comes next.</span></p><p><span>That sounds small, but at live-event scale it matters.</span></p><p><span>If millions of devices constantly ask the control plane for the next segment, the backend becomes a bottleneck. Segment templates remove that coordination by letting each device calculate the answer locally.</span></p><p><span>At scale, client behavior becomes infrastructure behavior.</span></p><h2><span>Static storage is not enough for live video</span></h2><p><span>Static storage sounds like a perfectly reasonable origin; at first.</span></p><p><span>The packager writes segments into storage. The CDN reads from storage. With two regions cross-publishing, the CDN even has multiple candidates to choose from.</span></p><p><span>But live streaming puts pressure on storage that generic object stores weren&#8217;t built for.</span></p><p><span>Netflix&#8217;s early live pipeline used static storage buckets in AWS, with one bucket in each region. Packagers published segments to both buckets, giving the CDN multiple segment candidates.</span></p><p><span>That improved redundancy, but it did not solve the deeper problem.</span></p><p><span>Generic storage does not understand media quality.</span></p><p><span>A segment can exist and still be bad. It might be too short, miss frames, or have timing issues. A storage bucket can confirm the object exists, but it can&#8217;t decide whether one candidate is better than another.</span></p><p><span>So Netflix built a custom Live Origin.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nBof!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e75e7da-81f6-4af7-84c6-4d56663c30d1_2000x669.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nBof!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e75e7da-81f6-4af7-84c6-4d56663c30d1_2000x669.png 424w, https://substackcdn.com/image/fetch/$s_!nBof!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e75e7da-81f6-4af7-84c6-4d56663c30d1_2000x669.png 848w, https://substackcdn.com/image/fetch/$s_!nBof!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e75e7da-81f6-4af7-84c6-4d56663c30d1_2000x669.png 1272w, https://substackcdn.com/image/fetch/$s_!nBof!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e75e7da-81f6-4af7-84c6-4d56663c30d1_2000x669.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nBof!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e75e7da-81f6-4af7-84c6-4d56663c30d1_2000x669.png" width="1456" height="487" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6e75e7da-81f6-4af7-84c6-4d56663c30d1_2000x669.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:487,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:271638,&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://blog.levelupcoding.com/i/206780840?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e75e7da-81f6-4af7-84c6-4d56663c30d1_2000x669.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_!nBof!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e75e7da-81f6-4af7-84c6-4d56663c30d1_2000x669.png 424w, https://substackcdn.com/image/fetch/$s_!nBof!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e75e7da-81f6-4af7-84c6-4d56663c30d1_2000x669.png 848w, https://substackcdn.com/image/fetch/$s_!nBof!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e75e7da-81f6-4af7-84c6-4d56663c30d1_2000x669.png 1272w, https://substackcdn.com/image/fetch/$s_!nBof!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e75e7da-81f6-4af7-84c6-4d56663c30d1_2000x669.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 aria-hidden="true" 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><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><span>The Live Origin sits between the cloud live pipelines and Open Connect, Netflix&#8217;s CDN. It acts as a broker that decides which content reaches the CDN and, eventually, client devices. Because it understands multiple pipelines and regions, it can choose valid segment candidates instead of treating every stored object as equal.</span></p><p><span>That&#8217;s the important difference.</span></p><p><span>The origin stops being passive storage and becomes a media-aware decision point.</span></p><h2><span>The CDN absorbs synchronized demand</span></h2><p><span>Once the live segments exist, Netflix still has to deliver them to viewers around the world.</span></p><p><span>This is where Open Connect helps.</span></p><p><span>Netflix uses Open Connect, its own content delivery network, for live delivery. Open Connect servers are placed close to viewers at over 6,000 locations and connect back to AWS locations through a dedicated Open Connect backbone network.</span></p><p><span>This matters because live traffic is synchronized.</span></p><p><span>For a major event, viewers don&#8217;t trickle in throughout the day; they cluster around the same start time, in the same regions, on the same title. If every device had to reach back to a handful of cloud origins, the origin layer would be overwhelmed almost instantly.</span></p><p><span>Open Connect gives Netflix an enormous delivery surface close to viewers.</span></p><p><span>It also lets live reuse the same distribution layer as on-demand; which improves infrastructure usage and makes catch-up viewing simpler, since past live segments can sit on the same servers that already serve recorded content.</span></p><p><span>Again, the trick is not rebuilding everything.</span></p><p><span>The better approach is to use proven architecture where the new workload fits.</span></p><h2><span>The architecture is a chain of reliability decisions</span></h2><p><span>Netflix&#8217;s live system is not built around one clever trick.</span></p><p><span>It&#8217;s a chain of decisions that make the system easier to recover when something goes wrong.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!EoSO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff65b445-34e3-40f7-a3f2-ace7a1ab48b4_2000x1581.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EoSO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff65b445-34e3-40f7-a3f2-ace7a1ab48b4_2000x1581.png 424w, https://substackcdn.com/image/fetch/$s_!EoSO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff65b445-34e3-40f7-a3f2-ace7a1ab48b4_2000x1581.png 848w, https://substackcdn.com/image/fetch/$s_!EoSO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff65b445-34e3-40f7-a3f2-ace7a1ab48b4_2000x1581.png 1272w, https://substackcdn.com/image/fetch/$s_!EoSO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff65b445-34e3-40f7-a3f2-ace7a1ab48b4_2000x1581.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!EoSO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff65b445-34e3-40f7-a3f2-ace7a1ab48b4_2000x1581.png" width="1456" height="1151" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ff65b445-34e3-40f7-a3f2-ace7a1ab48b4_2000x1581.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1151,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:598917,&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://blog.levelupcoding.com/i/206780840?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff65b445-34e3-40f7-a3f2-ace7a1ab48b4_2000x1581.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_!EoSO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff65b445-34e3-40f7-a3f2-ace7a1ab48b4_2000x1581.png 424w, https://substackcdn.com/image/fetch/$s_!EoSO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff65b445-34e3-40f7-a3f2-ace7a1ab48b4_2000x1581.png 848w, https://substackcdn.com/image/fetch/$s_!EoSO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff65b445-34e3-40f7-a3f2-ace7a1ab48b4_2000x1581.png 1272w, https://substackcdn.com/image/fetch/$s_!EoSO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff65b445-34e3-40f7-a3f2-ace7a1ab48b4_2000x1581.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 aria-hidden="true" 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><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><span>The pattern isn&#8217;t &#8220;move live streaming to the cloud.&#8221; It&#8217;s: stabilize messy inputs, duplicate paths independently, reuse mature systems, and cut unnecessary coordination.</span></p><p><span>Notice the pattern behind every decision so far: each layer is designed around the assumption that something will go wrong.</span></p><p><span>A pipeline that works theoretically is not the same as a system that survives a live audience. The rest of the reliability story is about the moment something breaks; during the event, in front of everyone, with no time to think.</span></p><h2><span>Testing before the audience arrives</span></h2><p><span>Live systems are hard to test because the real traffic often does not exist until the event begins.</span></p><p><span>For on-demand streaming, Netflix could rely on canary releases and A/B tests using normal viewer traffic.</span></p><p><span>Live streaming changed that.</span></p><p><span>So Netflix built internal test streams, synthetic load tests, and automated failure injection.</span></p><p><span>Its synthetic load testing can generate up to 100,000 playback starts per second by replaying previous live traffic or simulating Netflix devices against cloud and CDN endpoints.</span></p><p><span>But load is only half the story.</span></p><p><span>Netflix also injects failures such as missing segments, corrupted video, cloud region outages, network drops, and server timeouts. The goal isn&#8217;t only to prove the system works. It&#8217;s to prove it fails in predictable ways.</span></p><p><span>That lesson applies to any distributed system.</span></p><p><span>Do not only test whether your system can handle peak load.</span></p><p><span>Test what happens when parts of it fail.</span></p><p><span>A system that degrades gracefully is much easier to operate than one that tries to preserve every feature until it collapses.</span></p><h2><span>Graceful degradation means choosing what matters</span></h2><p><span>When demand exceeds predictions, Netflix does not treat every request equally.</span></p><p><span>The live stream is the priority.</span></p><p><span>Other features may improve the experience, but they are not worth sacrificing playback.</span></p><p><span>So Netflix uses load shedding: intentionally delaying or rejecting lower-priority work so the critical service stays up. That&#8217;s graceful degradation in practice, the system doesn&#8217;t pretend everything is fine. It decides what matters most.</span></p><ul><li><p><strong><span>Live</span></strong><span> </span><strong><span>playback</span></strong><span> &#8594; protect this first because it is the core user experience.</span></p></li><li><p><strong><span>Prefetching</span></strong><span> &#8594; shed this early because it improves performance but is not essential.</span></p></li><li><p><strong><span>Personalization</span></strong><span> &#8594; scale it back because the event can still play without every customized feature.</span></p></li><li><p><strong><span>Video</span></strong><span> </span><strong><span>quality</span></strong><span> &#8594; lower it if needed because a lower-resolution stream is better than no stream.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lZr0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c51af6a-651e-4b8e-9ab1-ea56a8646786_2000x755.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lZr0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c51af6a-651e-4b8e-9ab1-ea56a8646786_2000x755.png 424w, https://substackcdn.com/image/fetch/$s_!lZr0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c51af6a-651e-4b8e-9ab1-ea56a8646786_2000x755.png 848w, https://substackcdn.com/image/fetch/$s_!lZr0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c51af6a-651e-4b8e-9ab1-ea56a8646786_2000x755.png 1272w, https://substackcdn.com/image/fetch/$s_!lZr0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c51af6a-651e-4b8e-9ab1-ea56a8646786_2000x755.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!lZr0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c51af6a-651e-4b8e-9ab1-ea56a8646786_2000x755.png" width="1456" height="550" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1c51af6a-651e-4b8e-9ab1-ea56a8646786_2000x755.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:550,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:668397,&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://blog.levelupcoding.com/i/206780840?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c51af6a-651e-4b8e-9ab1-ea56a8646786_2000x755.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_!lZr0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c51af6a-651e-4b8e-9ab1-ea56a8646786_2000x755.png 424w, https://substackcdn.com/image/fetch/$s_!lZr0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c51af6a-651e-4b8e-9ab1-ea56a8646786_2000x755.png 848w, https://substackcdn.com/image/fetch/$s_!lZr0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c51af6a-651e-4b8e-9ab1-ea56a8646786_2000x755.png 1272w, https://substackcdn.com/image/fetch/$s_!lZr0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c51af6a-651e-4b8e-9ab1-ea56a8646786_2000x755.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 aria-hidden="true" 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><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><span>You&#8217;ll see this pattern appear well beyond streaming.</span></p><p><span>When capacity is limited, do not try to preserve every feature.</span></p><p><span>Decide what matters most, protect it, and let less critical functionality degrade gracefully.</span></p><p><span>A slightly lighter experience beats a broken one.</span></p><h2><span>Retry storms can turn recovery into the outage</span></h2><p><span>Even a well-provisioned system can meet moments it did not fully predict.</span></p><p><span>Live streaming has a particularly nasty one: retry storms.</span></p><p><span>Netflix has seen traffic spike by 10&#215; when a disruption of just 30 seconds causes millions of devices to reconnect at the same time.</span></p><p><span>That is the dangerous part.</span></p><p><span>The original problem may be small.</span></p><p><span>But if every client retries at once, the recovery attempt becomes a second, larger outage.</span></p><p><span>To prevent this, Netflix studied how devices retry and added server-guided backoff, prioritized load shedding at the Cloud Edge Gateway, and traffic rebalancing across regions.</span></p><p><span>Server-guided backoff means the server tells clients when to retry, instead of letting every device decide on its own.</span></p><p><span>It worked because Netflix treated clients as part of the distributed system. If clients retry aggressively, the backend pays for it. If they retry in a controlled way, the system gets the breathing room to recover.</span></p><p><span>That&#8217;s why exponential backoff, jitter, idempotent operations, and priority-aware request rejection aren&#8217;t just implementation details. They&#8217;re core reliability mechanisms.</span></p><h2><span>Live systems are operated, not just deployed</span></h2><p><span>The final layer is human.</span></p><p><span>Live events compress decision-making time.</span></p><p><span>If something breaks during an on-demand launch, teams can often roll back, investigate, and communicate over a comfortable window. If something breaks during a live fight, comedy special, or game, the event keeps moving. The system needs clear ownership before the failure happens.</span></p><p><span>So Netflix&#8217;s live operations include in-person launch rooms for large events, engineering owners for critical systems, early-warning metrics, runbooks, and Game Day exercises. The runbooks extend beyond engineering into customer service, production, communications, social, and executive escalation.</span></p><p><span>Netflix also built Control Room, a UI for live operations. Operators use it to monitor and control the redundant dual-region architecture, start encoding pipelines, hit failover controls, redirect traffic to a healthy region within seconds, and move viewers out of a stream when an event ends.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QSnl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3486d34-fead-429e-963a-239435b97eb2_2000x832.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QSnl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3486d34-fead-429e-963a-239435b97eb2_2000x832.png 424w, https://substackcdn.com/image/fetch/$s_!QSnl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3486d34-fead-429e-963a-239435b97eb2_2000x832.png 848w, https://substackcdn.com/image/fetch/$s_!QSnl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3486d34-fead-429e-963a-239435b97eb2_2000x832.png 1272w, https://substackcdn.com/image/fetch/$s_!QSnl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3486d34-fead-429e-963a-239435b97eb2_2000x832.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QSnl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3486d34-fead-429e-963a-239435b97eb2_2000x832.png" width="1456" height="606" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f3486d34-fead-429e-963a-239435b97eb2_2000x832.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:606,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:269354,&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://blog.levelupcoding.com/i/206780840?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3486d34-fead-429e-963a-239435b97eb2_2000x832.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_!QSnl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3486d34-fead-429e-963a-239435b97eb2_2000x832.png 424w, https://substackcdn.com/image/fetch/$s_!QSnl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3486d34-fead-429e-963a-239435b97eb2_2000x832.png 848w, https://substackcdn.com/image/fetch/$s_!QSnl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3486d34-fead-429e-963a-239435b97eb2_2000x832.png 1272w, https://substackcdn.com/image/fetch/$s_!QSnl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3486d34-fead-429e-963a-239435b97eb2_2000x832.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 aria-hidden="true" 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><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><span>This is where many architectures break down.</span></p><p><span>They focus on components but not control.</span></p><p><span>A reliable system needs both.</span></p><h2><span>The takeaway</span></h2><p><span>The interesting thing about Netflix&#8217;s live architecture is what it does </span><em><span>not</span></em><span> rely on.</span></p><p><span>It does not assume every venue will be perfect.</span></p><p><span>It does not assume every network path will stay healthy.</span></p><p><span>It does not assume every segment candidate is equally good.</span></p><p><span>And it does not assume humans can improvise their way through a major outage while millions of people are watching.</span></p><p><span>Instead, Netflix makes failure cheaper.</span></p><p><span>Independent paths reduce shared blast radius. Interchangeable segments let the system switch over without negotiation. Degradation ladders help it bend instead of snap. Rehearsed operations turn a crisis into a practiced plan, not an improvisation.</span></p><p><span>Live streaming is a harder problem than video on demand not because it&#8217;s harder to send, but because you lose the ability to retry, to pre-compute, and to spread the load. Once those cushions are gone, &#8220;reliable&#8221; can&#8217;t mean &#8220;never breaks.&#8221;</span></p><p><span>So it has to mean something else.</span></p><p><span>Netflix didn&#8217;t spend all their effort trying to prevent failure. They spent it making failure predictable, contained, and recoverable.</span></p><p><span>Because at this scale, the difference between a great system and a viral outage is how gracefully it handles the moment something goes wrong.</span></p><div><hr></div><p>&#128075; If you found this useful &#8594; Like + Restack to help others learn system design.</p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Subscribe to get high-signal, clear, and visual system design case studies, deep dives, and breakdowns straight to your inbox:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[RAG Clearly Explained]]></title><description><![CDATA[The mental model every engineer should have.]]></description><link>https://blog.levelupcoding.com/p/rag-clearly-explained</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/rag-clearly-explained</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Wed, 15 Jul 2026 14:15:13 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/e9425991-fbe8-4911-a057-c86fc56d3a4e_2400x1260.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div><hr></div><h2><a href="https://lucode.co/anam-cara-4-z7nl">Photorealistic Faces for AI Agents. 44% More Usage.</a></h2><h5>Presented by Anam</h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LRrS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c28e70-0bfc-4c04-b258-922341554409_2359x999.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LRrS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c28e70-0bfc-4c04-b258-922341554409_2359x999.png 424w, https://substackcdn.com/image/fetch/$s_!LRrS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c28e70-0bfc-4c04-b258-922341554409_2359x999.png 848w, https://substackcdn.com/image/fetch/$s_!LRrS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c28e70-0bfc-4c04-b258-922341554409_2359x999.png 1272w, https://substackcdn.com/image/fetch/$s_!LRrS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c28e70-0bfc-4c04-b258-922341554409_2359x999.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LRrS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c28e70-0bfc-4c04-b258-922341554409_2359x999.png" width="1456" height="617" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/99c28e70-0bfc-4c04-b258-922341554409_2359x999.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:617,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:955421,&quot;alt&quot;:&quot;&quot;,&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://blog.levelupcoding.com/i/198543543?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c28e70-0bfc-4c04-b258-922341554409_2359x999.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_!LRrS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c28e70-0bfc-4c04-b258-922341554409_2359x999.png 424w, https://substackcdn.com/image/fetch/$s_!LRrS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c28e70-0bfc-4c04-b258-922341554409_2359x999.png 848w, https://substackcdn.com/image/fetch/$s_!LRrS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c28e70-0bfc-4c04-b258-922341554409_2359x999.png 1272w, https://substackcdn.com/image/fetch/$s_!LRrS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c28e70-0bfc-4c04-b258-922341554409_2359x999.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 aria-hidden="true" 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><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><a href="https://lucode.co/anam-cara-4-z7nl">Anam</a></strong> gives AI agents a photorealistic face, increasing usage by 44% on average. For many use cases, a face is a far more natural way to interact with AI than chat or voice , think sales agents, recruitment screens, and interactive learning. $5,000 for the best demo built with Cara-4, July 14&#8211;26.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://lucode.co/anam-cara-4-z7nl&quot;,&quot;text&quot;:&quot;Start Building for Free&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://lucode.co/anam-cara-4-z7nl"><span>Start Building for Free</span></a></p><div><hr></div><h1>RAG Clearly Explained</h1><p><span>Your model can explain concepts from years ago but struggle with last month&#8217;s product launch or your company&#8217;s internal docs. The problem isn't the model. It's that its knowledge is frozen in its training data.</span></p><p><span>As teams started connecting LLMs to internal knowledge bases, support documentation, and constantly changing business data, keeping answers up to date became a new challenge.</span></p><p><span>Retrieval-Augmented Generation (RAG) solves this by retrieving relevant information at query time and providing it to the model as context. That keeps answers current without retraining.</span></p><h2><span>What RAG actually is</span></h2><p><span>RAG is a system pattern for giving an LLM the right context before it answers.</span></p><p><span>Instead of asking the model to rely only on what it learned during training, the application first retrieves relevant information from external sources. Then it passes that information to the model so the answer is grounded in real information.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Liax!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa25d5ab0-be34-4e61-8009-512684f8c7f8_2000x880.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Liax!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa25d5ab0-be34-4e61-8009-512684f8c7f8_2000x880.png 424w, https://substackcdn.com/image/fetch/$s_!Liax!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa25d5ab0-be34-4e61-8009-512684f8c7f8_2000x880.png 848w, https://substackcdn.com/image/fetch/$s_!Liax!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa25d5ab0-be34-4e61-8009-512684f8c7f8_2000x880.png 1272w, https://substackcdn.com/image/fetch/$s_!Liax!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa25d5ab0-be34-4e61-8009-512684f8c7f8_2000x880.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Liax!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa25d5ab0-be34-4e61-8009-512684f8c7f8_2000x880.png" width="1456" height="641" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a25d5ab0-be34-4e61-8009-512684f8c7f8_2000x880.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:641,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:503105,&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://blog.levelupcoding.com/i/203503308?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa25d5ab0-be34-4e61-8009-512684f8c7f8_2000x880.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_!Liax!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa25d5ab0-be34-4e61-8009-512684f8c7f8_2000x880.png 424w, https://substackcdn.com/image/fetch/$s_!Liax!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa25d5ab0-be34-4e61-8009-512684f8c7f8_2000x880.png 848w, https://substackcdn.com/image/fetch/$s_!Liax!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa25d5ab0-be34-4e61-8009-512684f8c7f8_2000x880.png 1272w, https://substackcdn.com/image/fetch/$s_!Liax!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa25d5ab0-be34-4e61-8009-512684f8c7f8_2000x880.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 aria-hidden="true" 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><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><span>That distinction matters because RAG is often confused with related ideas:</span></p><ul><li><p><strong><span>RAG vs fine-tuning</span></strong><span> &#8594; Fine-tuning changes the model&#8217;s weights. RAG keeps the model the same and brings in fresh information at runtime.</span></p></li><li><p><strong><span>RAG vs plain search</span></strong><span> &#8594; Search returns documents. RAG uses those documents to generate a clear answer.</span></p></li><li><p><strong><span>RAG vs vector search</span></strong><span> &#8594; Vector search is one retrieval method. RAG can also use keyword search, SQL queries, graph traversal, or other data access patterns.</span></p></li></ul><p><span>The retrieval step can be simple or advanced. The model might retrieve once before answering, or retrieve again as the answer develops.</span></p><p><span>The core idea is simple: find the right information first, then let the model answer with that information in context.</span></p><h2><span>How RAG works</span></h2><p><span>A RAG system has two flows: one for preparing knowledge and one for answering questions.</span></p><p><span>The preparation flow happens before any user query. Documents are extracted, cleaned, split into chunks, enriched with metadata, and stored in a searchable index.</span></p><p><span>A chunk is a small piece of content, such as a paragraph, section, or code block. Instead of searching an entire document, the system searches these smaller pieces, making it easier to find the exact information a user is looking for.</span></p><p><span>When a user asks a question, the query flow begins. The system retrieves relevant chunks, filters them, optionally reranks them, and passes the best information to the model as context.</span></p><p><span>Here is a typical request flow using Basic RAG and Vector Retrieval:</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Trlr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c0215ad-4f6a-485c-8776-7fcbe10c5f5f_2000x1134.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Trlr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c0215ad-4f6a-485c-8776-7fcbe10c5f5f_2000x1134.png 424w, https://substackcdn.com/image/fetch/$s_!Trlr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c0215ad-4f6a-485c-8776-7fcbe10c5f5f_2000x1134.png 848w, https://substackcdn.com/image/fetch/$s_!Trlr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c0215ad-4f6a-485c-8776-7fcbe10c5f5f_2000x1134.png 1272w, https://substackcdn.com/image/fetch/$s_!Trlr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c0215ad-4f6a-485c-8776-7fcbe10c5f5f_2000x1134.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Trlr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c0215ad-4f6a-485c-8776-7fcbe10c5f5f_2000x1134.png" width="1456" height="826" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4c0215ad-4f6a-485c-8776-7fcbe10c5f5f_2000x1134.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:826,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:446155,&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://blog.levelupcoding.com/i/203503308?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c0215ad-4f6a-485c-8776-7fcbe10c5f5f_2000x1134.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_!Trlr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c0215ad-4f6a-485c-8776-7fcbe10c5f5f_2000x1134.png 424w, https://substackcdn.com/image/fetch/$s_!Trlr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c0215ad-4f6a-485c-8776-7fcbe10c5f5f_2000x1134.png 848w, https://substackcdn.com/image/fetch/$s_!Trlr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c0215ad-4f6a-485c-8776-7fcbe10c5f5f_2000x1134.png 1272w, https://substackcdn.com/image/fetch/$s_!Trlr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c0215ad-4f6a-485c-8776-7fcbe10c5f5f_2000x1134.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 aria-hidden="true" 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><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><span>RAG is not a single model call. It is an information pipeline that finds the right information before the model starts generating.</span></p><h2><span>Main types of RAG</span></h2><p><span>Not all RAG systems work the same way. The biggest differences are how information is retrieved and how much reasoning happens before an answer is generated.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!MpzR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a51c4d1-1386-4b77-ab77-4f551800dfbb_2000x688.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MpzR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a51c4d1-1386-4b77-ab77-4f551800dfbb_2000x688.png 424w, https://substackcdn.com/image/fetch/$s_!MpzR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a51c4d1-1386-4b77-ab77-4f551800dfbb_2000x688.png 848w, https://substackcdn.com/image/fetch/$s_!MpzR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a51c4d1-1386-4b77-ab77-4f551800dfbb_2000x688.png 1272w, https://substackcdn.com/image/fetch/$s_!MpzR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a51c4d1-1386-4b77-ab77-4f551800dfbb_2000x688.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MpzR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a51c4d1-1386-4b77-ab77-4f551800dfbb_2000x688.png" width="1456" height="501" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2a51c4d1-1386-4b77-ab77-4f551800dfbb_2000x688.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:501,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:387102,&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://blog.levelupcoding.com/i/203503308?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a51c4d1-1386-4b77-ab77-4f551800dfbb_2000x688.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_!MpzR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a51c4d1-1386-4b77-ab77-4f551800dfbb_2000x688.png 424w, https://substackcdn.com/image/fetch/$s_!MpzR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a51c4d1-1386-4b77-ab77-4f551800dfbb_2000x688.png 848w, https://substackcdn.com/image/fetch/$s_!MpzR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a51c4d1-1386-4b77-ab77-4f551800dfbb_2000x688.png 1272w, https://substackcdn.com/image/fetch/$s_!MpzR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a51c4d1-1386-4b77-ab77-4f551800dfbb_2000x688.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 aria-hidden="true" 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><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><span>For most teams, Basic RAG is the best place to start. It is easier to build, observe, and debug.</span></p><p><span>Agentic RAG becomes useful when a question requires multiple lookups or reasoning steps. For example: &#8220;Compare this customer&#8217;s contract with our refund policy and draft a response.&#8221;</span></p><p><span>That request may require several document lookups, comparisons, and reasoning steps before an answer can be generated.</span></p><h3><span>Retrieval methods</span></h3><p><span>Many teams hear &#8220;RAG&#8221; and immediately think &#8220;vector databases.&#8221; In reality, vector search is just one way to retrieve information.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RkTW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d05a820-9ed5-4ff8-9819-a618cee394f5_2000x1014.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RkTW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d05a820-9ed5-4ff8-9819-a618cee394f5_2000x1014.png 424w, https://substackcdn.com/image/fetch/$s_!RkTW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d05a820-9ed5-4ff8-9819-a618cee394f5_2000x1014.png 848w, https://substackcdn.com/image/fetch/$s_!RkTW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d05a820-9ed5-4ff8-9819-a618cee394f5_2000x1014.png 1272w, https://substackcdn.com/image/fetch/$s_!RkTW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d05a820-9ed5-4ff8-9819-a618cee394f5_2000x1014.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RkTW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d05a820-9ed5-4ff8-9819-a618cee394f5_2000x1014.png" width="1456" height="738" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1d05a820-9ed5-4ff8-9819-a618cee394f5_2000x1014.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:738,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:391833,&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://blog.levelupcoding.com/i/203503308?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d05a820-9ed5-4ff8-9819-a618cee394f5_2000x1014.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_!RkTW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d05a820-9ed5-4ff8-9819-a618cee394f5_2000x1014.png 424w, https://substackcdn.com/image/fetch/$s_!RkTW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d05a820-9ed5-4ff8-9819-a618cee394f5_2000x1014.png 848w, https://substackcdn.com/image/fetch/$s_!RkTW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d05a820-9ed5-4ff8-9819-a618cee394f5_2000x1014.png 1272w, https://substackcdn.com/image/fetch/$s_!RkTW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d05a820-9ed5-4ff8-9819-a618cee394f5_2000x1014.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 aria-hidden="true" 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><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><span>Hybrid retrieval is often the safest default because real questions usually need both. A user might include an exact invoice ID while asking a broader policy question. Keyword search catches the ID. Vector search catches the meaning.</span></p><p><span>These choices are independent. For example, a system might use Basic RAG with Hybrid Retrieval, or Agentic RAG with Graph Retrieval. One defines how the system operates. The other defines how it finds information.</span></p><h2><span>What usually breaks</span></h2><p><span>A RAG system is only as good as the information it retrieves. Even a powerful model struggles when the context is incomplete, irrelevant, or outdated.</span></p><p><span>The most common problems are:</span></p><ul><li><p><strong><span>Poor chunking</span></strong><span> &#8594; The information is split across chunks, so only part of the information gets retrieved.</span></p></li><li><p><strong><span>Weak metadata</span></strong><span> &#8594; The system cannot filter by tenant, date, permissions, or other important attributes.</span></p></li><li><p><strong><span>Poor retrieval quality</span></strong><span> &#8594; Relevant information exists, but the retriever fails to find it.</span></p></li><li><p><strong><span>Too much retrieval</span></strong><span> &#8594; Irrelevant chunks fill the prompt and bury the useful information.</span></p></li><li><p><strong><span>Stale indexes</span></strong><span> &#8594; Outdated or deleted content continues to appear in answers.</span></p></li><li><p><strong><span>Unsafe retrieval</span></strong><span> &#8594; Untrusted content injects instructions that interfere with the model.</span></p></li></ul><p><span>That last one is especially important.</span></p><p><span>Retrieved documents are external input and shouldn&#8217;t always be trusted. The model should follow system instructions, not instructions hidden inside a webpage, PDF, email, or document.</span></p><h2><span>When not to use RAG</span></h2><p><span>RAG works best when you need current information, private data, source citations, or knowledge that changes frequently.</span></p><p><span>But it is not always the right tool.</span></p><ul><li><p><strong><span>Behavior problems</span></strong><span> &#8594; If you need a specific writing style, output format, or classification behavior, fine-tuning is often a better fit because the challenge is behavior, not missing information.</span></p></li><li><p><strong><span>Simple lookups</span></strong><span> &#8594; If a user enters an order ID and needs a delivery date, a direct database query is simpler, faster, and more reliable.</span></p></li><li><p><strong><span>Small knowledge sources</span></strong><span> &#8594; If the entire document fits comfortably in the model&#8217;s context window, retrieval may add unnecessary complexity. Passing the document directly to the model is often enough.</span></p></li></ul><p><span>Not every AI problem is a retrieval problem. RAG shines when information is missing, changing, or hard to find.</span></p><h2><span>Wrapping up</span></h2><p><span>RAG makes a model more useful without changing its weights. Instead, it changes what the model considers before it answers.</span></p><p><span>That sounds simple, but it is hard to ship well. Chunking, retrieval quality, permissions, and freshness all need to work before the model generates anything.</span></p><p><span>The difference between a useful answer and a hallucination often comes down to one thing: whether the right information was retrieved before the model started generating.</span></p><div><hr></div><p>&#128075; If you found this useful &#8594; Like + Restack to help others learn system design.</p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Subscribe to get high-signal, clear, and visual system design case studies, deep dives, and breakdowns straight to your inbox:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[How Discord Fans Out One Message to a Million Users]]></title><description><![CDATA[A case study in fanout, bottlenecks, and the engineering decisions behind Discord's scale.]]></description><link>https://blog.levelupcoding.com/p/discord-case-study-one-message-million-users</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/discord-case-study-one-message-million-users</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Tue, 07 Jul 2026 13:22:26 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/8c3a6519-da16-4f54-87cd-4b05c2c941ea_2400x1260.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div><hr></div><h2>&#128640; Case Studies Are Here</h2><p>You voted, and <strong>System Design Case Studies</strong> earned your top vote. Today's issue is the first one. Thanks for telling us what to write next. This is us delivering.</p><div><hr></div><h1><span>How Discord Fans Out One Message to a Million Users</span></h1><p><span>Press enter, and your message shows up for everyone in the server, instantly. It feels like the simplest thing an app can do.</span></p><p><span>It&#8217;s one of the hardest.</span></p><p><span>The moment a server has millions of people online, that single message stops being a database write. It becomes a </span><em><span>fanout</span></em><span> problem: one event has to reach every relevant online client without slowing the whole system down.</span></p><p><span>Behind that instant feeling, Discord has to check permissions, find active sessions, route the event, and push updates over WebSockets fast enough that the server still feels alive.</span></p><p><span>And &#8220;eventually delivered&#8221; doesn&#8217;t count. In a real-time system, users expect the app to react </span><em><span>now</span></em><span>.</span></p><p><span>So the real question is deceptively simple:</span></p><p><span>How do you turn one event into millions of updates without making one process carry the whole load?</span></p><p><em><span>Editor&#8217;s note: Based on publicly shared engineering details from Discord. Thanks to their engineering team for making this public. Full sources are linked in the References section below.</span></em></p><h2><span>How one message reaches everyone in a server</span></h2><p><span>Discord&#8217;s real-time backend is built on publish/subscribe, or pub/sub.</span></p><p><span>Instead of one service calling another and waiting for a reply, a process publishes an event, and every interested listener handles it independently.</span></p><p><span>Two pieces matter here.</span></p><p><span>Each connected user has a </span><strong><span>session process</span></strong><span>: the server-side version of their active connection, usually talking to the app over a WebSocket, a long-lived link between client and backend.</span></p><p><span>Each server (called a </span><strong><span>guild</span></strong><span> internally) has its own process that acts as the routing hub for everything happening inside it. Send a message, join a voice channel, trigger any visible event, and the guild decides which sessions should hear about it.</span></p><p><span>At a high level, the path looks like this:</span></p><ul><li><p><strong><span>Client action</span></strong><span> &#8594; A user sends a message, joins a channel, or performs another visible action.</span></p></li><li><p><strong><span>Guild process</span></strong><span> &#8594; The guild receives the event and decides who should know.</span></p></li><li><p><strong><span>Permission checks</span></strong><span> &#8594; The system filters out users who should not see it.</span></p></li><li><p><strong><span>Session process</span></strong><span> &#8594; Each recipient&#8217;s session receives the update.</span></p></li><li><p><strong><span>WebSocket delivery</span></strong><span> &#8594; The session sends the update to the user&#8217;s client.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!cEE7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcafba8ab-0d2a-4b4f-8fd2-604dd22da128_2000x822.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!cEE7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcafba8ab-0d2a-4b4f-8fd2-604dd22da128_2000x822.png 424w, https://substackcdn.com/image/fetch/$s_!cEE7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcafba8ab-0d2a-4b4f-8fd2-604dd22da128_2000x822.png 848w, https://substackcdn.com/image/fetch/$s_!cEE7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcafba8ab-0d2a-4b4f-8fd2-604dd22da128_2000x822.png 1272w, https://substackcdn.com/image/fetch/$s_!cEE7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcafba8ab-0d2a-4b4f-8fd2-604dd22da128_2000x822.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!cEE7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcafba8ab-0d2a-4b4f-8fd2-604dd22da128_2000x822.png" width="1456" height="598" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cafba8ab-0d2a-4b4f-8fd2-604dd22da128_2000x822.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:598,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:412892,&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://blog.levelupcoding.com/i/205460761?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcafba8ab-0d2a-4b4f-8fd2-604dd22da128_2000x822.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_!cEE7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcafba8ab-0d2a-4b4f-8fd2-604dd22da128_2000x822.png 424w, https://substackcdn.com/image/fetch/$s_!cEE7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcafba8ab-0d2a-4b4f-8fd2-604dd22da128_2000x822.png 848w, https://substackcdn.com/image/fetch/$s_!cEE7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcafba8ab-0d2a-4b4f-8fd2-604dd22da128_2000x822.png 1272w, https://substackcdn.com/image/fetch/$s_!cEE7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcafba8ab-0d2a-4b4f-8fd2-604dd22da128_2000x822.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 aria-hidden="true" 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><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><span>Now notice where the cost hides.</span></p><p><span>The guild doesn&#8217;t blindly blast every event to everyone. First it has to work out who&#8217;s connected, who&#8217;s allowed to see the event, and which sessions should get it.</span></p><p><span>Each check is small.</span></p><p><span>But it happens once per session, every time.</span></p><h2><span>Why large servers become a scaling problem</span></h2><p><span>&#8220;Once per session, every time&#8221; sounds harmless. It isn&#8217;t.</span></p><p><span>As more people join a server, two things grow at once. More users means more events. And every event now has to reach more connected users. Those two factors </span><em><span>multiply</span></em><span>, so the total work grows far faster than the headcount.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!2Hn5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c9db87c-55d9-4c56-8b91-06daf39f1d39_2000x603.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2Hn5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c9db87c-55d9-4c56-8b91-06daf39f1d39_2000x603.png 424w, https://substackcdn.com/image/fetch/$s_!2Hn5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c9db87c-55d9-4c56-8b91-06daf39f1d39_2000x603.png 848w, https://substackcdn.com/image/fetch/$s_!2Hn5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c9db87c-55d9-4c56-8b91-06daf39f1d39_2000x603.png 1272w, https://substackcdn.com/image/fetch/$s_!2Hn5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c9db87c-55d9-4c56-8b91-06daf39f1d39_2000x603.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!2Hn5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c9db87c-55d9-4c56-8b91-06daf39f1d39_2000x603.png" width="1456" height="439" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2c9db87c-55d9-4c56-8b91-06daf39f1d39_2000x603.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:439,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:322042,&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://blog.levelupcoding.com/i/205460761?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c9db87c-55d9-4c56-8b91-06daf39f1d39_2000x603.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_!2Hn5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c9db87c-55d9-4c56-8b91-06daf39f1d39_2000x603.png 424w, https://substackcdn.com/image/fetch/$s_!2Hn5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c9db87c-55d9-4c56-8b91-06daf39f1d39_2000x603.png 848w, https://substackcdn.com/image/fetch/$s_!2Hn5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c9db87c-55d9-4c56-8b91-06daf39f1d39_2000x603.png 1272w, https://substackcdn.com/image/fetch/$s_!2Hn5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c9db87c-55d9-4c56-8b91-06daf39f1d39_2000x603.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 aria-hidden="true" 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><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><span>This is the hidden pressure behind fanout systems.</span></p><p><span>Every new user is not just another connection. They are another possible sender and another possible recipient.</span></p><p><span>Eventually the guild process spends so much time broadcasting that it has little left to process new events. That&#8217;s the moment users start to feel the system slow down.</span></p><p><span>Messages arrive late. Reactions lag. The server feels less real-time.</span></p><p><span>Which raises the obvious question: where, exactly, is all that time going?</span></p><h2><span>Measuring before optimizing</span></h2><p><span>It&#8217;s tempting to guess.</span></p><p><span>Big system, real-time delivery, so surely the fix is more machines, more parallelism, a smarter broadcast.</span></p><p><span>Discord resisted that. Before changing anything, its engineers wanted to know where the guild process was </span><em><span>actually</span></em><span> spending its time and memory.</span></p><p><span>The simplest tool was a stack trace.</span></p><p><span>A stack trace shows what a running process is doing at a specific moment. By collecting thousands of samples over a few minutes, the team could see which operations showed up again and again.</span></p><p><span>Then they added more precise instrumentation inside the guild process itself.</span></p><p><span>They measured:</span></p><ul><li><p><span>How often each operation ran</span></p></li><li><p><span>How long each operation took</span></p></li><li><p><span>How much memory it used</span></p></li></ul><p><span>Measuring large data structures directly was too expensive, so they built a small library that estimated memory usage through sampling.</span></p><p><span>None of this made Discord faster by itself.</span></p><p><span>But it answered the most important question before any optimization:</span></p><p><span>What is actually slowing the system down?</span></p><p><span>That matters because large systems usually have more than one possible bottleneck. Guessing can lead to expensive fixes in the wrong place.</span></p><p><span>Once Discord had measurements, the first big win became clear.</span></p><p><span>The fastest fanout work is the work you never do.</span></p><h2><span>The cheapest fix: doing less work</span></h2><p><span>Originally, every connected user received every event they had permission to see. But most users belong to many servers at once. They may be online, but not actively looking at a particular server.</span></p><p><span>So Discord introduced passive sessions.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!1xgH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bd07b57-8a44-4a38-aadd-4a138c5355d1_2000x935.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1xgH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bd07b57-8a44-4a38-aadd-4a138c5355d1_2000x935.png 424w, https://substackcdn.com/image/fetch/$s_!1xgH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bd07b57-8a44-4a38-aadd-4a138c5355d1_2000x935.png 848w, https://substackcdn.com/image/fetch/$s_!1xgH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bd07b57-8a44-4a38-aadd-4a138c5355d1_2000x935.png 1272w, https://substackcdn.com/image/fetch/$s_!1xgH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bd07b57-8a44-4a38-aadd-4a138c5355d1_2000x935.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1xgH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bd07b57-8a44-4a38-aadd-4a138c5355d1_2000x935.png" width="1456" height="681" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9bd07b57-8a44-4a38-aadd-4a138c5355d1_2000x935.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:681,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:384812,&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://blog.levelupcoding.com/i/205460761?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bd07b57-8a44-4a38-aadd-4a138c5355d1_2000x935.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_!1xgH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bd07b57-8a44-4a38-aadd-4a138c5355d1_2000x935.png 424w, https://substackcdn.com/image/fetch/$s_!1xgH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bd07b57-8a44-4a38-aadd-4a138c5355d1_2000x935.png 848w, https://substackcdn.com/image/fetch/$s_!1xgH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bd07b57-8a44-4a38-aadd-4a138c5355d1_2000x935.png 1272w, https://substackcdn.com/image/fetch/$s_!1xgH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bd07b57-8a44-4a38-aadd-4a138c5355d1_2000x935.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 aria-hidden="true" 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><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><span>If a user was not actively looking at a server, the system stopped sending them updates for that server. That meant:</span></p><ul><li><p><span>No permission checks</span></p></li><li><p><span>No fanout</span></p></li><li><p><span>No network traffic</span></p></li></ul><p><span>At least not until the user became active again.</span></p><p><span>This worked better than expected. Discord found that around 90% of user connections in large servers were passive, which reduced fanout work by roughly the same amount.</span></p><p><span>What makes this powerful isn&#8217;t the number. It&#8217;s the change in the concern.</span></p><p><span>Instead of asking:</span></p><p><span>&#8220;How do we send one message to everyone faster?&#8221;</span></p><p><span>Discord asked:</span></p><p><span>&#8220;Who actually needs this message right now?&#8221;</span></p><p><span>Those are very different questions.</span></p><p><span>The first question usually leads to more machines, more parallelism, and more complexity.</span></p><p><span>The second question removes unnecessary work.</span></p><p><span>This approach will not work for every system. Multiplayer games, emergency alerts, and some collaborative tools may need to update everyone immediately.</span></p><p><span>But when the product experience allows it, the cheapest optimization is often to stop doing work that does not need to happen.</span></p><p><span>Passive sessions helped a lot.</span></p><p><span>But they did not remove the deeper problem: the guild process was still central.</span></p><h2><span>Splitting the load with relays</span></h2><p><span>Passive sessions reduced fanout work, but each guild was still managed by a single process.</span></p><p><span>And a single process can only do so much work before it becomes the bottleneck.</span></p><p><span>So Discord introduced relays.</span></p><p><span>A relay is an intermediate process that sits between the guild and user sessions. Instead of one guild process managing every connected user directly, each relay takes responsibility for a subset of sessions.</span></p><p><span>The guild no longer has to fan out every event by itself.</span></p><p><span>The work can be split:</span></p><ul><li><p><strong><span>Guild process</span></strong><span> &#8594; Handles the main guild logic.</span></p></li><li><p><strong><span>Relay processes</span></strong><span> &#8594; Handle permission checks and fanout for subsets of sessions.</span></p></li><li><p><strong><span>Session processes</span></strong><span> &#8594; Deliver updates to users over WebSockets.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ktxz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f0b25eb-4cbe-41c0-a91d-506ebc5b5872_2000x882.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ktxz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f0b25eb-4cbe-41c0-a91d-506ebc5b5872_2000x882.png 424w, https://substackcdn.com/image/fetch/$s_!ktxz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f0b25eb-4cbe-41c0-a91d-506ebc5b5872_2000x882.png 848w, https://substackcdn.com/image/fetch/$s_!ktxz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f0b25eb-4cbe-41c0-a91d-506ebc5b5872_2000x882.png 1272w, https://substackcdn.com/image/fetch/$s_!ktxz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f0b25eb-4cbe-41c0-a91d-506ebc5b5872_2000x882.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ktxz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f0b25eb-4cbe-41c0-a91d-506ebc5b5872_2000x882.png" width="1456" height="642" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6f0b25eb-4cbe-41c0-a91d-506ebc5b5872_2000x882.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:642,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:408186,&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://blog.levelupcoding.com/i/205460761?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f0b25eb-4cbe-41c0-a91d-506ebc5b5872_2000x882.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_!ktxz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f0b25eb-4cbe-41c0-a91d-506ebc5b5872_2000x882.png 424w, https://substackcdn.com/image/fetch/$s_!ktxz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f0b25eb-4cbe-41c0-a91d-506ebc5b5872_2000x882.png 848w, https://substackcdn.com/image/fetch/$s_!ktxz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f0b25eb-4cbe-41c0-a91d-506ebc5b5872_2000x882.png 1272w, https://substackcdn.com/image/fetch/$s_!ktxz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f0b25eb-4cbe-41c0-a91d-506ebc5b5872_2000x882.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 aria-hidden="true" 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><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><span>Splitting the work wasn&#8217;t as clean as it sounds. The team had to decide which operations stayed in the guild, which moved to relays, and which had to live in both.</span></p><p><span>Then a problem showed up.</span></p><p><span>The first version of relays kept a full copy of the server&#8217;s member list in memory.</span></p><p><span>That made development easier. Every relay had the data it needed.</span></p><p><span>But convenience became the next bottleneck.</span></p><p><span>Duplicating millions of members across many relays wasted huge amounts of memory. Starting a new relay also meant copying the entire member list before it could begin processing.</span></p><p><span>The fix was to give each relay only the member data it actually used.</span></p><p><span>It&#8217;s a lesson distributed systems eventually learn: a full copy of shared state is the simplest thing to build first, but rarely survives at scale.</span></p><h2><span>Keeping the guild responsive</span></h2><p><span>Throughput is how much work a system can handle.</span></p><p><span>Responsiveness is how quickly important work finishes.</span></p><p><span>That difference matters in real-time systems.</span></p><p><span>A guild process might have enough total capacity, but if one expensive operation blocks the main loop, users still feel lag.</span></p><p><span>Discord hit exactly this with operations that scan large member lists. An </span><code>@everyone</code><span> mention is the classic case: the system has to work out which members are allowed to see it. At massive scale, that scan can take several seconds.</span></p><p><span>And the scan&#8217;s cost wasn&#8217;t even the real problem. The problem was that the guild still had to handle normal events </span><em><span>while it ran</span></em><span>. Messages, joins, reactions, and other updates cannot wait behind one slow operation.</span></p><p><span>So Discord used ETS and worker processes. ETS (Erlang Term Storage) is an in-memory store that multiple Erlang and Elixir processes can read safely. The guild moved large member data into ETS, kept recent changes close by, and handed the expensive scans to workers:</span></p><ul><li><p><strong><span>ETS member storage</span></strong><span> &#8594; large member data, readable by many processes.</span></p></li><li><p><strong><span>Recent changes in heap</span></strong><span> &#8594; fresh updates stay close to the guild.</span></p></li><li><p><strong><span>Worker processes</span></strong><span> &#8594; slow reads run outside the guild&#8217;s main event loop.</span></p></li><li><p><strong><span>Smaller guild heap</span></strong><span> &#8594; garbage collection gets cheaper too.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!CA-L!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc617183c-0673-4cb7-8bff-7505486418e3_2000x942.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CA-L!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc617183c-0673-4cb7-8bff-7505486418e3_2000x942.png 424w, https://substackcdn.com/image/fetch/$s_!CA-L!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc617183c-0673-4cb7-8bff-7505486418e3_2000x942.png 848w, https://substackcdn.com/image/fetch/$s_!CA-L!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc617183c-0673-4cb7-8bff-7505486418e3_2000x942.png 1272w, https://substackcdn.com/image/fetch/$s_!CA-L!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc617183c-0673-4cb7-8bff-7505486418e3_2000x942.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!CA-L!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc617183c-0673-4cb7-8bff-7505486418e3_2000x942.png" width="1456" height="686" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c617183c-0673-4cb7-8bff-7505486418e3_2000x942.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:686,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:359619,&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://blog.levelupcoding.com/i/205460761?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc617183c-0673-4cb7-8bff-7505486418e3_2000x942.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_!CA-L!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc617183c-0673-4cb7-8bff-7505486418e3_2000x942.png 424w, https://substackcdn.com/image/fetch/$s_!CA-L!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc617183c-0673-4cb7-8bff-7505486418e3_2000x942.png 848w, https://substackcdn.com/image/fetch/$s_!CA-L!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc617183c-0673-4cb7-8bff-7505486418e3_2000x942.png 1272w, https://substackcdn.com/image/fetch/$s_!CA-L!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc617183c-0673-4cb7-8bff-7505486418e3_2000x942.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 aria-hidden="true" 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><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><span>This kept the guild responsive.</span></p><p><span>Instead of blocking on a slow scan, the guild could hand the work to a worker and keep processing new events.</span></p><h2><span>Large state makes routine operations risky</span></h2><p><span>Discord also used workers during guild handoffs.</span></p><p><span>A handoff is when a guild process moves from one machine to another, usually for maintenance or a deploy. The system has to start a new guild process, move its state, reconnect sessions, and absorb anything that queued up mid-move.</span></p><p><span>For huge guilds, that state can run to multiple gigabytes. If the old process pauses while the new guild process starts up, users can see minutes of delay.</span></p><p><span>That turns an operational task into a product problem.</span></p><p><span>A deploy is no longer &#8220;just restart the process&#8221; when that process owns gigabytes of hot data.</span></p><p><span>So Discord pushed most of the transfer onto a worker. The worker copies the large member data while the old guild kept handling normal events.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tQur!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d82ee06-c792-4143-be44-266989a008ec_2000x732.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tQur!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d82ee06-c792-4143-be44-266989a008ec_2000x732.png 424w, https://substackcdn.com/image/fetch/$s_!tQur!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d82ee06-c792-4143-be44-266989a008ec_2000x732.png 848w, https://substackcdn.com/image/fetch/$s_!tQur!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d82ee06-c792-4143-be44-266989a008ec_2000x732.png 1272w, https://substackcdn.com/image/fetch/$s_!tQur!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d82ee06-c792-4143-be44-266989a008ec_2000x732.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tQur!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d82ee06-c792-4143-be44-266989a008ec_2000x732.png" width="1456" height="533" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8d82ee06-c792-4143-be44-266989a008ec_2000x732.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:533,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:306360,&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://blog.levelupcoding.com/i/205460761?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d82ee06-c792-4143-be44-266989a008ec_2000x732.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_!tQur!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d82ee06-c792-4143-be44-266989a008ec_2000x732.png 424w, https://substackcdn.com/image/fetch/$s_!tQur!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d82ee06-c792-4143-be44-266989a008ec_2000x732.png 848w, https://substackcdn.com/image/fetch/$s_!tQur!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d82ee06-c792-4143-be44-266989a008ec_2000x732.png 1272w, https://substackcdn.com/image/fetch/$s_!tQur!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d82ee06-c792-4143-be44-266989a008ec_2000x732.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 aria-hidden="true" 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><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><span>At scale, the things engineers do to maintain the system can directly affect the user experience if they block the processes responsible for real-time delivery.</span></p><p><span>By this point, Discord had reduced unnecessary work, split fanout across relays, reduced copied state, and protected the guild process from slow scans and handoffs.</span></p><p><span>But one more problem remained.</span></p><p><span>Sometimes doing less work in one place creates more work somewhere else.</span></p><h2><span>When doing less work backfires</span></h2><p><span>Not every optimization worked on the first try.</span></p><p><span>Discord had already built Manifold in an earlier phase of scaling. The next idea was to offload more fanout work to a separate sender process, so the guild process had even less to do.</span></p><p><span>On paper, this looked like an obvious win.</span></p><p><span>The guild would do less work. Network slowdowns would move away from the main event loop. Fanout would become less blocking.</span></p><p><span>But when Discord enabled Manifold Offload, performance got worse.</span></p><p><span>The guild process was doing less work, yet it became busier.</span></p><p><span>Tracing showed the extra load was coming from garbage collection. The offload pattern repeatedly triggered full garbage collections, forcing the runtime to scan a huge heap just to free a small amount of memory.</span></p><p><span>That is the kind of bottleneck that is easy to miss.</span></p><p><span>Once Discord found the cause, the fix was simple. They tuned a BEAM process flag to raise the garbage collection threshold, and the offload worked as intended.</span></p><p><span>The lesson is that an optimization does not exist in isolation.</span></p><p><span>Reducing work in one part of the system can quietly create more work somewhere else.</span></p><p><span>The same pattern appears with connection pools, thread schedulers, caches, garbage collectors, and other shared runtime resources.</span></p><p><span>At small scale, those details may feel invisible.</span></p><p><span>At large scale, they become the bottleneck.</span></p><h2><span>The bigger lesson</span></h2><p><span>Discord&#8217;s fanout problem started with a simple expectation:</span></p><p><span>When someone sends a message, everyone who needs to see it should see it now.</span></p><p><span>But at massive scale, that simple expectation turns into a chain of constraints.</span></p><p><span>First, the guild process has to find the right recipients.</span></p><p><span>Then it has to avoid sending updates to users who do not need them yet.</span></p><p><span>Then it has to split the remaining work across relays.</span></p><p><span>Then it has to avoid copying too much state.</span></p><p><span>Then it has to protect the main event loop from expensive scans, handoffs, and runtime side effects.</span></p><p><span>Each fix made the system better.</span></p><p><span>But each fix also revealed the next bottleneck.</span></p><p><span>That is the real pattern behind Discord&#8217;s scaling story. The system did not become faster because one clever optimization solved everything. It became faster because the team kept asking a narrower question:</span></p><p><span>What work is still sitting on the critical path, and does it really need to be there?</span></p><p><span>Sometimes the answer was to remove work.</span></p><p><span>Sometimes it was to split work.</span></p><p><span>Sometimes it was to move work into a worker.</span></p><p><span>Sometimes it was to tune the runtime so the optimization could actually help.</span></p><p><span>That is what makes this case study useful beyond Discord.</span></p><p><span>Large real-time systems do not survive by broadcasting harder. They survive by making the central path smaller, cheaper, and less blocking.</span></p><p><span>So the lesson is not just &#8220;use relays&#8221; or &#8220;use ETS&#8221; or &#8220;optimize garbage collection.&#8221;</span></p><p><span>The lesson is to follow the pressure.</span></p><p><span>Measure where the system is slowing down. Remove the work that does not need to happen. Split the work that cannot be removed. Keep large state away from the hot path. And watch for hidden costs that only appear after the obvious bottleneck is gone.</span></p><p><span>That is how one message can reach a million users without forcing one process to carry the whole system.</span></p><p><strong><span>References:</span></strong></p><ul><li><p><a href="https://discord.com/blog/maxjourney-pushing-discords-limits-with-a-million-plus-online-users-in-a-single-server">Maxjourney: Pushing Discord&#8217;s Limits with a Million+ Online Users in a Single Server</a></p></li><li><p><a href="https://discord.com/blog/how-discord-scaled-elixir-to-5-000-000-concurrent-users">How Discord Scaled Elixir to 5,000,000 Concurrent Users</a></p></li></ul><div><hr></div><p>&#128075; If you found this useful &#8594; Like + Restack to help others learn system design.</p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Subscribe to get high-signal, clear, and visual system design case studies, deep dives, and breakdowns straight to your inbox:&nbsp;</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[LLMs: The Essential Guide]]></title><description><![CDATA[Most engineers only see the API layer. Here's what's happening underneath.]]></description><link>https://blog.levelupcoding.com/p/llms-the-essential-guide</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/llms-the-essential-guide</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Fri, 26 Jun 2026 14:44:38 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/934bae56-a966-4807-b241-b5eda2c87488_2400x1260.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Get our 142-page System Design Handbook for FREE on newsletter signup:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2><a href="https://lucode.co/checkmarx-appsec-2027-outlook-report-z7nl">What Happens When 81% of Your Code Is AI-Generated?</a></h2><h5>Presented by Checkmarx</h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!2Iy1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ffe4d8-9afb-456b-8a41-10da4f0b9c74_2094x1386.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2Iy1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ffe4d8-9afb-456b-8a41-10da4f0b9c74_2094x1386.png 424w, https://substackcdn.com/image/fetch/$s_!2Iy1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ffe4d8-9afb-456b-8a41-10da4f0b9c74_2094x1386.png 848w, https://substackcdn.com/image/fetch/$s_!2Iy1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ffe4d8-9afb-456b-8a41-10da4f0b9c74_2094x1386.png 1272w, https://substackcdn.com/image/fetch/$s_!2Iy1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ffe4d8-9afb-456b-8a41-10da4f0b9c74_2094x1386.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!2Iy1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ffe4d8-9afb-456b-8a41-10da4f0b9c74_2094x1386.png" width="1456" height="964" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d0ffe4d8-9afb-456b-8a41-10da4f0b9c74_2094x1386.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:964,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:607735,&quot;alt&quot;:&quot;&quot;,&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://blog.levelupcoding.com/i/198543543?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ffe4d8-9afb-456b-8a41-10da4f0b9c74_2094x1386.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_!2Iy1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ffe4d8-9afb-456b-8a41-10da4f0b9c74_2094x1386.png 424w, https://substackcdn.com/image/fetch/$s_!2Iy1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ffe4d8-9afb-456b-8a41-10da4f0b9c74_2094x1386.png 848w, https://substackcdn.com/image/fetch/$s_!2Iy1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ffe4d8-9afb-456b-8a41-10da4f0b9c74_2094x1386.png 1272w, https://substackcdn.com/image/fetch/$s_!2Iy1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ffe4d8-9afb-456b-8a41-10da4f0b9c74_2094x1386.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 aria-hidden="true" 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><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>Organizations with more than 81% AI-generated code reported shipping vulnerable code <strong>3.4x more often</strong> than organizations with low AI adoption. That&#8217;s just one of several findings from <strong><a href="https://lucode.co/checkmarx-appsec-2027-outlook-report-z7nl">Checkmarx&#8217;s</a> </strong><em>Future of Application Security in the Era of AI</em> Report. <strong><a href="https://lucode.co/checkmarx-appsec-2027-outlook-report-z7nl">See what the data reveals</a></strong>.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://lucode.co/checkmarx-appsec-2027-outlook-report-z7nl&quot;,&quot;text&quot;:&quot;Download the Full Report&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://lucode.co/checkmarx-appsec-2027-outlook-report-z7nl"><span>Download the Full Report</span></a></p><div><hr></div><h1>LLMs: The Essential Guide</h1><p><span>LLMs are not just smarter search engines.</span></p><p><span>They are distributed systems built from many moving parts: the model itself, training pipelines, retrieval systems, inference infrastructure, safety layers, and the product experience around them.</span></p><p><span>Most engineers only see the API layer. That works fine until something goes wrong.</span></p><p><span>And when LLM systems fail, the failures are often hard to diagnose. Hallucinations, latency spikes, context loss, rising inference costs, inconsistent outputs; the problem is usually somewhere beneath the response itself.</span></p><p><span>Understanding how these systems work changes how you debug them, scale them, and design around their limitations. From tokenization and transformers to retrieval, fine-tuning, inference, and guardrails, every layer shapes the final answer you see on screen.</span></p><h2><span>The four layers</span></h2><p><span>An LLM system has four practical layers:</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!v1be!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77565228-17b2-4264-87f4-50d7baeeb73d_2000x1080.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!v1be!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77565228-17b2-4264-87f4-50d7baeeb73d_2000x1080.png 424w, https://substackcdn.com/image/fetch/$s_!v1be!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77565228-17b2-4264-87f4-50d7baeeb73d_2000x1080.png 848w, https://substackcdn.com/image/fetch/$s_!v1be!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77565228-17b2-4264-87f4-50d7baeeb73d_2000x1080.png 1272w, https://substackcdn.com/image/fetch/$s_!v1be!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77565228-17b2-4264-87f4-50d7baeeb73d_2000x1080.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!v1be!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77565228-17b2-4264-87f4-50d7baeeb73d_2000x1080.png" width="1456" height="786" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/77565228-17b2-4264-87f4-50d7baeeb73d_2000x1080.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:786,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:424386,&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://blog.levelupcoding.com/i/203498745?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77565228-17b2-4264-87f4-50d7baeeb73d_2000x1080.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_!v1be!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77565228-17b2-4264-87f4-50d7baeeb73d_2000x1080.png 424w, https://substackcdn.com/image/fetch/$s_!v1be!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77565228-17b2-4264-87f4-50d7baeeb73d_2000x1080.png 848w, https://substackcdn.com/image/fetch/$s_!v1be!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77565228-17b2-4264-87f4-50d7baeeb73d_2000x1080.png 1272w, https://substackcdn.com/image/fetch/$s_!v1be!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77565228-17b2-4264-87f4-50d7baeeb73d_2000x1080.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 aria-hidden="true" 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><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><span>Most mistakes happen when teams blur these layers.</span></p><p><span>You do not fix missing company knowledge with a clever prompt. You do not fix hallucinations by blindly fine-tuning. You do not fix latency by only picking a &#8220;smarter&#8221; model. Each layer has its own job.</span></p><h2><span>Transformers</span></h2><p><span>Transformers are the neural network architecture behind modern LLMs.</span></p><p><span>Their core mechanism is attention: a way for tokens to look at other tokens in the sequence and decide what matters most.</span></p><p><span>Instead of reading text strictly one word at a time, Transformers build relationships across the entire context window. In a sentence like &#8220;The server crashed because it ran out of memory,&#8221; attention helps the model understand that &#8220;it&#8221; refers to the server.</span></p><p><span>Different Transformer architectures fit different jobs:</span></p><ul><li><p><strong><span>Encoder-only</span></strong><span> &#8594; Good for classification, embeddings, and semantic search.</span></p></li><li><p><strong><span>Encoder-decoder</span></strong><span> &#8594; Good for transformations like translation and summarization.</span></p></li><li><p><strong><span>Decoder-only</span></strong><span> &#8594; Good for chat, code generation, and next-token prediction.</span></p></li></ul><p><span>Most modern chat models are decoder-only because they generate text one token at a time.</span></p><h2><span>Tokenization</span></h2><p><span>Tokenization is how text becomes something a model can process.</span></p><p><span>LLMs do not read raw text directly. They read tokens: small pieces of text created by a tokenizer. A single word may become multiple tokens, and symbols, code, or emojis can expand even further.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!o_ZR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d59da42-5515-45c4-be14-2a0984963ae6_2000x835.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!o_ZR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d59da42-5515-45c4-be14-2a0984963ae6_2000x835.png 424w, https://substackcdn.com/image/fetch/$s_!o_ZR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d59da42-5515-45c4-be14-2a0984963ae6_2000x835.png 848w, https://substackcdn.com/image/fetch/$s_!o_ZR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d59da42-5515-45c4-be14-2a0984963ae6_2000x835.png 1272w, https://substackcdn.com/image/fetch/$s_!o_ZR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d59da42-5515-45c4-be14-2a0984963ae6_2000x835.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!o_ZR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d59da42-5515-45c4-be14-2a0984963ae6_2000x835.png" width="1456" height="608" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6d59da42-5515-45c4-be14-2a0984963ae6_2000x835.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:608,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:500660,&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://blog.levelupcoding.com/i/203498745?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d59da42-5515-45c4-be14-2a0984963ae6_2000x835.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_!o_ZR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d59da42-5515-45c4-be14-2a0984963ae6_2000x835.png 424w, https://substackcdn.com/image/fetch/$s_!o_ZR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d59da42-5515-45c4-be14-2a0984963ae6_2000x835.png 848w, https://substackcdn.com/image/fetch/$s_!o_ZR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d59da42-5515-45c4-be14-2a0984963ae6_2000x835.png 1272w, https://substackcdn.com/image/fetch/$s_!o_ZR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d59da42-5515-45c4-be14-2a0984963ae6_2000x835.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 aria-hidden="true" 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><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><span>Tokens matter because they shape almost every system constraint:</span></p><ul><li><p><strong><span>Cost</span></strong><span> &#8594; Most providers bill by input and output tokens.</span></p></li><li><p><strong><span>Context window</span></strong><span> &#8594; A model&#8217;s working memory is measured in tokens, not words.</span></p></li><li><p><strong><span>Latency</span></strong><span> &#8594; More tokens usually mean more processing time.</span></p></li><li><p><strong><span>Retrieval chunking</span></strong><span> &#8594; Documents must be split by token limits, not page count.</span></p></li></ul><p><span>This becomes especially important with code, logs, multilingual text, and large prompts. Two inputs with the same word count can produce very different token counts.</span></p><h2><span>Embeddings</span></h2><p><span>Embeddings turn text into vectors which are lists of numbers that represent meaning.</span></p><p><span>If two pieces of text mean similar things, their vectors should land close together. That makes embeddings the foundation of semantic search and retrieval systems.</span></p><p><span>A support platform might embed every help article. When a user asks, &#8220;Why was my payment declined?&#8221;, the system searches for nearby vectors and retrieves related articles about billing failures, fraud checks, or declined cards.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!uslY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa08fe690-363f-4a8c-bd6e-1aa12805f565_2000x900.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!uslY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa08fe690-363f-4a8c-bd6e-1aa12805f565_2000x900.png 424w, https://substackcdn.com/image/fetch/$s_!uslY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa08fe690-363f-4a8c-bd6e-1aa12805f565_2000x900.png 848w, https://substackcdn.com/image/fetch/$s_!uslY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa08fe690-363f-4a8c-bd6e-1aa12805f565_2000x900.png 1272w, https://substackcdn.com/image/fetch/$s_!uslY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa08fe690-363f-4a8c-bd6e-1aa12805f565_2000x900.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!uslY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa08fe690-363f-4a8c-bd6e-1aa12805f565_2000x900.png" width="1456" height="655" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a08fe690-363f-4a8c-bd6e-1aa12805f565_2000x900.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:655,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:350114,&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://blog.levelupcoding.com/i/203498745?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa08fe690-363f-4a8c-bd6e-1aa12805f565_2000x900.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_!uslY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa08fe690-363f-4a8c-bd6e-1aa12805f565_2000x900.png 424w, https://substackcdn.com/image/fetch/$s_!uslY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa08fe690-363f-4a8c-bd6e-1aa12805f565_2000x900.png 848w, https://substackcdn.com/image/fetch/$s_!uslY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa08fe690-363f-4a8c-bd6e-1aa12805f565_2000x900.png 1272w, https://substackcdn.com/image/fetch/$s_!uslY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa08fe690-363f-4a8c-bd6e-1aa12805f565_2000x900.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 aria-hidden="true" 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><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><span>This is the backbone of retrieval-augmented generation (RAG), where external knowledge is fetched before the LLM generates a response.</span></p><p><span>There is no universally best embedding model. Different models optimize for different retrieval patterns. Some work better for semantic similarity, others for clustering or reranking. So the important part is testing them against your actual data and queries.</span></p><h2><span>Attention, context windows, and long-context methods</span></h2><p><span>Attention lets the model decide which earlier tokens matter most.</span></p><p><span>But attention becomes expensive as inputs grow because tokens may need to compare against many other tokens. That is one reason long-context systems are difficult to scale efficiently.</span></p><p><span>A context window is the amount of text a model can consider in one request. Larger windows help with long documents, codebases, and multi-step workflows, but more context is not always better.</span></p><p><span>A giant prompt full of loosely related information can behave like a desk buried under papers. The answer may exist somewhere in the pile, but finding the right signal becomes harder as the noise grows.</span></p><p><span>Good long-context systems usually follow a few principles:</span></p><ul><li><p><strong><span>Keep instructions clear</span></strong><span> &#8594; Signal matters more than volume.</span></p></li><li><p><strong><span>Retrieve only relevant information</span></strong><span> &#8594; Smaller context is often more effective.</span></p></li><li><p><strong><span>Summarize stale state</span></strong><span> &#8594; Compaction keeps the prompt focused.</span></p></li></ul><p><span>Long context works best when many related facts are needed at the same time. Otherwise, retrieval is usually faster and cheaper.</span></p><h2><span>Scaling laws</span></h2><p><span>Scaling laws describe how model performance changes as parameters, data, and compute increase.</span></p><p><span>A common misconception is that bigger models automatically create better systems. Size helps, but only when the model is trained with enough high-quality data and served efficiently. A poorly trained large model can still underperform a smaller, better-balanced one.</span></p><p><span>Model selection is not a popularity contest. You need to balance several tradeoffs:</span></p><ul><li><p><strong><span>Quality</span></strong><span> &#8594; Does it solve the actual task well?</span></p></li><li><p><strong><span>Latency</span></strong><span> &#8594; Can it respond fast enough for users?</span></p></li><li><p><strong><span>Cost</span></strong><span> &#8594; Does unit economics make sense?</span></p></li><li><p><strong><span>Reliability</span></strong><span> &#8594; Does it behave predictably under edge cases?</span></p></li><li><p><strong><span>Grounding</span></strong><span> &#8594; Does it use the right source material correctly?</span></p></li></ul><p><span>The best model is usually not the largest one. It is the one that delivers enough quality at the right cost, latency, and risk level.</span></p><h2><span>Pretraining, fine-tuning, and instruction tuning</span></h2><p><span>LLMs are trained in stages, with each stage solving a different problem.</span></p><ul><li><p><strong><span>Pretraining</span></strong><span> &#8594; The model learns general language patterns and broad knowledge from massive datasets.</span></p></li><li><p><strong><span>Fine-tuning</span></strong><span> &#8594; The pretrained model is adapted for a narrower domain, behavior, or task.</span></p></li><li><p><strong><span>Instruction tuning</span></strong><span> &#8594; The model learns how to follow prompts and respond in a more conversational, task-oriented way.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!MplU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddf23cf5-c155-4a9b-b167-943458ebd45e_2000x1011.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MplU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddf23cf5-c155-4a9b-b167-943458ebd45e_2000x1011.png 424w, https://substackcdn.com/image/fetch/$s_!MplU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddf23cf5-c155-4a9b-b167-943458ebd45e_2000x1011.png 848w, https://substackcdn.com/image/fetch/$s_!MplU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddf23cf5-c155-4a9b-b167-943458ebd45e_2000x1011.png 1272w, https://substackcdn.com/image/fetch/$s_!MplU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddf23cf5-c155-4a9b-b167-943458ebd45e_2000x1011.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MplU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddf23cf5-c155-4a9b-b167-943458ebd45e_2000x1011.png" width="1456" height="736" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ddf23cf5-c155-4a9b-b167-943458ebd45e_2000x1011.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:736,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:798553,&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://blog.levelupcoding.com/i/203498745?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddf23cf5-c155-4a9b-b167-943458ebd45e_2000x1011.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_!MplU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddf23cf5-c155-4a9b-b167-943458ebd45e_2000x1011.png 424w, https://substackcdn.com/image/fetch/$s_!MplU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddf23cf5-c155-4a9b-b167-943458ebd45e_2000x1011.png 848w, https://substackcdn.com/image/fetch/$s_!MplU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddf23cf5-c155-4a9b-b167-943458ebd45e_2000x1011.png 1272w, https://substackcdn.com/image/fetch/$s_!MplU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddf23cf5-c155-4a9b-b167-943458ebd45e_2000x1011.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 aria-hidden="true" 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><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><span>A common mistake is treating fine-tuning as the solution for everything.</span></p><p><span>Fine-tuning works best for stable behavior, like tone, formatting, or repeated workflows. A customer support assistant, for example, may need consistent escalation rules and response style.</span></p><p><span>But fast-changing information usually does not belong in the model weights. Product pricing, internal docs, or policy updates are usually better handled through retrieval systems like RAG.</span></p><p><span>In practice, fine-tuning shapes behavior. Retrieval supplies fresh knowledge.</span></p><h2><span>Alignment</span></h2><p><span>Alignment is the process of shaping model behavior toward goals like helpfulness, safety, and policy compliance.</span></p><p><span>The three main approaches are:</span></p><ul><li><p><strong><span>RLHF (Reinforcement Learning from Human Feedback)</span></strong><span> &#8594; Human reviewers rank model outputs, and the model learns to prefer responses people rate more highly.</span></p></li><li><p><strong><span>DPO (Direct Preference Optimisation)</span></strong><span> &#8594; A simpler approach that learns directly from preference comparisons without a full reinforcement learning loop.</span></p></li><li><p><strong><span>Constitutional AI</span></strong><span> &#8594; The model critiques and revises its own responses using a defined set of rules or principles.</span></p></li></ul><p><span>Alignment is a balancing act, not a safety switch.</span></p><p><span>A model can become more helpful while also becoming more willing to follow harmful instructions. It can become safer while also refusing harmless requests too often. A polished response can still contain incorrect information.</span></p><p><span>That is why alignment alone is not enough. Reliable LLM systems still need retrieval, permissions, evaluation, and monitoring around the model itself.</span></p><h2><span>Prompt engineering</span></h2><p><span>Prompt engineering is the design of instructions, examples, and context given to the model.</span></p><p><span>It is often the fastest way to improve an LLM system because changing a prompt is far cheaper than retraining a model. A good prompt can define the model&#8217;s role, constrain the output format, provide examples, and tell the model how to use retrieved information.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Iall!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f6e0812-1146-42d0-b7b7-38ef864f6b7c_2000x933.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Iall!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f6e0812-1146-42d0-b7b7-38ef864f6b7c_2000x933.png 424w, https://substackcdn.com/image/fetch/$s_!Iall!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f6e0812-1146-42d0-b7b7-38ef864f6b7c_2000x933.png 848w, https://substackcdn.com/image/fetch/$s_!Iall!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f6e0812-1146-42d0-b7b7-38ef864f6b7c_2000x933.png 1272w, https://substackcdn.com/image/fetch/$s_!Iall!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f6e0812-1146-42d0-b7b7-38ef864f6b7c_2000x933.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Iall!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f6e0812-1146-42d0-b7b7-38ef864f6b7c_2000x933.png" width="1456" height="679" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4f6e0812-1146-42d0-b7b7-38ef864f6b7c_2000x933.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:679,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:827399,&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://blog.levelupcoding.com/i/203498745?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f6e0812-1146-42d0-b7b7-38ef864f6b7c_2000x933.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_!Iall!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f6e0812-1146-42d0-b7b7-38ef864f6b7c_2000x933.png 424w, https://substackcdn.com/image/fetch/$s_!Iall!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f6e0812-1146-42d0-b7b7-38ef864f6b7c_2000x933.png 848w, https://substackcdn.com/image/fetch/$s_!Iall!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f6e0812-1146-42d0-b7b7-38ef864f6b7c_2000x933.png 1272w, https://substackcdn.com/image/fetch/$s_!Iall!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f6e0812-1146-42d0-b7b7-38ef864f6b7c_2000x933.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 aria-hidden="true" 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><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><span>But prompts become fragile when they grow without structure.</span></p><ul><li><p><strong><span>Model updates can change behavior</span></strong><span> &#8594; A prompt that works today may drift tomorrow.</span></p></li><li><p><strong><span>Examples can overfit</span></strong><span> &#8594; The model may mimic patterns instead of understanding intent.</span></p></li><li><p><strong><span>Complexity accumulates</span></strong><span> &#8594; Large prompts can turn into brittle mini-applications.</span></p></li></ul><p><span>Treat prompts like production code. Version them, test them, and monitor them because prompt behavior directly affects system behavior.</span></p><h2><span>Reasoning patterns</span></h2><p><span>Reasoning techniques help LLMs handle tasks with multiple steps, dependencies, or external information needs.</span></p><ul><li><p><strong><span>Chain-of-thought prompting</span></strong><span> &#8594; Encourages the model to reason step by step.</span></p></li><li><p><strong><span>Self-consistency</span></strong><span> &#8594; Samples multiple reasoning paths and selects the most consistent answer.</span></p></li><li><p><strong><span>ReAct</span></strong><span> &#8594; Combines reasoning with tool use, letting the model think, act, observe results, and continue.</span></p></li></ul><p><span>These approaches work especially well for math, coding, research, and agent workflows where planning and evidence gathering matter more than fast responses.</span></p><p><span>But reasoning comes with tradeoffs.</span></p><p><span>Extra reasoning uses more tokens. Tool calls add latency. Multiple reasoning attempts increase cost even further.</span></p><p><span>Use reasoning patterns when correctness matters more than speed. For simpler tasks like classification, routing, or formatting, they usually add overhead without much benefit.</span></p><h2><span>Retrieval-augmented generation (RAG)</span></h2><p><span>Retrieval-augmented generation (RAG) connects an LLM to external knowledge sources.</span></p><p><span>The flow is simple: a user asks a question, the system retrieves relevant documents, and the model generates an answer using that retrieved context.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7mE0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff490c0a2-3862-4cb5-93dc-4b8c31562f8e_2000x880.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7mE0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff490c0a2-3862-4cb5-93dc-4b8c31562f8e_2000x880.png 424w, https://substackcdn.com/image/fetch/$s_!7mE0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff490c0a2-3862-4cb5-93dc-4b8c31562f8e_2000x880.png 848w, https://substackcdn.com/image/fetch/$s_!7mE0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff490c0a2-3862-4cb5-93dc-4b8c31562f8e_2000x880.png 1272w, https://substackcdn.com/image/fetch/$s_!7mE0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff490c0a2-3862-4cb5-93dc-4b8c31562f8e_2000x880.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7mE0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff490c0a2-3862-4cb5-93dc-4b8c31562f8e_2000x880.png" width="1456" height="641" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f490c0a2-3862-4cb5-93dc-4b8c31562f8e_2000x880.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:641,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:489060,&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://blog.levelupcoding.com/i/203498745?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff490c0a2-3862-4cb5-93dc-4b8c31562f8e_2000x880.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_!7mE0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff490c0a2-3862-4cb5-93dc-4b8c31562f8e_2000x880.png 424w, https://substackcdn.com/image/fetch/$s_!7mE0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff490c0a2-3862-4cb5-93dc-4b8c31562f8e_2000x880.png 848w, https://substackcdn.com/image/fetch/$s_!7mE0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff490c0a2-3862-4cb5-93dc-4b8c31562f8e_2000x880.png 1272w, https://substackcdn.com/image/fetch/$s_!7mE0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff490c0a2-3862-4cb5-93dc-4b8c31562f8e_2000x880.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 aria-hidden="true" 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><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><span>RAG matters because business knowledge changes far faster than model training. Instead of retraining the model every time information changes, you update the data source.</span></p><p><span>RAG works especially well when:</span></p><ul><li><p><strong><span>Facts change frequently</span></strong><span> &#8594; Policies, pricing, tickets, and docs evolve constantly.</span></p></li><li><p><strong><span>Provenance matters</span></strong><span> &#8594; Users need to know where answers came from.</span></p></li><li><p><strong><span>Knowledge is private</span></strong><span> &#8594; Internal documents should not require retraining a foundation model.</span></p></li><li><p><strong><span>Updates must stay cheap</span></strong><span> &#8594; Reindexing documents is far easier than retraining models.</span></p></li></ul><p><span>But RAG introduces its own failure modes.</span></p><p><span>The retriever may miss the right document. Chunking may separate information from its context. Ranking may surface misleading evidence. The model may even ignore the retrieved material entirely.</span></p><p><span>That is why grounding matters. Grounding means tying responses to verified source material instead of letting the model freely improvise.</span></p><h2><span>Hallucination, evaluation, and safety</span></h2><p><span>A hallucination is an unsupported or misleading output generated by the model.</span></p><p><span>But hallucinations are not caused by one single problem. The model may lack knowledge, retrieval may fail, the prompt may be unclear, the source material may be wrong, or a tool may return stale data.</span></p><p><span>That is why hallucinations cannot be solved with one technique. Reliable systems reduce them through layers of validation:</span></p><ul><li><p><strong><span>Retrieval evaluation</span></strong><span> &#8594; Did the system fetch the right evidence?</span></p></li><li><p><strong><span>Grounding checks</span></strong><span> &#8594; Is the answer actually supported by the source material?</span></p></li><li><p><strong><span>Safety testing</span></strong><span> &#8594; Does the system resist harmful or manipulative inputs?</span></p></li><li><p><strong><span>Monitoring</span></strong><span> &#8594; Do real users expose failures missed during testing?</span></p></li></ul><p><span>Benchmarks help, but they are only proxies. A model can perform well offline and still fail in production.</span></p><p><span>The real test is whether the system answers your users correctly, safely, and consistently under real-world conditions.</span></p><h2><span>Compression and optimization</span></h2><p><span>Efficiency is what turns an impressive model into something financially and operationally viable.</span></p><p><span>LLM inference is expensive because every generated token depends on the one before it. As outputs grow, latency and compute costs grow with them.</span></p><p><span>That is why production systems rely on techniques that reduce memory use and improve serving efficiency:</span></p><ul><li><p><strong><span>Quantization</span></strong><span> &#8594; Uses lower-precision weights to reduce memory and compute costs.</span></p></li><li><p><strong><span>Pruning</span></strong><span> &#8594; Remove less useful parts of the model or computation.</span></p></li><li><p><strong><span>Distillation</span></strong><span> &#8594; Trains a smaller model to mimic a larger one.</span></p></li><li><p><strong><span>FlashAttention</span></strong><span> &#8594; Makes attention faster and more memory-efficient.</span></p></li><li><p><strong><span>Speculative decoding</span></strong><span> &#8594; Uses a smaller model to draft tokens before a larger model verifies them.</span></p></li><li><p><strong><span>PagedAttention</span></strong><span> &#8594; Improves memory management during inference serving.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!uYU7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09c8a88a-304a-4b2e-9a12-5df43c7f9cbd_2000x948.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!uYU7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09c8a88a-304a-4b2e-9a12-5df43c7f9cbd_2000x948.png 424w, https://substackcdn.com/image/fetch/$s_!uYU7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09c8a88a-304a-4b2e-9a12-5df43c7f9cbd_2000x948.png 848w, https://substackcdn.com/image/fetch/$s_!uYU7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09c8a88a-304a-4b2e-9a12-5df43c7f9cbd_2000x948.png 1272w, https://substackcdn.com/image/fetch/$s_!uYU7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09c8a88a-304a-4b2e-9a12-5df43c7f9cbd_2000x948.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!uYU7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09c8a88a-304a-4b2e-9a12-5df43c7f9cbd_2000x948.png" width="1456" height="690" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/09c8a88a-304a-4b2e-9a12-5df43c7f9cbd_2000x948.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:690,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:344305,&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://blog.levelupcoding.com/i/203498745?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09c8a88a-304a-4b2e-9a12-5df43c7f9cbd_2000x948.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_!uYU7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09c8a88a-304a-4b2e-9a12-5df43c7f9cbd_2000x948.png 424w, https://substackcdn.com/image/fetch/$s_!uYU7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09c8a88a-304a-4b2e-9a12-5df43c7f9cbd_2000x948.png 848w, https://substackcdn.com/image/fetch/$s_!uYU7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09c8a88a-304a-4b2e-9a12-5df43c7f9cbd_2000x948.png 1272w, https://substackcdn.com/image/fetch/$s_!uYU7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09c8a88a-304a-4b2e-9a12-5df43c7f9cbd_2000x948.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 aria-hidden="true" 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><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><span>In practice, the biggest gains often come from simpler optimizations first: shorter prompts, capped outputs, cached context, batching, and smaller fallback models. You usually do not need a larger GPU cluster as the first solution.</span></p><h2><span>Deployment patterns</span></h2><p><span>Deployment determines where model inference happens, and that decision affects latency, privacy, reliability, and cost.</span></p><p><span>There are three common deployment patterns:</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tB45!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe475cfdf-2a36-454e-a4f5-8f81e5ebead4_2000x726.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tB45!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe475cfdf-2a36-454e-a4f5-8f81e5ebead4_2000x726.png 424w, https://substackcdn.com/image/fetch/$s_!tB45!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe475cfdf-2a36-454e-a4f5-8f81e5ebead4_2000x726.png 848w, https://substackcdn.com/image/fetch/$s_!tB45!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe475cfdf-2a36-454e-a4f5-8f81e5ebead4_2000x726.png 1272w, https://substackcdn.com/image/fetch/$s_!tB45!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe475cfdf-2a36-454e-a4f5-8f81e5ebead4_2000x726.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tB45!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe475cfdf-2a36-454e-a4f5-8f81e5ebead4_2000x726.png" width="1456" height="529" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e475cfdf-2a36-454e-a4f5-8f81e5ebead4_2000x726.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:529,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:361782,&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://blog.levelupcoding.com/i/203498745?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe475cfdf-2a36-454e-a4f5-8f81e5ebead4_2000x726.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_!tB45!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe475cfdf-2a36-454e-a4f5-8f81e5ebead4_2000x726.png 424w, https://substackcdn.com/image/fetch/$s_!tB45!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe475cfdf-2a36-454e-a4f5-8f81e5ebead4_2000x726.png 848w, https://substackcdn.com/image/fetch/$s_!tB45!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe475cfdf-2a36-454e-a4f5-8f81e5ebead4_2000x726.png 1272w, https://substackcdn.com/image/fetch/$s_!tB45!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe475cfdf-2a36-454e-a4f5-8f81e5ebead4_2000x726.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 aria-hidden="true" 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><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><span>Edge deployment runs the model on-device or close to the user. Cloud deployment sends requests to centralized model infrastructure. Hybrid systems split workloads between both.</span></p><p><span>Choose edge when responsiveness and data locality matter most. Choose cloud when model capability and tooling matter more. Choose hybrid when you need both and can cleanly separate the workflow.</span></p><h2><span>Privacy and data governance</span></h2><p><span>Privacy and governance shape how data enters, moves through, and leaves an LLM system.</span></p><p><span>This is not just a compliance problem. It directly affects architecture.</span></p><p><span>A privacy-sensitive system may require local processing, encrypted logs, restricted tool access, and short retention windows. Regulated workflows may need human approval before the model can send messages, update records, or trigger actions.</span></p><p><span>Good governance usually comes down to a few core controls:</span></p><ul><li><p><strong><span>Classify inputs</span></strong><span> &#8594; Know which data is sensitive or regulated.</span></p></li><li><p><strong><span>Separate instructions from retrieved data</span></strong><span> &#8594; External content should not override system rules.</span></p></li><li><p><strong><span>Limit tool permissions</span></strong><span> &#8594; Give the model only the access it actually needs.</span></p></li><li><p><strong><span>Control retention</span></strong><span> &#8594; Store logs only as long as necessary.</span></p></li><li><p><strong><span>Review vendor policies</span></strong><span> &#8594; Understand how providers handle training and data storage.</span></p></li></ul><p><span>The more autonomy a model has, the more important the guardrails become.</span></p><h2><span>Multimodality</span></h2><p><span>Multimodal models work with more than just text. They can process images, audio, video, documents, and combinations of different inputs together.</span></p><p><span>That expands what LLM systems can do: document analysis, visual search, voice assistants, meeting summaries, accessibility tools, and more natural interfaces.</span></p><p><span>But multimodality also increases the failure surface.</span></p><p><span>A model may misread an image, miss small text in a screenshot, mistranscribe audio, or incorrectly connect information across formats. A system that performs well in text may still struggle with visual grounding or audio accuracy.</span></p><p><span>That is why each modality needs separate evaluation:</span></p><ul><li><p><strong><span>Text</span></strong><span> &#8594; Does the model reason correctly?</span></p></li><li><p><strong><span>Images</span></strong><span> &#8594; Does it identify visual details reliably?</span></p></li><li><p><strong><span>Audio</span></strong><span> &#8594; Does transcription preserve meaning?</span></p></li><li><p><strong><span>Combined inputs</span></strong><span> &#8594; Does it connect the right information across formats?</span></p></li></ul><p><span>Evaluate each modality separately then evaluate the combined system, and keep modality-specific fallbacks where accuracy matters.</span></p><h2><span>Observability and monitoring</span></h2><p><span>Traditional monitoring tells you whether a request succeeded. LLM observability needs much deeper visibility.</span></p><p><span>You need visibility into the entire execution path: which prompt was used, what documents were retrieved, how many tokens were consumed, which tools were called, what safety checks fired, and whether the answer actually helped the user.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!FAr3!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0a0da80-a418-437e-8ba1-80e33939604d_2000x975.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FAr3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0a0da80-a418-437e-8ba1-80e33939604d_2000x975.png 424w, https://substackcdn.com/image/fetch/$s_!FAr3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0a0da80-a418-437e-8ba1-80e33939604d_2000x975.png 848w, https://substackcdn.com/image/fetch/$s_!FAr3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0a0da80-a418-437e-8ba1-80e33939604d_2000x975.png 1272w, https://substackcdn.com/image/fetch/$s_!FAr3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0a0da80-a418-437e-8ba1-80e33939604d_2000x975.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!FAr3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0a0da80-a418-437e-8ba1-80e33939604d_2000x975.png" width="1456" height="710" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d0a0da80-a418-437e-8ba1-80e33939604d_2000x975.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:710,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:486315,&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://blog.levelupcoding.com/i/203498745?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0a0da80-a418-437e-8ba1-80e33939604d_2000x975.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_!FAr3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0a0da80-a418-437e-8ba1-80e33939604d_2000x975.png 424w, https://substackcdn.com/image/fetch/$s_!FAr3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0a0da80-a418-437e-8ba1-80e33939604d_2000x975.png 848w, https://substackcdn.com/image/fetch/$s_!FAr3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0a0da80-a418-437e-8ba1-80e33939604d_2000x975.png 1272w, https://substackcdn.com/image/fetch/$s_!FAr3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0a0da80-a418-437e-8ba1-80e33939604d_2000x975.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 aria-hidden="true" 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><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><span>That usually means tracing several layers at once:</span></p><ul><li><p><strong><span>Prompt version</span></strong><span> &#8594; Which instructions generated the output?</span></p></li><li><p><strong><span>Token usage</span></strong><span> &#8594; Did costs spike because prompts or outputs grew?</span></p></li><li><p><strong><span>Retrieval results</span></strong><span> &#8594; Was the right evidence returned?</span></p></li><li><p><strong><span>Tool calls</span></strong><span> &#8594; Did the model use the correct tools safely?</span></p></li><li><p><strong><span>Latency</span></strong><span> &#8594; Was time spent in retrieval, generation, or external tools?</span></p></li><li><p><strong><span>Safety events</span></strong><span> &#8594; Did the system detect prompt injection or sensitive data risks?</span></p></li><li><p><strong><span>User outcomes</span></strong><span> &#8594; Did the response actually solve the problem?</span></p></li></ul><p><span>Without observability, debugging LLM systems becomes guesswork. With it, failures become traceable.</span></p><h2><span>Wrapping up</span></h2><p><span>LLMs make more sense when you treat them as systems, not just models.</span></p><p><span>The difficult part is not generating text. It is making the entire system reliable, grounded, observable, fast, and safe under real-world conditions.</span></p><p><span>That is why successful LLM products are not built from prompts alone. They come from layers working together: retrieval, evaluation, guardrails, serving infrastructure, observability, governance, and careful system design.</span></p><p><span>The model produces the response.</span></p><p><span>The system around it determines whether that response can be trusted.</span></p><div><hr></div><h2>Related LUC reading</h2><ul><li><p><strong><a href="https://blog.levelupcoding.com/p/mcp-clearly-explained">MCP Clearly Explained</a></strong></p></li></ul><div><hr></div><p>&#128075; If you found this useful &#8594; Like + Restack to help others learn system design.</p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Subscribe to get high-signal, clear, and visual system design breakdowns straight to your inbox:&nbsp;</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[MCP Clearly Explained]]></title><description><![CDATA[Plus: Big upgrades are coming to LUC. Vote on what you'd like to see first.]]></description><link>https://blog.levelupcoding.com/p/mcp-clearly-explained</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/mcp-clearly-explained</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Mon, 15 Jun 2026 12:57:01 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/332edc58-66c9-4497-8dcd-414ad975e8fc_2400x1260.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div><hr></div><h2>&#128640; What's Next for LUC</h2><p>We're building LUC into a world-class resource for learning system design.</p><p>To get there, we&#8217;re introducing several new content series over the coming months:</p><h4>&#10003; System Design Case Studies</h4><p>Real-world analyses of how systems at companies like Netflix, Uber, Anthropic, and Amazon are designed.</p><h4>&#10003; System Design Deep Dive Series</h4><p>Deeper, more extensive breakdowns than our regular articles.</p><h4>&#10003; AI Engineering Breakdowns</h4><p>Clear, high-signal breakdowns of AI engineering concepts that can be consumed in ~5 minutes.</p><h4>&#10003; AI Engineering Deep Dive Series</h4><p>Deeper, more extensive breakdowns than our regular articles of AI engineering concepts.</p><h4>&#10003; Learning Tracks</h4><p>Curated learning paths that connect related concepts into structured journeys across system design, AI engineering, and software engineering.</p><p><strong>We&#8217;d love your input.</strong></p><div class="poll-embed" data-attrs="{&quot;id&quot;:590928}" data-component-name="PollToDOM"></div><p>We&#8217;ll use the results to help prioritize what we build next. Thanks for being part of the LUC community. We&#8217;re excited to share what&#8217;s coming next!</p><div><hr></div><h1>What MCP Actually Is and Why It Matters</h1><p>How many custom integrations does your AI stack have?</p><p>One for the database, one for Slack, one for the internal knowledge base; each written from scratch, each maintained separately.</p><p>Add a new model and the count multiplies again.</p><p>Model Context Protocol (MCP) is Anthropic&#8217;s answer to that problem.</p><p>Rather than building a new connector for every model-tool pairing, MCP defines a single standard interface so any compliant AI host can speak to any compliant server. Add a new tool once, every model that supports MCP can use it immediately.</p><p>Understanding how MCP works and where it fits changes how you design AI systems.</p><h2>What is MCP?</h2><p>Model Context Protocol (MCP) is a standard way for an AI application to talk to external services.</p><p>Instead of inventing a new integration pattern for each tool, MCP defines a common protocol for discovering capabilities, requesting data, and invoking actions.</p><p>But it doesn&#8217;t stop at message formats.</p><p>MCP also defines how a session is established, what features are allowed, and how both sides stay compatible over time.</p><p>MCP is structured around three core roles:</p><ul><li><p><strong>Host</strong> &#8594; The AI application the user interacts with, such as a chat app or coding assistant</p></li><li><p><strong>Client</strong> &#8594; The connector inside that host that manages one server connection</p></li><li><p><strong>Server</strong> &#8594; The external process or service that exposes capabilities to the host</p></li></ul><p>That separation is what makes MCP scale.</p><p>The host decides when to ask for help. The client handles the protocol details. The server owns the actual side effects, such as reading data, calling an API, or writing to a 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_!p4X6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1d29141-d640-4a99-bd66-cb18b0ec03c6_2000x1118.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!p4X6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1d29141-d640-4a99-bd66-cb18b0ec03c6_2000x1118.png 424w, https://substackcdn.com/image/fetch/$s_!p4X6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1d29141-d640-4a99-bd66-cb18b0ec03c6_2000x1118.png 848w, https://substackcdn.com/image/fetch/$s_!p4X6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1d29141-d640-4a99-bd66-cb18b0ec03c6_2000x1118.png 1272w, https://substackcdn.com/image/fetch/$s_!p4X6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1d29141-d640-4a99-bd66-cb18b0ec03c6_2000x1118.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!p4X6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1d29141-d640-4a99-bd66-cb18b0ec03c6_2000x1118.png" width="1456" height="814" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a1d29141-d640-4a99-bd66-cb18b0ec03c6_2000x1118.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:814,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1113754,&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://blog.levelupcoding.com/i/197830407?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1d29141-d640-4a99-bd66-cb18b0ec03c6_2000x1118.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_!p4X6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1d29141-d640-4a99-bd66-cb18b0ec03c6_2000x1118.png 424w, https://substackcdn.com/image/fetch/$s_!p4X6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1d29141-d640-4a99-bd66-cb18b0ec03c6_2000x1118.png 848w, https://substackcdn.com/image/fetch/$s_!p4X6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1d29141-d640-4a99-bd66-cb18b0ec03c6_2000x1118.png 1272w, https://substackcdn.com/image/fetch/$s_!p4X6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1d29141-d640-4a99-bd66-cb18b0ec03c6_2000x1118.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 aria-hidden="true" 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><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><h2>How MCP sessions actually work</h2><p>Under the hood, MCP is a capability protocol with a negotiated lifecycle.</p><p>Every connection starts with a handshake where the client and server agree on:</p><ul><li><p><strong>Protocol version</strong> &#8594; Ensures both sides speak the same language</p></li><li><p><strong>Capabilities</strong> &#8594; Defines what features are available in this session </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ABIo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdd15d4-96c4-457c-a5db-85794b1861f3_2000x847.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ABIo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdd15d4-96c4-457c-a5db-85794b1861f3_2000x847.png 424w, https://substackcdn.com/image/fetch/$s_!ABIo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdd15d4-96c4-457c-a5db-85794b1861f3_2000x847.png 848w, https://substackcdn.com/image/fetch/$s_!ABIo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdd15d4-96c4-457c-a5db-85794b1861f3_2000x847.png 1272w, https://substackcdn.com/image/fetch/$s_!ABIo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdd15d4-96c4-457c-a5db-85794b1861f3_2000x847.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ABIo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdd15d4-96c4-457c-a5db-85794b1861f3_2000x847.png" width="1456" height="617" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bbdd15d4-96c4-457c-a5db-85794b1861f3_2000x847.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:617,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:303679,&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://blog.levelupcoding.com/i/197830407?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdd15d4-96c4-457c-a5db-85794b1861f3_2000x847.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_!ABIo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdd15d4-96c4-457c-a5db-85794b1861f3_2000x847.png 424w, https://substackcdn.com/image/fetch/$s_!ABIo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdd15d4-96c4-457c-a5db-85794b1861f3_2000x847.png 848w, https://substackcdn.com/image/fetch/$s_!ABIo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdd15d4-96c4-457c-a5db-85794b1861f3_2000x847.png 1272w, https://substackcdn.com/image/fetch/$s_!ABIo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdd15d4-96c4-457c-a5db-85794b1861f3_2000x847.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 aria-hidden="true" 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><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>After that, all interactions are constrained by what was agreed upfront. No hidden features. No assumptions.</p><p>This is what makes MCP different from typical APIs. It&#8217;s not just &#8220;send a request, get a response.&#8221; It&#8217;s a structured session where both sides explicitly agree on what&#8217;s possible before anything happens.</p><p>That extra layer is what turns MCP from a simple integration pattern into something that can scale across many tools, models, and environments.</p><h2>What servers expose</h2><p>MCP servers expose capabilities in three distinct ways. Each one exists for a different job, and mixing them leads to messy systems.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-wtH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c705537-1d7f-45ea-be4c-55336ef9b60e_2000x884.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-wtH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c705537-1d7f-45ea-be4c-55336ef9b60e_2000x884.png 424w, https://substackcdn.com/image/fetch/$s_!-wtH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c705537-1d7f-45ea-be4c-55336ef9b60e_2000x884.png 848w, https://substackcdn.com/image/fetch/$s_!-wtH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c705537-1d7f-45ea-be4c-55336ef9b60e_2000x884.png 1272w, https://substackcdn.com/image/fetch/$s_!-wtH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c705537-1d7f-45ea-be4c-55336ef9b60e_2000x884.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-wtH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c705537-1d7f-45ea-be4c-55336ef9b60e_2000x884.png" width="1456" height="644" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5c705537-1d7f-45ea-be4c-55336ef9b60e_2000x884.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:644,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:436057,&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://blog.levelupcoding.com/i/197830407?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c705537-1d7f-45ea-be4c-55336ef9b60e_2000x884.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_!-wtH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c705537-1d7f-45ea-be4c-55336ef9b60e_2000x884.png 424w, https://substackcdn.com/image/fetch/$s_!-wtH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c705537-1d7f-45ea-be4c-55336ef9b60e_2000x884.png 848w, https://substackcdn.com/image/fetch/$s_!-wtH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c705537-1d7f-45ea-be4c-55336ef9b60e_2000x884.png 1272w, https://substackcdn.com/image/fetch/$s_!-wtH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c705537-1d7f-45ea-be4c-55336ef9b60e_2000x884.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 aria-hidden="true" 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><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 important distinction is between <strong>tools and resources</strong>.</p><p>If you blur that line, your system becomes harder to reason about.</p><p>Use this rule:</p><ul><li><p><strong>Context-heavy</strong> &#8594; Use a resource because you&#8217;re supplying data</p></li><li><p><strong>Action-oriented</strong> &#8594; Use a tool because you&#8217;re performing something </p></li></ul><p>If a &#8220;tool&#8221; mostly returns data with no real side effect, it&#8217;s probably a resource in disguise.</p><p>Keeping this separation clean makes your system easier to test, easier to secure, and easier to evolve.</p><h2>The benefits of MCP</h2><p>MCP solves a scaling problem that shows up fast in real AI systems.</p><p>Without a shared protocol, every integration becomes custom work. Your chat app talks to one tool one way, your IDE talks to another tool another way, and your internal agent framework invents a third pattern.</p><p>That fragmentation slows teams down because every product repeats the same connector logic.</p><p>MCP changes that in a few concrete ways:</p><ul><li><p><strong>Standardized integration surface</strong> &#8594; New tools do not require a brand-new communication pattern each time.</p></li><li><p><strong>Better separation of concerns</strong> &#8594; Product logic stays in the host, protocol handling stays in the client, and domain actions stay in the server.</p></li><li><p><strong>Safer extensibility</strong> &#8594; Teams can add capabilities gradually because features are negotiated instead of assumed.</p></li><li><p><strong>Easier composition</strong> &#8594; One host can connect to multiple servers without turning every connection into a one-off project.</p></li></ul><p>This is especially useful in products where the model needs live context.</p><p>A coding assistant may need repository data, documentation, terminal access, and issue tracker actions in the same session. MCP gives those capabilities a shared protocol so the host can compose them without stitching together a fresh protocol per tool.</p><h2>The tradeoffs</h2><p>MCP simplifies integration, but it does not remove the hard parts of building safe and reliable systems.</p><p>The most common mistake is treating the protocol as the safety layer.</p><p>It isn&#8217;t.</p><p>MCP gives you structure. You still decide what gets exposed, what requires user consent, and how risky actions are controlled. If those decisions are weak, the protocol won&#8217;t save you.</p><p>That means core distributed-systems discipline still applies:</p><ul><li><p><strong>Check inputs carefully</strong> &#8594; Don&#8217;t assume tool inputs are safe; AI can make mistakes or send bad data</p></li><li><p><strong>Limit what tools can do</strong> &#8594; Give each tool only the access it really needs to avoid misuse.</p></li><li><p><strong>Don&#8217;t trust descriptions</strong> &#8594; Just because a tool says it does something doesn&#8217;t make it safe.</p></li><li><p><strong>Make things easy to track</strong> &#8594; Use IDs, logs, and progress updates so you can see what&#8217;s happening when things get complicated.</p></li><li><p><strong>Use structured data</strong> &#8594; Systems are more reliable when they pass clear, well-defined data instead of free-form text.</p></li></ul><p>There is also a system design tradeoff.</p><p>MCP standardises communication, but it does not orchestrate behavior.</p><ul><li><p><strong>No model strategy</strong> &#8594; You still choose which model to use and when</p></li><li><p><strong>No context ranking </strong>&#8594; You decide what data is relevant and how it&#8217;s selected</p></li><li><p><strong>No tool arbitration</strong> &#8594; You define how conflicts between tools are resolved</p></li><li><p><strong>No workflow control</strong> &#8594; You design how multi-step tasks are executed</p></li></ul><p>MCP removes the need to rebuild integrations, but it leaves system design decisions exactly where they belong; with you.</p><h2>When MCP makes sense (and when it doesn&#8217;t)</h2><p>MCP is designed for systems that need to scale across multiple tools, data sources, and workflows.</p><p>It works best when your AI application needs to:</p><ul><li><p><strong>Connect to multiple services</strong> &#8594; Each capability can be exposed and managed independently</p></li><li><p><strong>Compose workflows</strong> &#8594; Outputs from one tool feed into another across a session</p></li><li><p><strong>Evolve over time</strong> &#8594; New tools can be added without rewriting integrations</p></li><li><p><strong>Support agent-like behavior</strong> &#8594; The model dynamically discovers and uses capabilities</p></li></ul><p>In these systems, MCP reduces long-term complexity because integrations become reusable and consistent.</p><p>On the other hand, it&#8217;s likely overkill when a single, simple API call is all you need.</p><p>If your setup is just one model calling one tool with a fixed setup, a direct API call is easier to build, easier to monitor, and cheaper to run.</p><p>MCP brings extra layers: like managing versions, handling communication rules, and running supporting infrastructure; which only really make sense once your system starts getting more complex.</p><h2>Wrapping up</h2><p>As systems grow, the hardest part isn&#8217;t adding intelligence.</p><p>It&#8217;s making everything work together without breaking.</p><p>What starts as a simple integration quickly turns into a web of connectors, assumptions, and edge cases. Over time, that complexity becomes the bottleneck.</p><p>MCP addresses that at the foundation level.</p><p>It gives you a consistent way to connect systems so you can focus on what those systems should do, not how they talk to each other.</p><p>And that shift matters.</p><p>Because the teams that move fastest aren&#8217;t the ones writing the most integrations.<br> They&#8217;re the ones who can reuse, extend, and evolve what they&#8217;ve already built.</p><p>That&#8217;s the real advantage MCP offers.</p><div><hr></div><p>&#128075; If you found this useful &#8594; Like + Restack to help others learn system design.</p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Subscribe to get high-signal, clear, and visual system design breakdowns straight to your inbox:&nbsp;</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[REST vs GraphQL vs gRPC]]></title><description><![CDATA[The tradeoffs behind resource-driven, query-driven, and method-driven APIs.]]></description><link>https://blog.levelupcoding.com/p/rest-vs-graphql-vs-grpc</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/rest-vs-graphql-vs-grpc</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Thu, 28 May 2026 10:32:52 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/a0e93e32-3873-49a3-adf0-f583b6367380_2400x1260.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Get our 142-page System Design Handbook for FREE on newsletter signup:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2><a href="https://lucode.co/oracle-developer-hub-z67nl">A Practical Hub for Building AI Systems</a></h2><h5>Presented by Oracle</h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!n6bu!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb844538-26a2-4f40-9f2b-5e2838ec6c93_1068x659.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!n6bu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb844538-26a2-4f40-9f2b-5e2838ec6c93_1068x659.png 424w, https://substackcdn.com/image/fetch/$s_!n6bu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb844538-26a2-4f40-9f2b-5e2838ec6c93_1068x659.png 848w, https://substackcdn.com/image/fetch/$s_!n6bu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb844538-26a2-4f40-9f2b-5e2838ec6c93_1068x659.png 1272w, https://substackcdn.com/image/fetch/$s_!n6bu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb844538-26a2-4f40-9f2b-5e2838ec6c93_1068x659.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!n6bu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb844538-26a2-4f40-9f2b-5e2838ec6c93_1068x659.png" width="1068" height="659" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/db844538-26a2-4f40-9f2b-5e2838ec6c93_1068x659.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:659,&quot;width&quot;:1068,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:284995,&quot;alt&quot;:&quot;&quot;,&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://blog.levelupcoding.com/i/198543543?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb844538-26a2-4f40-9f2b-5e2838ec6c93_1068x659.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_!n6bu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb844538-26a2-4f40-9f2b-5e2838ec6c93_1068x659.png 424w, https://substackcdn.com/image/fetch/$s_!n6bu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb844538-26a2-4f40-9f2b-5e2838ec6c93_1068x659.png 848w, https://substackcdn.com/image/fetch/$s_!n6bu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb844538-26a2-4f40-9f2b-5e2838ec6c93_1068x659.png 1272w, https://substackcdn.com/image/fetch/$s_!n6bu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb844538-26a2-4f40-9f2b-5e2838ec6c93_1068x659.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 aria-hidden="true" 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><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>Building production AI systems means combining far more than just models. Retrieval pipelines, memory layers, agent orchestration, evaluation workflows, observability, and infrastructure all need to work together. Oracle&#8217;s <strong><a href="https://lucode.co/oracle-developer-hub-z67nl">AI Developer Hub</a></strong> brings these concepts into one place through practical architectures, implementation guides, courses, and real engineering examples for modern AI applications.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://lucode.co/oracle-developer-hub-z67nl&quot;,&quot;text&quot;:&quot;Explore the AI Hub&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://lucode.co/oracle-developer-hub-z67nl"><span>Explore the AI Hub</span></a></p><div><hr></div><h1>REST, GraphQL, or gRPC? Choosing the Right Tool for the Job</h1><p>Your mobile app over-fetches because REST returns the entire resource, even when the screen only needs three fields. Your internal services waste CPU serializing JSON nobody reads. Your front-end team rewrites the same data-fetching glue for every page because the API never lets them ask for exactly what they need.</p><p>These look like separate performance problems, but they usually come from the same root cause: using the wrong API style for the interaction.</p><p>REST, GraphQL, and gRPC solve different communication problems.</p><p>The mistake is treating them as interchangeable.</p><p>An API style is really a tradeoff between flexibility, simplicity, efficiency, and control. Once you understand which tradeoff your system actually needs, the decision becomes much clearer.</p><h2>The core mental model</h2><p>Before comparing performance, tooling, or syntax, focus on the interaction pattern each API style is designed around.</p><ul><li><p><strong>REST</strong> &#8594; Organizes communication around resources. A resource is a stable thing like a user, product, or order, exposed through URLs that clients fetch, create, update, or delete over HTTP.</p></li><li><p><strong>GraphQL</strong> &#8594; Organizes communication around queries. Clients describe the exact shape of data they want, and the server resolves only those fields.</p></li><li><p><strong>gRPC</strong> &#8594; Organizes communication around methods. Services expose strongly typed procedures that other services call directly over HTTP/2 using compact binary messages.</p></li></ul><p>That distinction matters more than the syntax itself.</p><p>If your system naturally revolves around stable entities like products, accounts, or invoices, REST usually feels predictable and easy to reason about. The API behaves like a catalog where every resource has a clear address and lifecycle.</p><p>If different clients constantly need different views of the same data, GraphQL reduces the coordination overhead. A mobile app might need five fields while a dashboard needs fifty. Instead of creating endless custom endpoints, clients ask for exactly what they need.</p><p>If your biggest bottleneck is service-to-service communication, gRPC optimizes for efficiency. Binary payloads are smaller, contracts are strict, and HTTP/2 keeps connections open instead of repeatedly starting new ones. It behaves less like browsing web pages and more like calling functions across the network.</p><p>Once you identify whether your system is resource-driven, query-driven, or method-driven, the tradeoffs become much easier to evaluate.</p><h2>REST: the default for clear resources and public APIs</h2><p>REST works best when your API benefits from standard web behavior.</p><p>A product catalog is a good example. Products, categories, prices, and images are stable resources with clear identities. Browsers, CDNs, proxies, and HTTP caches already know how to handle them efficiently.</p><p>That simplicity is REST&#8217;s biggest advantage. The URL identifies the resource, the HTTP method describes the action, and the status code explains the result.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nBqg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68e9eca3-764e-486a-beee-0b7e0b21b321_2000x962.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nBqg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68e9eca3-764e-486a-beee-0b7e0b21b321_2000x962.png 424w, https://substackcdn.com/image/fetch/$s_!nBqg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68e9eca3-764e-486a-beee-0b7e0b21b321_2000x962.png 848w, https://substackcdn.com/image/fetch/$s_!nBqg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68e9eca3-764e-486a-beee-0b7e0b21b321_2000x962.png 1272w, https://substackcdn.com/image/fetch/$s_!nBqg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68e9eca3-764e-486a-beee-0b7e0b21b321_2000x962.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nBqg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68e9eca3-764e-486a-beee-0b7e0b21b321_2000x962.png" width="1456" height="700" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/68e9eca3-764e-486a-beee-0b7e0b21b321_2000x962.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:700,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:617351,&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://blog.levelupcoding.com/i/199286433?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68e9eca3-764e-486a-beee-0b7e0b21b321_2000x962.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_!nBqg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68e9eca3-764e-486a-beee-0b7e0b21b321_2000x962.png 424w, https://substackcdn.com/image/fetch/$s_!nBqg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68e9eca3-764e-486a-beee-0b7e0b21b321_2000x962.png 848w, https://substackcdn.com/image/fetch/$s_!nBqg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68e9eca3-764e-486a-beee-0b7e0b21b321_2000x962.png 1272w, https://substackcdn.com/image/fetch/$s_!nBqg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68e9eca3-764e-486a-beee-0b7e0b21b321_2000x962.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 aria-hidden="true" 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><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>REST gives you:</p><ul><li><p><strong>Browser reach</strong> &#8594; Standard HTTP works everywhere without special tooling</p></li><li><p><strong>Cacheability</strong> &#8594; GET requests work naturally with browsers, proxies, and CDNs</p></li><li><p><strong>Simplicity</strong> &#8594; Most developers already understand URLs, headers, and status codes</p></li><li><p><strong>Public API friendliness</strong> &#8594; Requests are easy to inspect, test, and debug</p></li></ul><p>The tradeoff is composition.</p><p>If a single screen needs products, reviews, recommendations, inventory, and shipping data, REST can turn into multiple round trips. You can create larger endpoints, but clients often receive far more data than they actually use.</p><p>Use REST when stability, simplicity, and web infrastructure matter more than fine-grained data control.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!65m7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12809ff0-3dbc-497f-93de-13b75c628b4e_2000x871.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!65m7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12809ff0-3dbc-497f-93de-13b75c628b4e_2000x871.png 424w, https://substackcdn.com/image/fetch/$s_!65m7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12809ff0-3dbc-497f-93de-13b75c628b4e_2000x871.png 848w, https://substackcdn.com/image/fetch/$s_!65m7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12809ff0-3dbc-497f-93de-13b75c628b4e_2000x871.png 1272w, https://substackcdn.com/image/fetch/$s_!65m7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12809ff0-3dbc-497f-93de-13b75c628b4e_2000x871.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!65m7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12809ff0-3dbc-497f-93de-13b75c628b4e_2000x871.png" width="1456" height="634" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/12809ff0-3dbc-497f-93de-13b75c628b4e_2000x871.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:634,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:415191,&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://blog.levelupcoding.com/i/199286433?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12809ff0-3dbc-497f-93de-13b75c628b4e_2000x871.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_!65m7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12809ff0-3dbc-497f-93de-13b75c628b4e_2000x871.png 424w, https://substackcdn.com/image/fetch/$s_!65m7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12809ff0-3dbc-497f-93de-13b75c628b4e_2000x871.png 848w, https://substackcdn.com/image/fetch/$s_!65m7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12809ff0-3dbc-497f-93de-13b75c628b4e_2000x871.png 1272w, https://substackcdn.com/image/fetch/$s_!65m7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12809ff0-3dbc-497f-93de-13b75c628b4e_2000x871.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 aria-hidden="true" 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><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><h2>GraphQL: the choice for client-shaped data</h2><p>GraphQL solves a different problem: different clients often need different views of the same data.</p><p>A mobile app may only need a product name and price. An admin dashboard may also need inventory, supplier details, and audit history. With REST, you either create many specialized endpoints or return oversized responses that waste bandwidth.</p><p>GraphQL lets clients request the exact shape they need.</p><p>A view can ask for:</p><ul><li><p>Product name</p></li><li><p>Price</p></li><li><p>Inventory status</p></li><li><p>First three reviews</p></li></ul><p>Nothing more.</p><p>The server validates every query against a schema, which is a typed definition of what clients are allowed to request. That schema becomes a shared contract between frontend and backend teams.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!IvWF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1457c8a0-c8c2-4329-9d52-0390cccfebf1_2000x906.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IvWF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1457c8a0-c8c2-4329-9d52-0390cccfebf1_2000x906.png 424w, https://substackcdn.com/image/fetch/$s_!IvWF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1457c8a0-c8c2-4329-9d52-0390cccfebf1_2000x906.png 848w, https://substackcdn.com/image/fetch/$s_!IvWF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1457c8a0-c8c2-4329-9d52-0390cccfebf1_2000x906.png 1272w, https://substackcdn.com/image/fetch/$s_!IvWF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1457c8a0-c8c2-4329-9d52-0390cccfebf1_2000x906.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!IvWF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1457c8a0-c8c2-4329-9d52-0390cccfebf1_2000x906.png" width="1456" height="660" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1457c8a0-c8c2-4329-9d52-0390cccfebf1_2000x906.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:660,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:485201,&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://blog.levelupcoding.com/i/199286433?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1457c8a0-c8c2-4329-9d52-0390cccfebf1_2000x906.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_!IvWF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1457c8a0-c8c2-4329-9d52-0390cccfebf1_2000x906.png 424w, https://substackcdn.com/image/fetch/$s_!IvWF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1457c8a0-c8c2-4329-9d52-0390cccfebf1_2000x906.png 848w, https://substackcdn.com/image/fetch/$s_!IvWF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1457c8a0-c8c2-4329-9d52-0390cccfebf1_2000x906.png 1272w, https://substackcdn.com/image/fetch/$s_!IvWF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1457c8a0-c8c2-4329-9d52-0390cccfebf1_2000x906.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 aria-hidden="true" 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><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>GraphQL gives you:</p><ul><li><p><strong>Flexible field selection</strong> &#8594; Clients avoid over-fetching and under-fetching</p></li><li><p><strong>Strong schema</strong> &#8594; Teams can discover data and generate types automatically</p></li><li><p><strong>Better composition</strong> &#8594; One query can gather all data needed for a screen</p></li><li><p><strong>Frontend independence</strong> &#8594; Web, mobile, and internal tools can request different shapes</p></li></ul><p>The tradeoff shifts to the server.</p><p>Resolvers (responsible for fetching each field) can accidentally trigger large numbers of database calls. A small query can create expensive backend work if you do not control query depth, batching, and caching carefully. Authorization also becomes more complex because many operations flow through a single endpoint.</p><p>Use GraphQL when client data needs vary frequently because it reduces endpoint sprawl while keeping the schema consistent.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5pxO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77c5ee78-996a-4bdd-a4fa-14d1fbfe3465_2000x976.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5pxO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77c5ee78-996a-4bdd-a4fa-14d1fbfe3465_2000x976.png 424w, https://substackcdn.com/image/fetch/$s_!5pxO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77c5ee78-996a-4bdd-a4fa-14d1fbfe3465_2000x976.png 848w, https://substackcdn.com/image/fetch/$s_!5pxO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77c5ee78-996a-4bdd-a4fa-14d1fbfe3465_2000x976.png 1272w, https://substackcdn.com/image/fetch/$s_!5pxO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77c5ee78-996a-4bdd-a4fa-14d1fbfe3465_2000x976.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5pxO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77c5ee78-996a-4bdd-a4fa-14d1fbfe3465_2000x976.png" width="1456" height="711" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/77c5ee78-996a-4bdd-a4fa-14d1fbfe3465_2000x976.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:711,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:428754,&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://blog.levelupcoding.com/i/199286433?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77c5ee78-996a-4bdd-a4fa-14d1fbfe3465_2000x976.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_!5pxO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77c5ee78-996a-4bdd-a4fa-14d1fbfe3465_2000x976.png 424w, https://substackcdn.com/image/fetch/$s_!5pxO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77c5ee78-996a-4bdd-a4fa-14d1fbfe3465_2000x976.png 848w, https://substackcdn.com/image/fetch/$s_!5pxO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77c5ee78-996a-4bdd-a4fa-14d1fbfe3465_2000x976.png 1272w, https://substackcdn.com/image/fetch/$s_!5pxO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77c5ee78-996a-4bdd-a4fa-14d1fbfe3465_2000x976.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 aria-hidden="true" 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><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><h2>gRPC: the go-to for efficient service-to-service calls</h2><p>gRPC works best when both the client and server are controlled by your organization.</p><p>Instead of exposing resources, gRPC exposes services and methods defined in a <code>.proto</code> contract file. Code generation then creates typed clients and servers in different languages, so network calls feel more like local function calls.</p><p>That model fits distributed systems well.</p><p>A checkout service may need to call pricing, inventory, fraud, shipping, and tax services in milliseconds. Those calls need low overhead, strong contracts, retries, deadlines, and sometimes real-time streaming.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!WlOl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97770df0-8e7a-4b5f-9c3c-cfb3f971537a_2000x952.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!WlOl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97770df0-8e7a-4b5f-9c3c-cfb3f971537a_2000x952.png 424w, https://substackcdn.com/image/fetch/$s_!WlOl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97770df0-8e7a-4b5f-9c3c-cfb3f971537a_2000x952.png 848w, https://substackcdn.com/image/fetch/$s_!WlOl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97770df0-8e7a-4b5f-9c3c-cfb3f971537a_2000x952.png 1272w, https://substackcdn.com/image/fetch/$s_!WlOl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97770df0-8e7a-4b5f-9c3c-cfb3f971537a_2000x952.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!WlOl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97770df0-8e7a-4b5f-9c3c-cfb3f971537a_2000x952.png" width="1456" height="693" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/97770df0-8e7a-4b5f-9c3c-cfb3f971537a_2000x952.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:693,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343497,&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://blog.levelupcoding.com/i/199286433?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97770df0-8e7a-4b5f-9c3c-cfb3f971537a_2000x952.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_!WlOl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97770df0-8e7a-4b5f-9c3c-cfb3f971537a_2000x952.png 424w, https://substackcdn.com/image/fetch/$s_!WlOl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97770df0-8e7a-4b5f-9c3c-cfb3f971537a_2000x952.png 848w, https://substackcdn.com/image/fetch/$s_!WlOl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97770df0-8e7a-4b5f-9c3c-cfb3f971537a_2000x952.png 1272w, https://substackcdn.com/image/fetch/$s_!WlOl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97770df0-8e7a-4b5f-9c3c-cfb3f971537a_2000x952.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 aria-hidden="true" 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><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>gRPC gives you:</p><ul><li><p><strong>Strong contracts</strong> &#8594; <code>.proto</code> files define services and message formats clearly</p></li><li><p><strong>Efficient payloads</strong> &#8594; Binary messages are smaller and faster than JSON</p></li><li><p><strong>HTTP/2 support</strong> &#8594; Multiplexing and persistent connections reduce network overhead</p></li><li><p><strong>Streaming support</strong> &#8594; Services can stream data in one or both directions</p></li><li><p><strong>Better service controls</strong> &#8594; Deadlines, retries, and health checks fit internal systems naturally</p></li></ul><p>The tradeoff is browser compatibility.</p><p>Browsers work naturally with plain HTTP and JSON, but gRPC usually needs gRPC-Web and a proxy layer at the edge. That complexity is often acceptable internally, but it creates friction for public-facing APIs.</p><p>Use gRPC for internal service communication because controlled environments benefit most from typed contracts and efficient transport.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QIQs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcddfaa49-72b1-4327-83e4-b0d85948838e_2000x923.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QIQs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcddfaa49-72b1-4327-83e4-b0d85948838e_2000x923.png 424w, https://substackcdn.com/image/fetch/$s_!QIQs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcddfaa49-72b1-4327-83e4-b0d85948838e_2000x923.png 848w, https://substackcdn.com/image/fetch/$s_!QIQs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcddfaa49-72b1-4327-83e4-b0d85948838e_2000x923.png 1272w, https://substackcdn.com/image/fetch/$s_!QIQs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcddfaa49-72b1-4327-83e4-b0d85948838e_2000x923.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QIQs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcddfaa49-72b1-4327-83e4-b0d85948838e_2000x923.png" width="1456" height="672" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cddfaa49-72b1-4327-83e4-b0d85948838e_2000x923.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:672,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:434498,&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://blog.levelupcoding.com/i/199286433?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcddfaa49-72b1-4327-83e4-b0d85948838e_2000x923.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_!QIQs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcddfaa49-72b1-4327-83e4-b0d85948838e_2000x923.png 424w, https://substackcdn.com/image/fetch/$s_!QIQs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcddfaa49-72b1-4327-83e4-b0d85948838e_2000x923.png 848w, https://substackcdn.com/image/fetch/$s_!QIQs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcddfaa49-72b1-4327-83e4-b0d85948838e_2000x923.png 1272w, https://substackcdn.com/image/fetch/$s_!QIQs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcddfaa49-72b1-4327-83e4-b0d85948838e_2000x923.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 aria-hidden="true" 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><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><h2>Side-by-side comparison</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xptA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08310e31-e7c9-4f1e-8942-01e78e2f8e74_2000x1866.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xptA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08310e31-e7c9-4f1e-8942-01e78e2f8e74_2000x1866.png 424w, https://substackcdn.com/image/fetch/$s_!xptA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08310e31-e7c9-4f1e-8942-01e78e2f8e74_2000x1866.png 848w, https://substackcdn.com/image/fetch/$s_!xptA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08310e31-e7c9-4f1e-8942-01e78e2f8e74_2000x1866.png 1272w, https://substackcdn.com/image/fetch/$s_!xptA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08310e31-e7c9-4f1e-8942-01e78e2f8e74_2000x1866.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xptA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08310e31-e7c9-4f1e-8942-01e78e2f8e74_2000x1866.png" width="1456" height="1358" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/08310e31-e7c9-4f1e-8942-01e78e2f8e74_2000x1866.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1358,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:556027,&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://blog.levelupcoding.com/i/199286433?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08310e31-e7c9-4f1e-8942-01e78e2f8e74_2000x1866.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_!xptA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08310e31-e7c9-4f1e-8942-01e78e2f8e74_2000x1866.png 424w, https://substackcdn.com/image/fetch/$s_!xptA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08310e31-e7c9-4f1e-8942-01e78e2f8e74_2000x1866.png 848w, https://substackcdn.com/image/fetch/$s_!xptA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08310e31-e7c9-4f1e-8942-01e78e2f8e74_2000x1866.png 1272w, https://substackcdn.com/image/fetch/$s_!xptA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08310e31-e7c9-4f1e-8942-01e78e2f8e74_2000x1866.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 aria-hidden="true" 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><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><h2>When not to use each</h2><p>Every API style has cases where it becomes the wrong abstraction.</p><p>Avoid REST when clients constantly need data from many related resources in a single screen. Multiple round trips add latency quickly, especially on mobile networks. Teams often respond by building oversized aggregation endpoints, which slowly weakens REST&#8217;s clean resource model.</p><p>Avoid GraphQL when your API is small, stable, and public-facing. Schema governance, query optimization, resolver efficiency, and access control all add operational overhead. If a handful of REST endpoints already solves the problem cleanly, GraphQL can introduce unnecessary complexity.</p><p>Avoid gRPC when browsers or third parties are your primary consumers. gRPC-Web works, but it requires extra proxy infrastructure and specialized tooling. For public web APIs, REST or GraphQL is usually the simpler choice.</p><h2>The pattern most systems end up using</h2><p>Most production systems do not choose a single API style. They choose boundaries.</p><p>A common pattern is:</p><ul><li><p><strong>REST or GraphQL at the edge</strong> &#8594; Where browsers, mobile apps, and third parties interact</p></li><li><p><strong>gRPC internally</strong> &#8594; Where services benefit from fast transport, typed contracts, retries, and streaming</p></li></ul><p>For example, a product catalog may expose a REST API that CDNs cache aggressively. A mobile app may query a GraphQL layer to fetch only the fields needed for a screen. Behind that layer, internal services communicate through gRPC using compact protobuf messages and deadline-aware calls.</p><p>The architecture works because each technology sits where its strengths matter most.</p><p>The trap isn&#8217;t choosing the wrong one. It&#8217;s choosing one and using it everywhere. Most systems benefit from treating these as complementary layers, not competing philosophies.</p><div><hr></div><p>&#128075; If you found this useful &#8594; Like + Restack to help others learn system design.</p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Subscribe to get high-signal, clear, and visual system design breakdowns straight to your inbox:&nbsp;</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Service Discovery in Distributed Systems Clearly Explained]]></title><description><![CDATA[How modern systems dynamically locate healthy services as infrastructure constantly changes.]]></description><link>https://blog.levelupcoding.com/p/service-discovery-in-distributed-systems</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/service-discovery-in-distributed-systems</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Wed, 13 May 2026 10:37:55 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/0501d4c4-ab43-407e-9709-f0ab85dffcb6_2400x1260.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Get our 142-page System Design Handbook for FREE on newsletter signup:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2><a href="https://lucode.co/ai-developer-hub-oracle-z57nl">AI Developer Hub: Patterns, Architectures, and Guides in One Repo</a></h2><h5>Presented by Oracle</h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ok1F!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ok1F!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png 424w, https://substackcdn.com/image/fetch/$s_!ok1F!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png 848w, https://substackcdn.com/image/fetch/$s_!ok1F!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png 1272w, https://substackcdn.com/image/fetch/$s_!ok1F!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ok1F!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png" width="1456" height="868" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:868,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:249833,&quot;alt&quot;:&quot;&quot;,&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://blog.levelupcoding.com/i/190397808?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.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_!ok1F!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png 424w, https://substackcdn.com/image/fetch/$s_!ok1F!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png 848w, https://substackcdn.com/image/fetch/$s_!ok1F!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png 1272w, https://substackcdn.com/image/fetch/$s_!ok1F!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.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 aria-hidden="true" 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><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><a href="https://lucode.co/ai-developer-hub-oracle-z57nl">Oracle AI Developer Hub</a></strong> is a curated collection of real-world examples, architectures, and guides for building AI-powered applications. From RAG pipelines to agent-based systems, and everything in between. Star it to keep it bookmarked, this repo will keep growing, and you&#8217;ll want it on hand as you build.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://lucode.co/ai-developer-hub-oracle-z57nl&quot;,&quot;text&quot;:&quot;Explore and Star the Repo&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://lucode.co/ai-developer-hub-oracle-z57nl"><span>Explore and Star the Repo</span></a></p><div><hr></div><h1>Service Discovery in Distributed Systems</h1><p>In distributed systems, services appear, disappear, and relocate constantly.</p><p>If you don&#8217;t have a way to track them, your calls will end up in the void.</p><p>Service discovery solves this problem by always pointing clients to a healthy, live instance.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Vpgv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61c5729d-9616-45a9-9e40-e918097b6b06_2000x1135.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Vpgv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61c5729d-9616-45a9-9e40-e918097b6b06_2000x1135.png 424w, https://substackcdn.com/image/fetch/$s_!Vpgv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61c5729d-9616-45a9-9e40-e918097b6b06_2000x1135.png 848w, https://substackcdn.com/image/fetch/$s_!Vpgv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61c5729d-9616-45a9-9e40-e918097b6b06_2000x1135.png 1272w, https://substackcdn.com/image/fetch/$s_!Vpgv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61c5729d-9616-45a9-9e40-e918097b6b06_2000x1135.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Vpgv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61c5729d-9616-45a9-9e40-e918097b6b06_2000x1135.png" width="1456" height="826" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/61c5729d-9616-45a9-9e40-e918097b6b06_2000x1135.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:826,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:471392,&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://blog.levelupcoding.com/i/174425013?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61c5729d-9616-45a9-9e40-e918097b6b06_2000x1135.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_!Vpgv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61c5729d-9616-45a9-9e40-e918097b6b06_2000x1135.png 424w, https://substackcdn.com/image/fetch/$s_!Vpgv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61c5729d-9616-45a9-9e40-e918097b6b06_2000x1135.png 848w, https://substackcdn.com/image/fetch/$s_!Vpgv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61c5729d-9616-45a9-9e40-e918097b6b06_2000x1135.png 1272w, https://substackcdn.com/image/fetch/$s_!Vpgv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61c5729d-9616-45a9-9e40-e918097b6b06_2000x1135.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 aria-hidden="true" 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><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><h2>The problem</h2><p>A payments service that worked yesterday on one IP might be gone today. If your application still points to the old address, every request ends in failure.</p><p>Now add dozens of microservices, each with multiple replicas, and you have a system where connections break whenever the environment shifts.</p><p>Static approaches like hard-coding addresses or juggling config files might hold up in a small setup, but they collapse under the churn of microservices.</p><p>What&#8217;s needed is a way to always know which instances are alive and how to reach them.</p><p>That&#8217;s the role of service discovery. Instead of binding calls to fixed addresses, it keeps a live registry of running instances and resolves a simple name like <code>inventory-service</code> into a healthy endpoint at runtime.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YM0N!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feef1351a-7506-4e43-b34b-3870dc4f8ce0_2000x1057.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YM0N!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feef1351a-7506-4e43-b34b-3870dc4f8ce0_2000x1057.png 424w, https://substackcdn.com/image/fetch/$s_!YM0N!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feef1351a-7506-4e43-b34b-3870dc4f8ce0_2000x1057.png 848w, https://substackcdn.com/image/fetch/$s_!YM0N!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feef1351a-7506-4e43-b34b-3870dc4f8ce0_2000x1057.png 1272w, https://substackcdn.com/image/fetch/$s_!YM0N!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feef1351a-7506-4e43-b34b-3870dc4f8ce0_2000x1057.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YM0N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feef1351a-7506-4e43-b34b-3870dc4f8ce0_2000x1057.png" width="1456" height="769" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/eef1351a-7506-4e43-b34b-3870dc4f8ce0_2000x1057.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:769,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:452304,&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://blog.levelupcoding.com/i/174425013?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feef1351a-7506-4e43-b34b-3870dc4f8ce0_2000x1057.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_!YM0N!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feef1351a-7506-4e43-b34b-3870dc4f8ce0_2000x1057.png 424w, https://substackcdn.com/image/fetch/$s_!YM0N!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feef1351a-7506-4e43-b34b-3870dc4f8ce0_2000x1057.png 848w, https://substackcdn.com/image/fetch/$s_!YM0N!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feef1351a-7506-4e43-b34b-3870dc4f8ce0_2000x1057.png 1272w, https://substackcdn.com/image/fetch/$s_!YM0N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feef1351a-7506-4e43-b34b-3870dc4f8ce0_2000x1057.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 aria-hidden="true" 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><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><h2>The benefits</h2><ul><li><p><strong>Dynamic scaling</strong> &#8594; New instances register automatically, so traffic flows without manual updates.</p></li><li><p><strong>Fault tolerance</strong> &#8594; Dead or unhealthy instances drop out, keeping requests routed to live services.</p></li><li><p><strong>Load distribution</strong> &#8594; Requests spread across instances, avoiding overload on a single node.</p></li><li><p><strong>Location transparency</strong> &#8594; Clients call by name, not by IP, decoupling deployments from connectivity.</p></li><li><p><strong>Polyglot support</strong> &#8594; Any language or framework can participate, as long as it can query the registry.</p></li><li><p><strong>Faster iteration</strong> &#8594; Teams deploy services independently without reconfiguring every other client.</p></li><li><p><strong>Operational consistency</strong> &#8594; A single naming and lookup system replaces scattered configs.</p></li></ul><h2>Client-side discovery</h2><p>In client-side discovery, the service making the call is responsible for finding a healthy instance of the target service.</p><p>The client queries the service registry, receives a list of available endpoints, and then applies its own load balancing logic to pick an endpoint. Once selected, the client sends the request directly, with no middle layer in between.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YYFS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a769972-772d-4ffd-9c2f-69d993370ed3_2000x1115.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YYFS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a769972-772d-4ffd-9c2f-69d993370ed3_2000x1115.png 424w, https://substackcdn.com/image/fetch/$s_!YYFS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a769972-772d-4ffd-9c2f-69d993370ed3_2000x1115.png 848w, https://substackcdn.com/image/fetch/$s_!YYFS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a769972-772d-4ffd-9c2f-69d993370ed3_2000x1115.png 1272w, https://substackcdn.com/image/fetch/$s_!YYFS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a769972-772d-4ffd-9c2f-69d993370ed3_2000x1115.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YYFS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a769972-772d-4ffd-9c2f-69d993370ed3_2000x1115.png" width="1456" height="812" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0a769972-772d-4ffd-9c2f-69d993370ed3_2000x1115.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:812,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:398197,&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://blog.levelupcoding.com/i/174425013?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a769972-772d-4ffd-9c2f-69d993370ed3_2000x1115.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_!YYFS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a769972-772d-4ffd-9c2f-69d993370ed3_2000x1115.png 424w, https://substackcdn.com/image/fetch/$s_!YYFS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a769972-772d-4ffd-9c2f-69d993370ed3_2000x1115.png 848w, https://substackcdn.com/image/fetch/$s_!YYFS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a769972-772d-4ffd-9c2f-69d993370ed3_2000x1115.png 1272w, https://substackcdn.com/image/fetch/$s_!YYFS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a769972-772d-4ffd-9c2f-69d993370ed3_2000x1115.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 aria-hidden="true" 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><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 benefits</h3><ul><li><p><strong>Lower latency</strong> &#8594; Requests go straight from client to service without an extra network hop.</p></li><li><p><strong>Fine-grained control</strong> &#8594; Clients can choose their own load-balancing strategy or routing rules.</p></li><li><p><strong>Simpler infrastructure</strong> &#8594; No central router or proxy to deploy and maintain.</p></li><li><p><strong>Predictable performance</strong> &#8594; Each service handles its own lookups, avoiding potential bottlenecks in a shared routing tier.</p></li></ul><h3>The tradeoffs</h3><ul><li><p><strong>Added complexity in clients</strong> &#8594; Every service must include discovery logic or a sidecar, often across multiple languages.</p></li><li><p><strong>Higher maintenance burden</strong> &#8594; Polyglot systems require consistent libraries or tooling in each stack.</p></li><li><p><strong>Tighter coupling</strong> &#8594; Clients become aware of registry details, making it harder to swap out technologies later.</p></li><li><p><strong>Risk of duplicated logic</strong> &#8594; Without careful standardization, different teams may implement discovery inconsistently.</p></li></ul><p>Client-side discovery shines when you value direct connections and low latency, and when your teams can standardize on a shared library or sidecar pattern. But if simplicity in clients or language diversity is a priority, the tradeoffs can outweigh the benefits.</p><h2>Server-side discovery</h2><p>In server-side discovery, the client doesn&#8217;t talk to the registry at all.</p><p>Instead, it sends every request to a stable endpoint; usually a load balancer, reverse proxy, or gateway. That component then queries the registry, picks a healthy instance, and forwards the request on the client&#8217;s behalf.</p><p>From the client&#8217;s perspective, it&#8217;s always calling the same address, regardless of where services are actually running.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Xmge!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe71b9d3f-e70e-4126-ac1d-6f9c1542cc99_2000x1135.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Xmge!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe71b9d3f-e70e-4126-ac1d-6f9c1542cc99_2000x1135.png 424w, https://substackcdn.com/image/fetch/$s_!Xmge!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe71b9d3f-e70e-4126-ac1d-6f9c1542cc99_2000x1135.png 848w, https://substackcdn.com/image/fetch/$s_!Xmge!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe71b9d3f-e70e-4126-ac1d-6f9c1542cc99_2000x1135.png 1272w, https://substackcdn.com/image/fetch/$s_!Xmge!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe71b9d3f-e70e-4126-ac1d-6f9c1542cc99_2000x1135.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Xmge!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe71b9d3f-e70e-4126-ac1d-6f9c1542cc99_2000x1135.png" width="1456" height="826" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e71b9d3f-e70e-4126-ac1d-6f9c1542cc99_2000x1135.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:826,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:471392,&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://blog.levelupcoding.com/i/174425013?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe71b9d3f-e70e-4126-ac1d-6f9c1542cc99_2000x1135.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_!Xmge!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe71b9d3f-e70e-4126-ac1d-6f9c1542cc99_2000x1135.png 424w, https://substackcdn.com/image/fetch/$s_!Xmge!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe71b9d3f-e70e-4126-ac1d-6f9c1542cc99_2000x1135.png 848w, https://substackcdn.com/image/fetch/$s_!Xmge!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe71b9d3f-e70e-4126-ac1d-6f9c1542cc99_2000x1135.png 1272w, https://substackcdn.com/image/fetch/$s_!Xmge!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe71b9d3f-e70e-4126-ac1d-6f9c1542cc99_2000x1135.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 aria-hidden="true" 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><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 benefits</h3><ul><li><p><strong>Simpler clients</strong> &#8594; Every client calls the same stable endpoint with no extra logic required.</p></li><li><p><strong>Easier polyglot support</strong> &#8594; One routing tier works for all languages and frameworks.</p></li><li><p><strong>Centralized control</strong> &#8594; Load-balancing, retries, and security policies can be managed in one place.</p></li><li><p><strong>Operational consistency</strong> &#8594; A single router can log, monitor, and enforce rules across all requests.</p></li></ul><h3>The tradeoffs</h3><ul><li><p><strong>Extra network hop</strong> &#8594; Each request passes through a proxy or load balancer, adding some latency.</p></li><li><p><strong>Infrastructure dependency</strong> &#8594; The router or proxy must be highly available, since it becomes part of the critical path.</p></li><li><p><strong>Operational overhead</strong> &#8594; Teams need to run, scale, and monitor an additional component.</p></li><li><p><strong>Less flexibility in clients</strong> &#8594; Custom routing strategies are harder, since decision-making happens elsewhere.</p></li></ul><p>Server-side discovery works best when your system has many different kinds of clients, or when you want to centralize complexity in the platform instead of scattering it across services. The tradeoff is accepting one more hop in exchange for simpler and more uniform clients.</p><h2>Recap</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!1ygN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1628d9c-e95c-46a7-805f-7cf43d850962_2000x1118.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1ygN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1628d9c-e95c-46a7-805f-7cf43d850962_2000x1118.png 424w, https://substackcdn.com/image/fetch/$s_!1ygN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1628d9c-e95c-46a7-805f-7cf43d850962_2000x1118.png 848w, https://substackcdn.com/image/fetch/$s_!1ygN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1628d9c-e95c-46a7-805f-7cf43d850962_2000x1118.png 1272w, https://substackcdn.com/image/fetch/$s_!1ygN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1628d9c-e95c-46a7-805f-7cf43d850962_2000x1118.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1ygN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1628d9c-e95c-46a7-805f-7cf43d850962_2000x1118.png" width="1456" height="814" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c1628d9c-e95c-46a7-805f-7cf43d850962_2000x1118.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:814,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:498042,&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://blog.levelupcoding.com/i/174425013?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1628d9c-e95c-46a7-805f-7cf43d850962_2000x1118.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_!1ygN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1628d9c-e95c-46a7-805f-7cf43d850962_2000x1118.png 424w, https://substackcdn.com/image/fetch/$s_!1ygN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1628d9c-e95c-46a7-805f-7cf43d850962_2000x1118.png 848w, https://substackcdn.com/image/fetch/$s_!1ygN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1628d9c-e95c-46a7-805f-7cf43d850962_2000x1118.png 1272w, https://substackcdn.com/image/fetch/$s_!1ygN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1628d9c-e95c-46a7-805f-7cf43d850962_2000x1118.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 aria-hidden="true" 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><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 discovery may run quietly in the background, but it&#8217;s one of the foundations of modern distributed systems.</p><p>Without it, scaling, deploying, or even just keeping services connected becomes a fragile mess of broken addresses and manual fixes.</p><p>Even if you get service discovery &#8220;for free,&#8221; knowing the patterns and tradeoffs makes you better equipped to debug failures, scale confidently, and design services that can evolve.</p><p>Think of service discovery not as an add-on, but as a design principle that allows distributed systems to operate as a cohesive whole instead of disconnected pieces.</p><div><hr></div><p>&#128075; If you found this useful &#8594; Like + Restack to help others learn system design.</p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Subscribe to get high-signal, clear, and visual system design breakdowns straight to your inbox:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Docker vs Kubernetes]]></title><description><![CDATA[(4 min read) | The real difference that actually matters, how to decide, where teams go wrong, and more...]]></description><link>https://blog.levelupcoding.com/p/docker-vs-kubernetes</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/docker-vs-kubernetes</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Mon, 11 May 2026 12:32:56 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/82010dd4-b348-4fff-87a6-b4e76a7950c0_2400x1260.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Get our 142-page System Design Handbook for FREE on newsletter signup:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2><a href="https://lucode.co/codecrafters-nikkisiapno-40off">Build Kafka, Redis, Git, &amp; Claude Code From Scratch</a></h2><h5>Presented by CodeCrafters</h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!bIBu!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc50fc70-4a40-4ad4-9684-5ec6742c583b_1200x630.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!bIBu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc50fc70-4a40-4ad4-9684-5ec6742c583b_1200x630.jpeg 424w, https://substackcdn.com/image/fetch/$s_!bIBu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc50fc70-4a40-4ad4-9684-5ec6742c583b_1200x630.jpeg 848w, https://substackcdn.com/image/fetch/$s_!bIBu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc50fc70-4a40-4ad4-9684-5ec6742c583b_1200x630.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!bIBu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc50fc70-4a40-4ad4-9684-5ec6742c583b_1200x630.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!bIBu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc50fc70-4a40-4ad4-9684-5ec6742c583b_1200x630.jpeg" width="1200" height="630" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dc50fc70-4a40-4ad4-9684-5ec6742c583b_1200x630.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:630,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:238686,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.levelupcoding.com/i/194073685?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc50fc70-4a40-4ad4-9684-5ec6742c583b_1200x630.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_!bIBu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc50fc70-4a40-4ad4-9684-5ec6742c583b_1200x630.jpeg 424w, https://substackcdn.com/image/fetch/$s_!bIBu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc50fc70-4a40-4ad4-9684-5ec6742c583b_1200x630.jpeg 848w, https://substackcdn.com/image/fetch/$s_!bIBu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc50fc70-4a40-4ad4-9684-5ec6742c583b_1200x630.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!bIBu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc50fc70-4a40-4ad4-9684-5ec6742c583b_1200x630.jpeg 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 aria-hidden="true" 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><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>Want to become a better software engineer?</p><p>Trusted by engineers at Google, Anthropic, and Vercel, CodeCrafters helps you rebuild technologies like <a href="https://lucode.co/kafka-codecrafters">Kafka</a>, <a href="https://lucode.co/codecrafters-redis">Redis</a>, <a href="https://lucode.co/git-codecrafters">Git</a>, and <a href="https://lucode.co/claude-code-codecrafters">Claude Code</a> from scratch so you can deeply understand how real systems work.</p><p>We&#8217;ve partnered with <a href="https://lucode.co/codecrafters-nikkisiapno-40off">CodeCrafters</a> to give LUC readers an <a href="https://lucode.co/codecrafters-nikkisiapno-40off">exclusive 40% lifetime discount</a>.</p><p>&#128161; Many engineers <a href="https://codecrafters.io/expense">expense platforms like this through their team&#8217;s learning budget</a>.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://lucode.co/codecrafters-nikkisiapno-40off&quot;,&quot;text&quot;:&quot;Start Building &amp; Unlock 40% Off&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://lucode.co/codecrafters-nikkisiapno-40off"><span>Start Building &amp; Unlock 40% Off</span></a></p><div><hr></div><h1>Docker vs Kubernetes: The Real Difference That Matters</h1><p>Docker and Kubernetes are often framed as competitors. That framing leads to the wrong decisions.</p><p>One is about <strong>packaging and running software</strong>. The other is about <strong>managing it at scale</strong>.</p><p>Treating them as rivals is what leads teams to swap one out for the other at exactly the wrong time; either staying on Docker long past the point where orchestration would help, or jumping to Kubernetes before the complexity is justified.</p><p>The gap between them is more specific than it first appears, and closing it starts with understanding what each tool is actually responsible for.</p><h2>What Docker actually solves</h2><p>Docker is a container platform. It solves a very specific problem:<br>&#8220;How do I package and run my application reliably anywhere?&#8221;</p><p>It does this through a few core components:</p><ul><li><p><strong>Images</strong> &#8594; Immutable blueprints of your app</p></li><li><p><strong>Containers</strong> &#8594; Running instances of those images</p></li><li><p><strong>Daemon</strong> &#8594; The engine that manages everything</p></li><li><p><strong>Docker Client</strong> &#8594; The command-line interface (CLI) tool that you use to interact with the Docker daemon</p></li><li><p><strong>Compose</strong> &#8594; Defines multi-container apps on one machine</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3CPu!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F391ff805-2a5a-4e80-b987-f42fc28dbe68_2000x918.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3CPu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F391ff805-2a5a-4e80-b987-f42fc28dbe68_2000x918.png 424w, https://substackcdn.com/image/fetch/$s_!3CPu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F391ff805-2a5a-4e80-b987-f42fc28dbe68_2000x918.png 848w, https://substackcdn.com/image/fetch/$s_!3CPu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F391ff805-2a5a-4e80-b987-f42fc28dbe68_2000x918.png 1272w, https://substackcdn.com/image/fetch/$s_!3CPu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F391ff805-2a5a-4e80-b987-f42fc28dbe68_2000x918.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3CPu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F391ff805-2a5a-4e80-b987-f42fc28dbe68_2000x918.png" width="1456" height="668" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/391ff805-2a5a-4e80-b987-f42fc28dbe68_2000x918.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:668,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:723456,&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://blog.levelupcoding.com/i/194073685?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F391ff805-2a5a-4e80-b987-f42fc28dbe68_2000x918.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_!3CPu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F391ff805-2a5a-4e80-b987-f42fc28dbe68_2000x918.png 424w, https://substackcdn.com/image/fetch/$s_!3CPu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F391ff805-2a5a-4e80-b987-f42fc28dbe68_2000x918.png 848w, https://substackcdn.com/image/fetch/$s_!3CPu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F391ff805-2a5a-4e80-b987-f42fc28dbe68_2000x918.png 1272w, https://substackcdn.com/image/fetch/$s_!3CPu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F391ff805-2a5a-4e80-b987-f42fc28dbe68_2000x918.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 aria-hidden="true" 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><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 Docker client sends instructions to the Docker daemon, which manages images, containers, networks, and volumes. Docker Compose sits one layer above, letting you define multi-container apps in a YAML file and start them with a single command.</p><p>Docker Swarm is Docker&#8217;s built-in clustering mode. Manager nodes maintain cluster state using a Raft consensus protocol; worker nodes execute containers.</p><h3>Where Docker works best</h3><ul><li><p>Local development</p></li><li><p>CI pipelines</p></li><li><p>Small production deployments</p></li><li><p>Single-server applications</p></li></ul><h3>What you gain</h3><ul><li><p><strong>Fast setup</strong> &#8594; Run apps with one command</p></li><li><p><strong>Predictability</strong> &#8594; Same container everywhere</p></li><li><p><strong>Low operational overhead</strong> &#8594; Fewer moving parts</p></li></ul><h3>Where it breaks</h3><ul><li><p><strong>Multi-node scaling</strong> &#8594; Limited native orchestration compared to Kubernetes</p></li><li><p><strong>Self-healing</strong> &#8594; Containers don&#8217;t restart intelligently across hosts</p></li><li><p><strong>Complex deployments</strong> &#8594; Rolling updates and traffic routing are manual</p></li></ul><p>Docker focuses on building images, running containers, and managing them on a host.</p><h2>What Kubernetes actually solves</h2><p>Kubernetes is an orchestration system. It answers a different question:<br>&#8220;How do I run thousands of containers reliably across many machines?&#8221;</p><p>It introduces a control loop: you declare what you want, and the system keeps correcting reality until it matches.</p><p>Here are the key components:</p><ul><li><p><strong>Pod</strong> &#8594; Smallest deployable unit</p></li><li><p><strong>Control plane</strong> &#8594; API server, scheduler, controllers</p></li><li><p><strong>Nodes</strong> &#8594; Machines that run workloads</p></li><li><p><strong>Services</strong> &#8594; Stable endpoints for dynamic pods</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8eq6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3a3b89-9b82-4f8f-83e6-a8e1bf7349c9_2000x1000.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8eq6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3a3b89-9b82-4f8f-83e6-a8e1bf7349c9_2000x1000.png 424w, https://substackcdn.com/image/fetch/$s_!8eq6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3a3b89-9b82-4f8f-83e6-a8e1bf7349c9_2000x1000.png 848w, https://substackcdn.com/image/fetch/$s_!8eq6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3a3b89-9b82-4f8f-83e6-a8e1bf7349c9_2000x1000.png 1272w, https://substackcdn.com/image/fetch/$s_!8eq6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3a3b89-9b82-4f8f-83e6-a8e1bf7349c9_2000x1000.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8eq6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3a3b89-9b82-4f8f-83e6-a8e1bf7349c9_2000x1000.png" width="1456" height="728" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/db3a3b89-9b82-4f8f-83e6-a8e1bf7349c9_2000x1000.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;:925448,&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://blog.levelupcoding.com/i/194073685?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3a3b89-9b82-4f8f-83e6-a8e1bf7349c9_2000x1000.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_!8eq6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3a3b89-9b82-4f8f-83e6-a8e1bf7349c9_2000x1000.png 424w, https://substackcdn.com/image/fetch/$s_!8eq6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3a3b89-9b82-4f8f-83e6-a8e1bf7349c9_2000x1000.png 848w, https://substackcdn.com/image/fetch/$s_!8eq6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3a3b89-9b82-4f8f-83e6-a8e1bf7349c9_2000x1000.png 1272w, https://substackcdn.com/image/fetch/$s_!8eq6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3a3b89-9b82-4f8f-83e6-a8e1bf7349c9_2000x1000.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 aria-hidden="true" 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><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>Kubernetes is architecturally richer. Its control plane includes an API server, a scheduler, a controller manager, and <code>etcd</code> (a distributed key-value store that holds all cluster state). Worker nodes run a <code>kubelet</code> (which ensures Pods stay running), <code>kube-proxy</code> (which handles network routing), and a container runtime like containerd.</p><h3>Where Kubernetes works best</h3><ul><li><p>Multi-service architectures</p></li><li><p>High-availability systems</p></li><li><p>Large-scale platforms</p></li><li><p>Teams needing standardized deployment workflows</p></li></ul><h3>What you gain</h3><ul><li><p><strong>Self-healing</strong> &#8594; Failed containers restart automatically</p></li><li><p><strong>Autoscaling</strong> &#8594; Add/remove instances based on demand</p></li><li><p><strong>Rolling updates</strong> &#8594; Deploy without downtime</p></li><li><p><strong>Service discovery</strong> &#8594; Built-in networking abstractions</p></li></ul><h3>What it costs</h3><ul><li><p><strong>Operational complexity</strong> &#8594; Many components to manage</p></li><li><p><strong>Learning curve</strong> &#8594; Concepts like Pods, Services, RBAC</p></li><li><p><strong>Infrastructure overhead</strong> &#8594; Control plane + networking + storage</p></li></ul><p>Kubernetes supports clusters with thousands of nodes, but that power comes with significant complexity.</p><h2>The comparison at a glance</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VKHb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821ca84-0441-412a-ab89-4a8e848e279a_2000x1302.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VKHb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821ca84-0441-412a-ab89-4a8e848e279a_2000x1302.png 424w, https://substackcdn.com/image/fetch/$s_!VKHb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821ca84-0441-412a-ab89-4a8e848e279a_2000x1302.png 848w, https://substackcdn.com/image/fetch/$s_!VKHb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821ca84-0441-412a-ab89-4a8e848e279a_2000x1302.png 1272w, https://substackcdn.com/image/fetch/$s_!VKHb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821ca84-0441-412a-ab89-4a8e848e279a_2000x1302.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VKHb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821ca84-0441-412a-ab89-4a8e848e279a_2000x1302.png" width="1456" height="948" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1821ca84-0441-412a-ab89-4a8e848e279a_2000x1302.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:948,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:387671,&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://blog.levelupcoding.com/i/194073685?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821ca84-0441-412a-ab89-4a8e848e279a_2000x1302.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_!VKHb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821ca84-0441-412a-ab89-4a8e848e279a_2000x1302.png 424w, https://substackcdn.com/image/fetch/$s_!VKHb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821ca84-0441-412a-ab89-4a8e848e279a_2000x1302.png 848w, https://substackcdn.com/image/fetch/$s_!VKHb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821ca84-0441-412a-ab89-4a8e848e279a_2000x1302.png 1272w, https://substackcdn.com/image/fetch/$s_!VKHb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1821ca84-0441-412a-ab89-4a8e848e279a_2000x1302.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 aria-hidden="true" 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><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><h2>How they actually work together</h2><p>The real-world setup is not &#8220;Docker vs Kubernetes.&#8221; It&#8217;s:</p><ul><li><p>Docker builds the image</p></li><li><p>A registry stores it</p></li><li><p>Kubernetes runs and manages it</p></li></ul><p>This separation matters because it keeps concerns clean:</p><ul><li><p>Build once (Docker)</p></li><li><p>Run anywhere (Kubernetes)</p></li></ul><p>Even though Kubernetes removed direct Docker runtime support, it still runs Docker-built images through OCI-compatible runtimes.</p><h2>How to decide</h2><h3>When Docker is enough</h3><p>You don&#8217;t need Kubernetes just because it exists.</p><p>Use Docker alone when:</p><ul><li><p>You run on a single server</p></li><li><p>Your system has few services</p></li><li><p>Downtime during deploys is acceptable</p></li><li><p>Your team prefers simplicity over automation</p></li></ul><p>Because every added abstraction has a cost. If you don&#8217;t need orchestration, Kubernetes becomes overhead, not value.</p><h3>When Kubernetes is worth it</h3><p>Kubernetes becomes the right choice when coordination starts hurting.</p><p>Use it when:</p><ul><li><p>You deploy across multiple machines</p></li><li><p>You need zero-downtime deployments</p></li><li><p>Traffic fluctuates and needs autoscaling</p></li><li><p>You run many services with independent lifecycles</p></li></ul><p>Because Kubernetes solves <strong>coordination problems</strong>, not just runtime problems.</p><h2>Where teams go wrong</h2><p>Most mistakes come from using the right tool at the wrong stage.</p><p><strong>1. Starting with Kubernetes too early</strong></p><ul><li><p>Adds complexity before it solves real problems</p></li><li><p>Slows development and onboarding</p></li></ul><p><strong>2. Scaling Docker beyond its limits</strong></p><ul><li><p>Manual scripts replace missing orchestration</p></li><li><p>Reliability becomes fragile</p></li></ul><p><strong>3. Treating them as interchangeable</strong></p><ul><li><p>Leads to poor architecture decisions</p></li></ul><p>The ideal mindset is this: <strong>Use the simplest tool that solves your current problem.</strong></p><h2>Final takeaway</h2><p>Start simple. Stay simple as long as you can.</p><p>Then, when scaling turns into coordination problems, reach for Kubernetes.</p><p>Docker is where most systems should begin. Kubernetes is where many systems eventually need to go.</p><p>The transition is a response to real complexity.</p><div><hr></div><p>&#128075; If you liked this post &#8594; Like + Restack + Share to help others learn system design.</p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">&nbsp;Subscribe to get high-signal, clear, and visual system design breakdowns straight to your inbox:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[OAuth Clearly Explained]]></title><description><![CDATA[(4 min read) | OAuth flow, three different tokens, three different jobs, what OAuth actually solves, where OAuth systems usually break, and more]]></description><link>https://blog.levelupcoding.com/p/oauth-clearly-explained</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/oauth-clearly-explained</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Fri, 01 May 2026 05:56:21 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/fc326d43-dbd6-4f79-81cf-49ed3edcf682_2400x1260.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Get our 142-page System Design Handbook for FREE on newsletter signup:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2><a href="https://lucode.co/ai-developer-hub-oracle-z7nl">AI Code, Architectures, and Patterns in One Repo</a></h2><h5>Presented by Oracle</h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ok1F!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ok1F!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png 424w, https://substackcdn.com/image/fetch/$s_!ok1F!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png 848w, https://substackcdn.com/image/fetch/$s_!ok1F!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png 1272w, https://substackcdn.com/image/fetch/$s_!ok1F!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ok1F!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png" width="1456" height="868" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:868,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:249833,&quot;alt&quot;:&quot;&quot;,&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://blog.levelupcoding.com/i/190397808?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.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_!ok1F!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png 424w, https://substackcdn.com/image/fetch/$s_!ok1F!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png 848w, https://substackcdn.com/image/fetch/$s_!ok1F!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.png 1272w, https://substackcdn.com/image/fetch/$s_!ok1F!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173dc9eb-f96c-4e6b-9b71-8fcd48ded620_1798x1072.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 aria-hidden="true" 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><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><a href="https://lucode.co/ai-developer-hub-oracle-z7nl">Oracle AI Developer Hub</a></strong> is a curated collection of real-world examples, architectures, and guides for building AI-powered applications. From RAG pipelines to agent-based systems, it brings together practical patterns, code samples, and best practices to help individuals and teams build production-grade AI solutions. If you find it useful, give it a star.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://lucode.co/ai-developer-hub-oracle-z7nl&quot;,&quot;text&quot;:&quot;Explore and Star the Repo&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://lucode.co/ai-developer-hub-oracle-z7nl"><span>Explore and Star the Repo</span></a></p><div><hr></div><h1>How OAuth Actually Works</h1><p>OAuth is not login. It is permission.</p><p>That confusion causes a surprising number of design mistakes.</p><p>Teams pass around access tokens as if they prove identity, store them in risky places, or keep old flows alive because they &#8220;still work.&#8221; The result is a system that looks modern on paper but leaks security in the seams.</p><p>At its core, OAuth lets one application get limited access to another service without handing over the user&#8217;s password. Used well, it narrows access. Used poorly, it creates a false sense of security.</p><h2>What OAuth actually solves</h2><p>OAuth exists because &#8220;just give the app your password&#8221; is a bad system boundary. The moment a third-party app sees user credentials, you lose separation between identity, consent, and API access.</p><p>Every OAuth transaction involves four roles:</p><ul><li><p><strong>Resource owner</strong> &#8594; The user who owns the data and decides what to share.</p></li><li><p><strong>Client</strong> &#8594; The application requesting access (a web app, mobile app, or background service).</p></li><li><p><strong>Authorization server</strong> &#8594; Issues tokens after verifying the user&#8217;s identity and consent.</p></li><li><p><strong>Resource server</strong> &#8594; The API that holds the protected data and validates tokens on every request.</p></li></ul><p>The separation between the authorization server (which authenticates) and the resource server (which serves data) is intentional.</p><p>It lets companies run a single sign-on service across dozens of APIs without coupling their identity infrastructure to every service.</p><p>A typical flow looks like this:</p><ol><li><p>The client redirects the user to the authorization server</p></li><li><p>The user authenticates and consents</p></li><li><p>The server sends an authorization code back to the client</p></li><li><p>The client exchanges that code for an access token over a secure back-channel.</p></li><li><p>That access token is then sent with every API request.</p></li></ol><p>The user&#8217;s credentials never leave the authorization server.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!BNqA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4e03ac6-6e30-492c-88c4-478ae782eada_2000x1223.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!BNqA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4e03ac6-6e30-492c-88c4-478ae782eada_2000x1223.png 424w, https://substackcdn.com/image/fetch/$s_!BNqA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4e03ac6-6e30-492c-88c4-478ae782eada_2000x1223.png 848w, https://substackcdn.com/image/fetch/$s_!BNqA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4e03ac6-6e30-492c-88c4-478ae782eada_2000x1223.png 1272w, https://substackcdn.com/image/fetch/$s_!BNqA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4e03ac6-6e30-492c-88c4-478ae782eada_2000x1223.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!BNqA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4e03ac6-6e30-492c-88c4-478ae782eada_2000x1223.png" width="1456" height="890" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e4e03ac6-6e30-492c-88c4-478ae782eada_2000x1223.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:890,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:432953,&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://blog.levelupcoding.com/i/193420623?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4e03ac6-6e30-492c-88c4-478ae782eada_2000x1223.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_!BNqA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4e03ac6-6e30-492c-88c4-478ae782eada_2000x1223.png 424w, https://substackcdn.com/image/fetch/$s_!BNqA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4e03ac6-6e30-492c-88c4-478ae782eada_2000x1223.png 848w, https://substackcdn.com/image/fetch/$s_!BNqA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4e03ac6-6e30-492c-88c4-478ae782eada_2000x1223.png 1272w, https://substackcdn.com/image/fetch/$s_!BNqA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4e03ac6-6e30-492c-88c4-478ae782eada_2000x1223.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 aria-hidden="true" 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><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><h2>Three tokens, three different jobs</h2><p>OAuth&#8217;s token model trips up a lot of developers because the three token types look similar but serve completely different purposes.</p><ul><li><p><strong>Access token</strong> &#8594; Short-lived credential sent with every API call. The resource server validates it on each request.</p></li><li><p><strong>Refresh token</strong> &#8594; Long-lived credential used only at the token endpoint to get a new access token without re-prompting the user. Never send this to an API. If it leaks, an attacker can silently maintain access long after the original session should have expired.</p></li><li><p><strong>ID token</strong> &#8594; A signed JWT that carries <em>authentication claims</em>; who the user is, when they authenticated, which identity provider issued it.</p></li></ul><p>That last one is a common gotcha.</p><p>An <strong>ID token is not an OAuth token</strong>.</p><p>It belongs to <strong>OpenID Connect (OIDC)</strong>, which adds an identity layer on top of OAuth. So if your real goal is &#8220;log the user in and know who they are,&#8221; OAuth is not the answer. OIDC is.</p><p>Treating an access token as a login token (i.e. as proof of user identity) is one of the most common implementation mistakes.</p><h2>Where OAuth systems usually break</h2><p>Under the hood, OAuth uses bearer tokens. Bearer tokens are especially sensitive because whoever possesses them can use them.</p><p>There&#8217;s no built-in proof of identity or cryptographic binding; the API simply trusts whoever presents the token. As a result, token leakage is effectively credential theft.</p><p>Leaks can occur through logs, query strings, browser storage, referrer headers, or weak transport. That&#8217;s why modern guidance focuses on limiting both exposure and impact: use HTTPS everywhere, keep access tokens short-lived, store them carefully, rotate refresh tokens on every use, and strictly validate redirect URIs.</p><p>For higher-risk environments, you can go further with <strong>sender-constrained tokens</strong>, which bind a token to a specific client instead of treating it as transferable:</p><ul><li><p><strong>mTLS</strong> &#8594; ties the token to the client&#8217;s TLS certificate</p></li><li><p><strong>DPoP</strong> &#8594; binds the token to a client-controlled key pair</p></li></ul><p>These add complexity, but they close the gap that bearer tokens leave open.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!I0iH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d2fd90b-1067-4468-8a79-ca93ac8094d1_2000x1079.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!I0iH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d2fd90b-1067-4468-8a79-ca93ac8094d1_2000x1079.png 424w, https://substackcdn.com/image/fetch/$s_!I0iH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d2fd90b-1067-4468-8a79-ca93ac8094d1_2000x1079.png 848w, https://substackcdn.com/image/fetch/$s_!I0iH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d2fd90b-1067-4468-8a79-ca93ac8094d1_2000x1079.png 1272w, https://substackcdn.com/image/fetch/$s_!I0iH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d2fd90b-1067-4468-8a79-ca93ac8094d1_2000x1079.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!I0iH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d2fd90b-1067-4468-8a79-ca93ac8094d1_2000x1079.png" width="1456" height="786" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1d2fd90b-1067-4468-8a79-ca93ac8094d1_2000x1079.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:786,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:431630,&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://blog.levelupcoding.com/i/193420623?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d2fd90b-1067-4468-8a79-ca93ac8094d1_2000x1079.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_!I0iH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d2fd90b-1067-4468-8a79-ca93ac8094d1_2000x1079.png 424w, https://substackcdn.com/image/fetch/$s_!I0iH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d2fd90b-1067-4468-8a79-ca93ac8094d1_2000x1079.png 848w, https://substackcdn.com/image/fetch/$s_!I0iH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d2fd90b-1067-4468-8a79-ca93ac8094d1_2000x1079.png 1272w, https://substackcdn.com/image/fetch/$s_!I0iH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d2fd90b-1067-4468-8a79-ca93ac8094d1_2000x1079.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 aria-hidden="true" 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><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><h2>What to do for web, mobile, and SPAs</h2><p>For traditional server-rendered web apps, keep it simple: handle the OAuth flow on the server, store tokens there, and give the browser a hardened session cookie instead.</p><p>That way, the browser never directly touches OAuth tokens, which significantly reduces exposure to XSS attacks.</p><p>For mobile and desktop apps, assume they&#8217;re public clients:</p><ul><li><p>Use Authorization Code + PKCE (a flow where the app gets a one-time code after login and proves it initiated the request)</p></li><li><p>Open the system browser (not an embedded web view)</p></li><li><p>Store refresh tokens in secure platform storage like Keychain or Keystore.</p></li></ul><p>For single-page apps, a Backend-for-Frontend (BFF) is often the safest route. The browser talks to your backend, the backend handles OAuth, and the browser just holds a session cookie.</p><p>If a BFF isn&#8217;t practical:</p><ul><li><p>Fall back to Authorization Code + PKCE (get a one-time code after login and prove the request came from your app)</p></li><li><p>Validate the state parameter (to prevent CSRF attacks)</p></li><li><p>Keep tokens in memory rather than persistent storage like localStorage</p></li><li><p>Lock down CORS as tightly as possible</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ATdv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F049a8910-9871-4477-baf2-3461b8cc23a9_2000x1061.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ATdv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F049a8910-9871-4477-baf2-3461b8cc23a9_2000x1061.png 424w, https://substackcdn.com/image/fetch/$s_!ATdv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F049a8910-9871-4477-baf2-3461b8cc23a9_2000x1061.png 848w, https://substackcdn.com/image/fetch/$s_!ATdv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F049a8910-9871-4477-baf2-3461b8cc23a9_2000x1061.png 1272w, https://substackcdn.com/image/fetch/$s_!ATdv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F049a8910-9871-4477-baf2-3461b8cc23a9_2000x1061.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ATdv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F049a8910-9871-4477-baf2-3461b8cc23a9_2000x1061.png" width="1456" height="772" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/049a8910-9871-4477-baf2-3461b8cc23a9_2000x1061.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:772,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:412940,&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://blog.levelupcoding.com/i/193420623?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F049a8910-9871-4477-baf2-3461b8cc23a9_2000x1061.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_!ATdv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F049a8910-9871-4477-baf2-3461b8cc23a9_2000x1061.png 424w, https://substackcdn.com/image/fetch/$s_!ATdv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F049a8910-9871-4477-baf2-3461b8cc23a9_2000x1061.png 848w, https://substackcdn.com/image/fetch/$s_!ATdv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F049a8910-9871-4477-baf2-3461b8cc23a9_2000x1061.png 1272w, https://substackcdn.com/image/fetch/$s_!ATdv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F049a8910-9871-4477-baf2-3461b8cc23a9_2000x1061.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 aria-hidden="true" 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><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><h2>Wrapping up</h2><p>OAuth gives applications permission to act, not identity to impersonate.</p><p>Every design decision in the framework (scoped tokens, short lifetimes, separate authorization and resource servers) exists to keep that boundary clean.</p><p>When something goes wrong with an OAuth implementation, it almost always traces back to that boundary getting blurred: a token meant for one API accepted by another, an access token used to prove identity, a scope granted that was never actually needed.</p><p>Keep the boundary clear, and the rest of OAuth becomes straightforward.</p><div><hr></div><p>&#128075; If you liked this post &#8594; Like + Restack + Share to help others learn system design.</p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Subscribe to get high-signal, clear, and visual system design breakdowns straight to your inbox:&nbsp;</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Infrastructure as Code Clearly Explained]]></title><description><![CDATA[The IaC workflow that actually works, why it matters in practice, security risks you can't ignore, and more...]]></description><link>https://blog.levelupcoding.com/p/infrastructure-as-code-clearly-explained</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/infrastructure-as-code-clearly-explained</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Mon, 27 Apr 2026 14:34:41 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/54af9bdb-9469-4fcf-8f1a-ec981b99e310_2400x1260.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Get our 142-page System Design Handbook for FREE on newsletter signup:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2><a href="https://lucode.co/postmortems-rebuilt-z7nl">Postmortems Without the Reconstruction Work</a></h2><h5>Presented by <a href="https://lucode.co/postmortems-rebuilt-z7nl">incident.io</a></h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xlmD!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35e5e169-9602-45b7-88a4-01ef1ca787d7_2000x1125.avif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xlmD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35e5e169-9602-45b7-88a4-01ef1ca787d7_2000x1125.avif 424w, https://substackcdn.com/image/fetch/$s_!xlmD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35e5e169-9602-45b7-88a4-01ef1ca787d7_2000x1125.avif 848w, https://substackcdn.com/image/fetch/$s_!xlmD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35e5e169-9602-45b7-88a4-01ef1ca787d7_2000x1125.avif 1272w, https://substackcdn.com/image/fetch/$s_!xlmD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35e5e169-9602-45b7-88a4-01ef1ca787d7_2000x1125.avif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xlmD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35e5e169-9602-45b7-88a4-01ef1ca787d7_2000x1125.avif" width="1456" height="819" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/35e5e169-9602-45b7-88a4-01ef1ca787d7_2000x1125.avif&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;:27594,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/avif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.levelupcoding.com/i/194274200?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35e5e169-9602-45b7-88a4-01ef1ca787d7_2000x1125.avif&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_!xlmD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35e5e169-9602-45b7-88a4-01ef1ca787d7_2000x1125.avif 424w, https://substackcdn.com/image/fetch/$s_!xlmD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35e5e169-9602-45b7-88a4-01ef1ca787d7_2000x1125.avif 848w, https://substackcdn.com/image/fetch/$s_!xlmD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35e5e169-9602-45b7-88a4-01ef1ca787d7_2000x1125.avif 1272w, https://substackcdn.com/image/fetch/$s_!xlmD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35e5e169-9602-45b7-88a4-01ef1ca787d7_2000x1125.avif 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 aria-hidden="true" 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><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>Writing postmortems is traditionally slow, painful, and often incomplete. Sometimes they don&#8217;t get written at all. That&#8217;s not just a process problem, it&#8217;s an experience problem. <strong><a href="https://lucode.co/postmortems-rebuilt-z7nl">incident.io</a></strong> flips this by generating a draft from real incident data, so teams start with context and focus on refining what matters. It turns postmortems into a structured, collaborative workflow that&#8217;s actually easy to complete.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://lucode.co/postmortems-rebuilt-z7nl&quot;,&quot;text&quot;:&quot;Read the Article&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://lucode.co/postmortems-rebuilt-z7nl"><span>Read the Article</span></a></p><div><hr></div><h1>Infrastructure as Code Clearly Explained</h1><p>Can you rebuild your entire production environment from scratch today?</p><p>Not approximately. Not &#8220;close enough.&#8221; Exactly as-is.</p><p>If the answer is no, your infrastructure depends on tribal knowledge, console history, or luck.</p><p>Infrastructure as Code (IaC) replaces all three with something far more reliable: versioned, reviewable definitions that can be applied again and again without surprises.</p><h2>What Infrastructure as Code actually means</h2><p>Infrastructure as Code (IaC) is the practice of defining infrastructure in machine-readable files instead of configuring it manually in consoles or through one-off scripts.</p><p>There are two closely related disciplines:</p><ul><li><p><strong>Provisioning IaC</strong> &#8594; Defines cloud resources such as networks, IAM roles, compute instances, and managed services.</p></li><li><p><strong>Configuration IaC</strong> &#8594; Defines the desired state of machines and services, such as installed packages, files, and system settings.</p></li></ul><p>Provisioning creates the building.<br>Configuration furnishes and maintains 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_!3VAx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47400b19-8afc-4b77-88e5-1a0c0ac299e8_2000x973.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3VAx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47400b19-8afc-4b77-88e5-1a0c0ac299e8_2000x973.png 424w, https://substackcdn.com/image/fetch/$s_!3VAx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47400b19-8afc-4b77-88e5-1a0c0ac299e8_2000x973.png 848w, https://substackcdn.com/image/fetch/$s_!3VAx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47400b19-8afc-4b77-88e5-1a0c0ac299e8_2000x973.png 1272w, https://substackcdn.com/image/fetch/$s_!3VAx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47400b19-8afc-4b77-88e5-1a0c0ac299e8_2000x973.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3VAx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47400b19-8afc-4b77-88e5-1a0c0ac299e8_2000x973.png" width="1456" height="708" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/47400b19-8afc-4b77-88e5-1a0c0ac299e8_2000x973.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:708,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:282497,&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://blog.levelupcoding.com/i/193317693?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47400b19-8afc-4b77-88e5-1a0c0ac299e8_2000x973.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_!3VAx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47400b19-8afc-4b77-88e5-1a0c0ac299e8_2000x973.png 424w, https://substackcdn.com/image/fetch/$s_!3VAx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47400b19-8afc-4b77-88e5-1a0c0ac299e8_2000x973.png 848w, https://substackcdn.com/image/fetch/$s_!3VAx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47400b19-8afc-4b77-88e5-1a0c0ac299e8_2000x973.png 1272w, https://substackcdn.com/image/fetch/$s_!3VAx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47400b19-8afc-4b77-88e5-1a0c0ac299e8_2000x973.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 aria-hidden="true" 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><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>Both aim at the same outcome: <strong>desired state and convergence</strong>. You describe what should exist, and a tool calculates the steps required to make reality match that description.</p><p>Infrastructure stops being something you &#8220;set up&#8221; and becomes something you <strong>declare, review, and reapply safely</strong>.</p><h2>Why it matters in practice</h2><p>The benefits of IaC flow directly from treating infrastructure like code.</p><ul><li><p><strong>Reproducibility</strong> &#8594; Every environment gets built from the same source, eliminating the &#8220;works on my machine&#8221; problem at the infrastructure level.</p></li><li><p><strong>Auditability</strong> &#8594; Every change goes through version control and peer review, so you always know who changed what, when, and why.</p></li><li><p><strong>Faster, safer delivery</strong> &#8594; Automated pipelines with preview steps replace manual deploys, so teams ship more often with less risk.</p></li><li><p><strong>Scalable governance</strong> &#8594; Policy checks run before anything is provisioned, so compliance rules are enforced automatically rather than audited after the fact.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ekmB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F852de703-9aa3-46c5-811a-3e6912f8e607_2000x870.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ekmB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F852de703-9aa3-46c5-811a-3e6912f8e607_2000x870.png 424w, https://substackcdn.com/image/fetch/$s_!ekmB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F852de703-9aa3-46c5-811a-3e6912f8e607_2000x870.png 848w, https://substackcdn.com/image/fetch/$s_!ekmB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F852de703-9aa3-46c5-811a-3e6912f8e607_2000x870.png 1272w, https://substackcdn.com/image/fetch/$s_!ekmB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F852de703-9aa3-46c5-811a-3e6912f8e607_2000x870.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ekmB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F852de703-9aa3-46c5-811a-3e6912f8e607_2000x870.png" width="1456" height="633" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/852de703-9aa3-46c5-811a-3e6912f8e607_2000x870.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:633,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:378491,&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://blog.levelupcoding.com/i/193317693?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F852de703-9aa3-46c5-811a-3e6912f8e607_2000x870.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_!ekmB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F852de703-9aa3-46c5-811a-3e6912f8e607_2000x870.png 424w, https://substackcdn.com/image/fetch/$s_!ekmB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F852de703-9aa3-46c5-811a-3e6912f8e607_2000x870.png 848w, https://substackcdn.com/image/fetch/$s_!ekmB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F852de703-9aa3-46c5-811a-3e6912f8e607_2000x870.png 1272w, https://substackcdn.com/image/fetch/$s_!ekmB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F852de703-9aa3-46c5-811a-3e6912f8e607_2000x870.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 aria-hidden="true" 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><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>Without IaC, every environment eventually diverges in small, invisible ways. That divergence is the root cause of a wide range of production incidents.</p><h2>Choosing a tool</h2><p>The tool choice depends on your context more than on which tool is &#8220;best.&#8221; Here&#8217;s a practical breakdown:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!BMLR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef61a502-36f6-4402-8c96-6fb36b898d0f_2000x1276.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!BMLR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef61a502-36f6-4402-8c96-6fb36b898d0f_2000x1276.png 424w, https://substackcdn.com/image/fetch/$s_!BMLR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef61a502-36f6-4402-8c96-6fb36b898d0f_2000x1276.png 848w, https://substackcdn.com/image/fetch/$s_!BMLR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef61a502-36f6-4402-8c96-6fb36b898d0f_2000x1276.png 1272w, https://substackcdn.com/image/fetch/$s_!BMLR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef61a502-36f6-4402-8c96-6fb36b898d0f_2000x1276.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!BMLR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef61a502-36f6-4402-8c96-6fb36b898d0f_2000x1276.png" width="1456" height="929" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ef61a502-36f6-4402-8c96-6fb36b898d0f_2000x1276.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:929,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:469167,&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://blog.levelupcoding.com/i/193317693?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef61a502-36f6-4402-8c96-6fb36b898d0f_2000x1276.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_!BMLR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef61a502-36f6-4402-8c96-6fb36b898d0f_2000x1276.png 424w, https://substackcdn.com/image/fetch/$s_!BMLR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef61a502-36f6-4402-8c96-6fb36b898d0f_2000x1276.png 848w, https://substackcdn.com/image/fetch/$s_!BMLR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef61a502-36f6-4402-8c96-6fb36b898d0f_2000x1276.png 1272w, https://substackcdn.com/image/fetch/$s_!BMLR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef61a502-36f6-4402-8c96-6fb36b898d0f_2000x1276.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 aria-hidden="true" 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><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 common pattern in large organizations is to use Terraform or CloudFormation to provision the infrastructure; and Ansible for OS hardening, package installs, and app configuration.</p><h2>The IaC workflow that actually works</h2><p>Effective IaC is less about which tool you use and more about the workflow controls around it.</p><p>Most failures don&#8217;t come from syntax; they come from skipping validation, review, or safe rollout.</p><p>Here&#8217;s what a robust pipeline typically looks like:</p><ol><li><p><strong>Developer writes and pushes IaC to Git </strong>&#8594; Infrastructure is defined as code (networks, databases, IAM, etc.), making Git the single source of truth.</p></li><li><p><strong>CI runs validation checks </strong>&#8594; Formatting, syntax validation, linting, and dependency checks ensure the code is correct and consistent.</p></li><li><p><strong>Security &amp; policy checks run </strong>&#8594; Misconfiguration scanners, policy-as-code rules, and security tools catch risky permissions or unsafe defaults early.</p></li><li><p><strong>A preview (plan) is generated </strong>&#8594; The system compares desired vs current state and shows exactly what will be created, updated, or deleted before anything changes.</p></li><li><p><strong>Peer review and approval </strong>&#8594; Engineers review both the code and the plan to catch issues like accidental deletions, cost spikes, or overly broad access.</p></li><li><p><strong>Apply via a deployment pipeline </strong>&#8594; A trusted CI/CD runner applies the changes, ensuring consistent execution and controlled credentials.</p></li><li><p><strong>Environment-specific config is injected </strong>&#8594; The same code is reused across dev, staging, and prod, with differences handled through variables and separate state.</p></li><li><p><strong>Post-deploy checks run </strong>&#8594; Smoke tests, connectivity checks, and monitoring validation confirm the system actually works after deployment.</p></li><li><p><strong>Environment rollout </strong>&#8594; Changes move from dev &#8594; staging &#8594; production with increasing levels of approval to reduce risk.</p></li><li><p><strong>State is updated for future runs</strong> &#8594; The IaC tool records what exists so future changes can safely build on top of it.</p></li><li><p><strong>Continuous drift detection</strong> &#8594; Scheduled checks alert when real infrastructure diverges from what&#8217;s defined in code.</p></li></ol><p>A simple way to think about it: you declare what you want, the pipeline proves it&#8217;s safe, and automation makes it real; consistently, every time.</p><h2>The security risks you can&#8217;t ignore</h2><p>IaC security failures tend to be systemic: fast pipelines amplify mistakes quickly.</p><p>These are the three most dominant risk categories.</p><h3>1. Secrets exposure</h3><p>Secrets exposure in IaC happens when sensitive data (like passwords or API keys) is stored or leaked through code, state files, logs, or pipelines.</p><p>This can lead to serious risks.</p><p>Prevent it by using secret managers, encrypting state, avoiding hardcoding, and enforcing least-privilege access.</p><h3>2. Over-privileged automation</h3><p>CI/CD pipelines often get broad permissions &#8220;just to make it work.&#8221;</p><p>Instead, the right model separates preview roles from apply roles, scope permissions per environment, and enforces least privilege.</p><h3>3. Supply chain integrity</h3><p>Compromised or untrusted external modules, templates, or dependencies are a quiet attack surface.</p><p>If these components are tampered with, they can introduce vulnerabilities or malicious code into your infrastructure.</p><p>Without pinning and verification, your infrastructure depends on unverified external code.</p><h2>When not to use full IaC automation</h2><p>IaC is almost always worth adopting, but the level of automation should match your maturity.</p><p>Full automated apply-on-merge makes sense when you have strong test coverage, good observability, and practiced runbooks. Without those foundations, it moves fast in the wrong direction.</p><p>For small prototypes or rarely-changed legacy systems, basic version-controlled templates with manual apply still deliver most of the value: reproducibility, auditability, and the ability to review changes before they land.</p><h2>The pitfalls teams hit first</h2><p>A few failure patterns show up reliably when teams adopt IaC without the right habits.</p><ul><li><p><strong>State mishandling</strong> &#8594; Storing Terraform state locally, or in source control, leads to conflicts and leaks. Use a remote backend with locking from day one.</p></li><li><p><strong>Configuration drift</strong> &#8594; An urgent fix applied via the console creates a gap between reality and the definition. Enforce a norm: no manual changes without a follow-up pull request, and run drift detection on a schedule.</p></li><li><p><strong>Unsafe changes</strong> &#8594; A small template edit can silently force a resource replacement. Preview gates and policy-as-code checks catch this before it reaches production.</p></li><li><p><strong>Skipping validation</strong> &#8594; Treating IaC as &#8220;just YAML&#8221; and skipping linting and formatting in CI creates a debt that compounds fast.</p></li></ul><h2>Recap</h2><p>IaC is not a tool you adopt; it&#8217;s a discipline you commit to.</p><p>The tools (Terraform, CloudFormation, Pulumi, Ansible) are expressions of a single idea: infrastructure should be reproducible, reviewable, and automatable by default.</p><p>Start with version control and validation. Add preview gates before you automate applies. Lock down secrets and pipeline permissions early.</p><p>When IaC is done well, provisioning an environment feels like merging a pull request; not like defusing a bomb.</p><div><hr></div><p>&#128075; If you liked this post &#8594; Like + Restack + Share to help others learn system design.</p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Subscribe to get high-signal, clear, and visual system design breakdowns straight to your inbox:&nbsp;</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Redis Clearly Explained]]></title><description><![CDATA[How Redis works under the hood, where it fits in the stack, where it shines, and when NOT to use it.]]></description><link>https://blog.levelupcoding.com/p/redis-clearly-explained</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/redis-clearly-explained</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Tue, 21 Apr 2026 10:36:16 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/ae2174cd-f4ac-4233-8f24-2048c3a0f484_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Get our 142-page System Design Handbook for FREE on newsletter signup:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2><a href="https://lucode.co/exe-dot-dev-z8nl">Just a Computer. On the Internet. Instantly.</a></h2><h5>Presented by <a href="https://lucode.co/exe-dot-dev-z8nl">exe.dev</a></h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!qbPa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e742826-0983-4853-8d0a-3cb0a3ff0221_2204x1338.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qbPa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e742826-0983-4853-8d0a-3cb0a3ff0221_2204x1338.png 424w, https://substackcdn.com/image/fetch/$s_!qbPa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e742826-0983-4853-8d0a-3cb0a3ff0221_2204x1338.png 848w, https://substackcdn.com/image/fetch/$s_!qbPa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e742826-0983-4853-8d0a-3cb0a3ff0221_2204x1338.png 1272w, https://substackcdn.com/image/fetch/$s_!qbPa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e742826-0983-4853-8d0a-3cb0a3ff0221_2204x1338.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qbPa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e742826-0983-4853-8d0a-3cb0a3ff0221_2204x1338.png" width="1456" height="884" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5e742826-0983-4853-8d0a-3cb0a3ff0221_2204x1338.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:884,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:192231,&quot;alt&quot;:&quot;&quot;,&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://blog.levelupcoding.com/i/193454211?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e742826-0983-4853-8d0a-3cb0a3ff0221_2204x1338.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_!qbPa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e742826-0983-4853-8d0a-3cb0a3ff0221_2204x1338.png 424w, https://substackcdn.com/image/fetch/$s_!qbPa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e742826-0983-4853-8d0a-3cb0a3ff0221_2204x1338.png 848w, https://substackcdn.com/image/fetch/$s_!qbPa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e742826-0983-4853-8d0a-3cb0a3ff0221_2204x1338.png 1272w, https://substackcdn.com/image/fetch/$s_!qbPa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e742826-0983-4853-8d0a-3cb0a3ff0221_2204x1338.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 aria-hidden="true" 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><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>Sometimes you just need a machine on the internet. One that keeps running when your laptop sleeps, runs your cron jobs, and is accessible when others need it. <strong><a href="https://lucode.co/exe-dot-dev-z8nl">Exe.dev</a></strong> gives you exactly that. A real VM with persistent disk, built-in HTTPS, and secure access out of the box. No auth setup, no config files, no infrastructure overhead. Spin one up with a single command and start building. It stays live and ready to share.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://lucode.co/exe-dot-dev-z8nl&quot;,&quot;text&quot;:&quot;Try it Out&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://lucode.co/exe-dot-dev-z8nl"><span>Try it Out</span></a></p><div><hr></div><h1>Redis Clearly Explained</h1><p>Your database is fast. Your queries are optimized. Your indexes are in place. And yet, under real load, the system still slows down.</p><p>The problem often isn&#8217;t the database itself. It&#8217;s that you&#8217;re asking it to answer the same questions, over and over, thousands of times a second.</p><p>This is where Redis starts to matter.</p><p>It shows up at the edge: handling sessions, caching responses, tracking limits, moving messages. Quietly taking pressure off everything else.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!URDr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021c57b4-f894-4afd-a6d2-b41e42fab5df_2000x821.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!URDr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021c57b4-f894-4afd-a6d2-b41e42fab5df_2000x821.png 424w, https://substackcdn.com/image/fetch/$s_!URDr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021c57b4-f894-4afd-a6d2-b41e42fab5df_2000x821.png 848w, https://substackcdn.com/image/fetch/$s_!URDr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021c57b4-f894-4afd-a6d2-b41e42fab5df_2000x821.png 1272w, https://substackcdn.com/image/fetch/$s_!URDr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021c57b4-f894-4afd-a6d2-b41e42fab5df_2000x821.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!URDr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021c57b4-f894-4afd-a6d2-b41e42fab5df_2000x821.png" width="1456" height="598" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/021c57b4-f894-4afd-a6d2-b41e42fab5df_2000x821.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:598,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:251213,&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://blog.levelupcoding.com/i/194275659?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021c57b4-f894-4afd-a6d2-b41e42fab5df_2000x821.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_!URDr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021c57b4-f894-4afd-a6d2-b41e42fab5df_2000x821.png 424w, https://substackcdn.com/image/fetch/$s_!URDr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021c57b4-f894-4afd-a6d2-b41e42fab5df_2000x821.png 848w, https://substackcdn.com/image/fetch/$s_!URDr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021c57b4-f894-4afd-a6d2-b41e42fab5df_2000x821.png 1272w, https://substackcdn.com/image/fetch/$s_!URDr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F021c57b4-f894-4afd-a6d2-b41e42fab5df_2000x821.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 aria-hidden="true" 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><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><h2>How Redis works under the hood</h2><p>Redis stores everything in RAM as key&#8211;value pairs, but the values are not limited to plain strings. It supports a rich set of data structures:</p><ul><li><p><strong>Strings</strong> &#8594; Simple values; used for counters, flags, and cached results.</p></li><li><p><strong>Hashes</strong> &#8594; Field-value maps; ideal for user profiles and session data.</p></li><li><p><strong>Lists</strong> &#8594; Ordered sequences; used for queues and recent activity feeds.</p></li><li><p><strong>Sets / Sorted Sets</strong> &#8594; Unique element collections with optional scoring; used for leaderboards and tag systems.</p></li></ul><p>Each structure comes with optimized commands. Instead of fetching data and processing it in your app, Redis lets you operate directly on the data.</p><p>That&#8217;s the difference between:</p><ul><li><p>&#8220;Get everything, then sort it&#8221;<br>vs</p></li><li><p>&#8220;Ask Redis for the top 10 directly&#8221;</p></li></ul><h3>Execution model</h3><p>Redis uses a <strong>single-threaded event loop</strong>, meaning one command executes at a time.</p><p>This sounds limiting, but it avoids locking and keeps operations atomic. In practice, it handles massive throughput because the work per operation is small and predictable.</p><h3>Persistence (optional but important)</h3><p>Even though Redis is in-memory, it can persist data:</p><ul><li><p><strong>RDB snapshots</strong> &#8594; Periodic full saves</p></li><li><p><strong>AOF logs</strong> &#8594; Append every write operation</p></li></ul><p>You choose how durable you want it to be. Faster setups risk losing recent data; safer setups add overhead.</p><h2>Where Redis actually shines</h2><p>Redis is not a general-purpose database replacement. It&#8217;s a <strong>performance layer</strong> that solves specific problems extremely well.</p><h3>1. Caching</h3><p>The most common use case is caching expensive reads.</p><p>The application checks Redis first; on a hit, data returns in microseconds; on a miss, the app queries the primary database and populates Redis for next time.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yMC9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5967205-956a-4b3a-bf7d-ec1759b0eb1f_2000x877.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yMC9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5967205-956a-4b3a-bf7d-ec1759b0eb1f_2000x877.png 424w, https://substackcdn.com/image/fetch/$s_!yMC9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5967205-956a-4b3a-bf7d-ec1759b0eb1f_2000x877.png 848w, https://substackcdn.com/image/fetch/$s_!yMC9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5967205-956a-4b3a-bf7d-ec1759b0eb1f_2000x877.png 1272w, https://substackcdn.com/image/fetch/$s_!yMC9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5967205-956a-4b3a-bf7d-ec1759b0eb1f_2000x877.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yMC9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5967205-956a-4b3a-bf7d-ec1759b0eb1f_2000x877.png" width="1456" height="638" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f5967205-956a-4b3a-bf7d-ec1759b0eb1f_2000x877.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:638,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:272827,&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://blog.levelupcoding.com/i/194275659?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5967205-956a-4b3a-bf7d-ec1759b0eb1f_2000x877.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_!yMC9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5967205-956a-4b3a-bf7d-ec1759b0eb1f_2000x877.png 424w, https://substackcdn.com/image/fetch/$s_!yMC9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5967205-956a-4b3a-bf7d-ec1759b0eb1f_2000x877.png 848w, https://substackcdn.com/image/fetch/$s_!yMC9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5967205-956a-4b3a-bf7d-ec1759b0eb1f_2000x877.png 1272w, https://substackcdn.com/image/fetch/$s_!yMC9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5967205-956a-4b3a-bf7d-ec1759b0eb1f_2000x877.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 aria-hidden="true" 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><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 primary database stays as the source of truth, Redis handles the hot path.</p><p>This works especially well for expensive query results, API responses, rendered HTML fragments, or any data that is read far more often than it changes.</p><ul><li><p><strong>Faster responses</strong> &#8594; Microseconds instead of milliseconds</p></li><li><p><strong>Lower DB load</strong> &#8594; Fewer repeated queries</p></li><li><p><strong>Better scalability</strong> &#8594; Handles spikes smoothly</p></li></ul><p>This pattern alone can reduce database traffic dramatically.</p><h3>2. Session storage</h3><p>User sessions need fast reads and writes across every request.</p><p>Redis fits because:</p><ul><li><p><strong>Low latency</strong> &#8594; No delay on every request</p></li><li><p><strong>Time-to-live support</strong> &#8594; Sessions expire automatically</p></li><li><p><strong>High throughput</strong> &#8594; Handles large user bases</p></li></ul><p>Instead of storing sessions in a database, Redis keeps them close to the application.</p><h3>3. Rate limiting</h3><p>Redis makes rate limiting simple through atomic operations.</p><p>Each request increments a counter per user, there&#8217;s a set expiration per counter (e.g. 10 minutes), requests are rejected after a threshold is reached.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7LYd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea471326-cde0-4a23-9b5b-e276645d4d50_2000x958.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7LYd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea471326-cde0-4a23-9b5b-e276645d4d50_2000x958.png 424w, https://substackcdn.com/image/fetch/$s_!7LYd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea471326-cde0-4a23-9b5b-e276645d4d50_2000x958.png 848w, https://substackcdn.com/image/fetch/$s_!7LYd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea471326-cde0-4a23-9b5b-e276645d4d50_2000x958.png 1272w, https://substackcdn.com/image/fetch/$s_!7LYd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea471326-cde0-4a23-9b5b-e276645d4d50_2000x958.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7LYd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea471326-cde0-4a23-9b5b-e276645d4d50_2000x958.png" width="1456" height="697" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ea471326-cde0-4a23-9b5b-e276645d4d50_2000x958.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:697,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:337041,&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://blog.levelupcoding.com/i/194275659?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea471326-cde0-4a23-9b5b-e276645d4d50_2000x958.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_!7LYd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea471326-cde0-4a23-9b5b-e276645d4d50_2000x958.png 424w, https://substackcdn.com/image/fetch/$s_!7LYd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea471326-cde0-4a23-9b5b-e276645d4d50_2000x958.png 848w, https://substackcdn.com/image/fetch/$s_!7LYd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea471326-cde0-4a23-9b5b-e276645d4d50_2000x958.png 1272w, https://substackcdn.com/image/fetch/$s_!7LYd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea471326-cde0-4a23-9b5b-e276645d4d50_2000x958.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 aria-hidden="true" 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><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>Because these are atomic in-memory operations, they add almost no overhead to the request path. This is why Redis is often used behind API gateways.</p><h3>4. Pub/Sub and queues</h3><p>Redis has a built-in publish/subscribe mechanism: one service publishes to a channel; all subscribers receive the message in real time.</p><p>For more durable workloads, Redis Lists support simple FIFO queues, and Redis Streams add consumer groups and persistence for cases where message durability matters.</p><p>It&#8217;s simple, fast, and good enough for many workloads before you need heavier tools.</p><h2>Benefits vs trade-offs</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!SaVN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a6d95f-d598-4a79-bde6-e460276f77ff_2000x1498.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!SaVN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a6d95f-d598-4a79-bde6-e460276f77ff_2000x1498.png 424w, https://substackcdn.com/image/fetch/$s_!SaVN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a6d95f-d598-4a79-bde6-e460276f77ff_2000x1498.png 848w, https://substackcdn.com/image/fetch/$s_!SaVN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a6d95f-d598-4a79-bde6-e460276f77ff_2000x1498.png 1272w, https://substackcdn.com/image/fetch/$s_!SaVN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a6d95f-d598-4a79-bde6-e460276f77ff_2000x1498.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!SaVN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a6d95f-d598-4a79-bde6-e460276f77ff_2000x1498.png" width="1456" height="1091" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/58a6d95f-d598-4a79-bde6-e460276f77ff_2000x1498.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1091,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:528127,&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://blog.levelupcoding.com/i/194275659?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a6d95f-d598-4a79-bde6-e460276f77ff_2000x1498.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_!SaVN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a6d95f-d598-4a79-bde6-e460276f77ff_2000x1498.png 424w, https://substackcdn.com/image/fetch/$s_!SaVN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a6d95f-d598-4a79-bde6-e460276f77ff_2000x1498.png 848w, https://substackcdn.com/image/fetch/$s_!SaVN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a6d95f-d598-4a79-bde6-e460276f77ff_2000x1498.png 1272w, https://substackcdn.com/image/fetch/$s_!SaVN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a6d95f-d598-4a79-bde6-e460276f77ff_2000x1498.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 aria-hidden="true" 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><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><h2>Where Redis fits in the stack</h2><p>Redis complements a primary database.</p><p>In microservices architectures, Redis plays a second role as a shared fast datastore: a central session store that all frontends hit, a rate limiter that all API gateways respect, or a lightweight message broker that connects services without the overhead of a full queue system like Kafka or RabbitMQ.</p><p>Cloud providers offer managed Redis services (AWS ElastiCache, Azure Cache for Redis, and Google Cloud Memorystore) that handle provisioning, scaling, and failover automatically. This makes slotting Redis into an existing stack straightforward, without managing infrastructure directly.</p><h2>When not to use Redis</h2><p>Redis is not the right tool when:</p><ul><li><p><strong>Your dataset is large and cold</strong> &#8594; RAM is expensive per GB. Storing a 10TB archive in Redis would cost a fortune. Use a disk-based store and cache only the hot subset in Redis.</p></li><li><p><strong>You need complex queries</strong> &#8594; &#8220;Find all users from Region A who purchased Product B in the last 30 days&#8221; requires a relational database. Redis retrieves by key; it does not scan or join.</p></li><li><p><strong>You need strong durability</strong> &#8594; If losing even a few seconds of writes is unacceptable (financial transactions, medical records), Redis&#8217;s persistence model needs careful configuration, and a fully ACID-compliant database is the safer option.</p></li><li><p><strong>Your workload is stateless and simple</strong> &#8594; For systems that don&#8217;t cache, don&#8217;t need sessions, and don&#8217;t need messaging, adding Redis introduces operational complexity without a proportional benefit.</p></li></ul><h2>The takeaway</h2><p>Redis is best understood as a <strong>performance multiplier</strong>, not a database replacement.</p><p>It doesn&#8217;t try to solve everything. It solves a narrow set of problems extremely well: caching, sessions, rate limiting, lightweight messaging.</p><p>And that&#8217;s exactly why it&#8217;s everywhere.</p><p>Used correctly, Redis turns slow paths into fast ones and fragile systems into responsive ones.</p><p>Used blindly, it becomes an expensive, leaky abstraction.</p><div><hr></div><p>&#128075; If you liked this post &#8594; Like + Restack + Share to help others learn system design.</p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Subscribe to get high-signal, clear, and visual system design breakdowns straight to your inbox:&nbsp;</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Database Indexing Clearly Explained]]></title><description><![CDATA[(4 minutes) | What indexes really do, index types, how the optimizer decides, when they help (and when they hurt), and the right mental model]]></description><link>https://blog.levelupcoding.com/p/database-indexing-clearly-explained</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/database-indexing-clearly-explained</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Mon, 13 Apr 2026 11:12:46 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/c357108e-5f8d-452b-b81e-c1556ec881c6_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Get our 142-page System Design Handbook for free on newsletter signup:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2><a href="https://lucode.co/building-memory-aware-agents-course-oracle-z7nl">Agent Memory: Building Memory-Aware Agents</a></h2><h5>Presented by Oracle</h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!FG3I!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee65843-8b4e-406b-8c0e-6f9aa7beb738_950x534.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FG3I!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee65843-8b4e-406b-8c0e-6f9aa7beb738_950x534.png 424w, https://substackcdn.com/image/fetch/$s_!FG3I!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee65843-8b4e-406b-8c0e-6f9aa7beb738_950x534.png 848w, https://substackcdn.com/image/fetch/$s_!FG3I!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee65843-8b4e-406b-8c0e-6f9aa7beb738_950x534.png 1272w, https://substackcdn.com/image/fetch/$s_!FG3I!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee65843-8b4e-406b-8c0e-6f9aa7beb738_950x534.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!FG3I!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee65843-8b4e-406b-8c0e-6f9aa7beb738_950x534.png" width="950" height="534" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2ee65843-8b4e-406b-8c0e-6f9aa7beb738_950x534.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:534,&quot;width&quot;:950,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:496175,&quot;alt&quot;:&quot;&quot;,&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://blog.levelupcoding.com/i/190397808?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee65843-8b4e-406b-8c0e-6f9aa7beb738_950x534.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_!FG3I!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee65843-8b4e-406b-8c0e-6f9aa7beb738_950x534.png 424w, https://substackcdn.com/image/fetch/$s_!FG3I!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee65843-8b4e-406b-8c0e-6f9aa7beb738_950x534.png 848w, https://substackcdn.com/image/fetch/$s_!FG3I!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee65843-8b4e-406b-8c0e-6f9aa7beb738_950x534.png 1272w, https://substackcdn.com/image/fetch/$s_!FG3I!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee65843-8b4e-406b-8c0e-6f9aa7beb738_950x534.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 aria-hidden="true" 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><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><a href="https://lucode.co/building-memory-aware-agents-course-oracle-z7nl">Free short course</a></strong> on DeepLearning. By the end, you&#8217;ll have assembled a fully stateful Memory Aware Agent that loads prior context at startup, assembles relevant context, state, tools, and outputs and improves across sessions.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://lucode.co/building-memory-aware-agents-course-oracle-z7nl&quot;,&quot;text&quot;:&quot;Start Building&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://lucode.co/building-memory-aware-agents-course-oracle-z7nl"><span>Start Building</span></a></p><div><hr></div><h1>How Database Indexing Really Works</h1><p>Slow queries have a reflex fix: add an index.</p><p>It works often enough that teams keep doing it; until write latency creeps up, storage balloons, and the query planner starts making strange choices.</p><p>That&#8217;s the index tax. Real, measurable, and entirely predictable once you understand what an index actually costs.</p><p>The goal isn&#8217;t to index everything. It&#8217;s to index the right things, and know when to stop.</p><h2>What an index really does</h2><p>At the simplest level, an index maps a search key to where the row lives, much like a book index maps a chapter to page numbers.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!bHeI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2629356-c499-4a6b-8718-9525b5f760c3_2000x647.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!bHeI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2629356-c499-4a6b-8718-9525b5f760c3_2000x647.png 424w, https://substackcdn.com/image/fetch/$s_!bHeI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2629356-c499-4a6b-8718-9525b5f760c3_2000x647.png 848w, https://substackcdn.com/image/fetch/$s_!bHeI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2629356-c499-4a6b-8718-9525b5f760c3_2000x647.png 1272w, https://substackcdn.com/image/fetch/$s_!bHeI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2629356-c499-4a6b-8718-9525b5f760c3_2000x647.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!bHeI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2629356-c499-4a6b-8718-9525b5f760c3_2000x647.png" width="1456" height="471" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e2629356-c499-4a6b-8718-9525b5f760c3_2000x647.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:471,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:609848,&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://blog.levelupcoding.com/i/193543901?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2629356-c499-4a6b-8718-9525b5f760c3_2000x647.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_!bHeI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2629356-c499-4a6b-8718-9525b5f760c3_2000x647.png 424w, https://substackcdn.com/image/fetch/$s_!bHeI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2629356-c499-4a6b-8718-9525b5f760c3_2000x647.png 848w, https://substackcdn.com/image/fetch/$s_!bHeI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2629356-c499-4a6b-8718-9525b5f760c3_2000x647.png 1272w, https://substackcdn.com/image/fetch/$s_!bHeI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2629356-c499-4a6b-8718-9525b5f760c3_2000x647.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 aria-hidden="true" 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><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 goal is to cut down how much of the table the engine must look through to answer a query.</p><p>That helps in a few common cases:</p><ul><li><p><strong>Point lookups</strong> &#8594; <code>WHERE id = 42</code> becomes a targeted search instead of a full scan.</p></li><li><p><strong>Range queries</strong> &#8594; <code>BETWEEN</code>, <code>&lt;</code>, and <code>&gt;</code> work well when keys stay in order.</p></li><li><p><strong>Joins</strong> &#8594; An index on join keys helps the engine find matching rows faster.</p></li><li><p><strong>Ordering</strong> &#8594; A tree index can return rows in sorted order without an extra sort step.</p></li><li><p><strong>Uniqueness</strong> &#8594; Unique indexes help enforce &#8220;this value must appear only once.&#8221;</p></li></ul><p>The catch is that every <code>INSERT</code>, <code>UPDATE</code>, and <code>DELETE</code> must also update the index. So every helpful index also comes with a write tax. Add too many, and your database starts carrying extra baggage on every row change.</p><h2>Index types</h2><p>Not all indexes work the same way. Each structure solves a different query pattern.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QxKW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aa7b969-0be7-49bb-9134-c758fab1690c_2000x1119.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QxKW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aa7b969-0be7-49bb-9134-c758fab1690c_2000x1119.png 424w, https://substackcdn.com/image/fetch/$s_!QxKW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aa7b969-0be7-49bb-9134-c758fab1690c_2000x1119.png 848w, https://substackcdn.com/image/fetch/$s_!QxKW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aa7b969-0be7-49bb-9134-c758fab1690c_2000x1119.png 1272w, https://substackcdn.com/image/fetch/$s_!QxKW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aa7b969-0be7-49bb-9134-c758fab1690c_2000x1119.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QxKW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aa7b969-0be7-49bb-9134-c758fab1690c_2000x1119.png" width="1456" height="815" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0aa7b969-0be7-49bb-9134-c758fab1690c_2000x1119.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:815,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:430453,&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://blog.levelupcoding.com/i/193543901?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aa7b969-0be7-49bb-9134-c758fab1690c_2000x1119.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_!QxKW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aa7b969-0be7-49bb-9134-c758fab1690c_2000x1119.png 424w, https://substackcdn.com/image/fetch/$s_!QxKW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aa7b969-0be7-49bb-9134-c758fab1690c_2000x1119.png 848w, https://substackcdn.com/image/fetch/$s_!QxKW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aa7b969-0be7-49bb-9134-c758fab1690c_2000x1119.png 1272w, https://substackcdn.com/image/fetch/$s_!QxKW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aa7b969-0be7-49bb-9134-c758fab1690c_2000x1119.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 aria-hidden="true" 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><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 relational databases use B-tree style indexes by default, often implemented internally as B+ trees.</p><p>B-trees are the safe first choice for most OLTP queries:</p><ul><li><p><strong>Equality filters</strong> &#8594; Great for exact matches.</p></li><li><p><strong>Range filters</strong> &#8594; Great for time windows and ordered values.</p></li><li><p><strong>Ordered reads</strong> &#8594; Helpful for <code>ORDER BY</code>.</p></li><li><p><strong>General-purpose use</strong> &#8594; Good default when your data is sortable and your workload is mixed.</p></li></ul><p>B-trees are the workhorse, while other index families exist for more specialized conditions and data shapes.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!SgxG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac97d918-20e5-416c-abc1-998b215c6d5c_2000x1219.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!SgxG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac97d918-20e5-416c-abc1-998b215c6d5c_2000x1219.png 424w, https://substackcdn.com/image/fetch/$s_!SgxG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac97d918-20e5-416c-abc1-998b215c6d5c_2000x1219.png 848w, https://substackcdn.com/image/fetch/$s_!SgxG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac97d918-20e5-416c-abc1-998b215c6d5c_2000x1219.png 1272w, https://substackcdn.com/image/fetch/$s_!SgxG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac97d918-20e5-416c-abc1-998b215c6d5c_2000x1219.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!SgxG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac97d918-20e5-416c-abc1-998b215c6d5c_2000x1219.png" width="1456" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ac97d918-20e5-416c-abc1-998b215c6d5c_2000x1219.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:543184,&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://blog.levelupcoding.com/i/193543901?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac97d918-20e5-416c-abc1-998b215c6d5c_2000x1219.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_!SgxG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac97d918-20e5-416c-abc1-998b215c6d5c_2000x1219.png 424w, https://substackcdn.com/image/fetch/$s_!SgxG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac97d918-20e5-416c-abc1-998b215c6d5c_2000x1219.png 848w, https://substackcdn.com/image/fetch/$s_!SgxG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac97d918-20e5-416c-abc1-998b215c6d5c_2000x1219.png 1272w, https://substackcdn.com/image/fetch/$s_!SgxG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac97d918-20e5-416c-abc1-998b215c6d5c_2000x1219.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 aria-hidden="true" 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><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><h2>How the optimizer decides</h2><p>This is what catches most engineers: just because the index exists, doesn&#8217;t mean it&#8217;ll be used.</p><p>The optimizer decides to use an index when its cost model estimates that the index path is cheaper than reading the table directly.</p><p>That decision depends heavily on statistics: row counts, value distribution, selectivity, and sometimes histograms. If those statistics are stale, the optimizer can make a bad decision.</p><p>This is why keeping statistics fresh matters.</p><p>PostgreSQL uses <code>ANALYZE</code> to populate <code>pg_statistic</code>. MySQL manages histograms via <code>ANALYZE TABLE</code>. If statistics are stale, the optimizer can pick a costly plan even when a good index exists.</p><p>The optimizer assigns a cost to each candidate plan and picks the cheapest. In PostgreSQL, you can nudge this by tuning <code>random_page_cost</code> relative to <code>seq_page_cost</code>; lowering the ratio makes the planner more willing to use index scans.</p><h2>When not to add an index</h2><p>You shouldn&#8217;t add an index just because a column appears in a <code>WHERE</code> clause once. Indexes pay off when they serve a repeated access pattern better than their write and storage cost.</p><p>Avoid or remove an index when:</p><ul><li><p><strong>It is rarely used</strong> &#8594; Unused indexes still slow writes.</p></li><li><p><strong>It duplicates another index</strong> &#8594; Same leading columns often mean overlapping value.</p></li><li><p><strong>The predicate is not selective</strong> &#8594; If most rows match, scanning may still be cheaper.</p></li><li><p><strong>Writes dominate the workload</strong> &#8594; More indexes means more maintenance on every change.</p></li><li><p><strong>The query prevents index use</strong> &#8594; Wrapping a column in a function can block index use unless you build the matching expression index.</p></li></ul><p>There is also a physical side to this.</p><p>Indexes can fragment, bloat, and lose page density over time, especially under heavy updates. That&#8217;s why rebuild, reorganize, or reindex operations exist across major databases. An index can be conceptually correct and still operationally unhealthy.</p><h2>The right mental model</h2><p>The best indexing strategy is not &#8220;index everything.&#8221;</p><p>It is &#8220;match the structure to the predicate, then verify with real plans.&#8221;</p><p>That means:</p><ul><li><p><strong>Start with the query pattern</strong> &#8594; Index for how you filter, join, and sort.</p></li><li><p><strong>Start with B-trees</strong> &#8594; Switch only when the data shape clearly demands another family.</p></li><li><p><strong>Keep stats fresh</strong> &#8594; The optimizer can only choose well with up-to-date statistics.</p></li><li><p><strong>Prefer fewer, sharper indexes</strong> &#8594; Each one should earn its keep.</p></li><li><p><strong>Re-check over time</strong> &#8594; Workloads shift, and yesterday&#8217;s useful index becomes tomorrow&#8217;s write penalty.</p></li></ul><p>Indexes are best understood as a trade: you spend extra work on writes so reads can skip unnecessary work. Once you see that trade clearly, index tuning stops feeling like superstition and starts feeling like engineering.</p><div><hr></div><p>&#128075; If you liked this post &#8594; Like + Restack + Share to help others learn system design.</p><div><hr></div><p>Subscribe to get high-signal, clear, and visual system design breakdowns straight to your inbox:</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">&nbsp;</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Circuit Breakers: How to Stop Small Failures from Spreading]]></title><description><![CDATA[(4 Minutes) | What they are, what triggers a trip, why they help so much, observability, and when to use them (and when not to)]]></description><link>https://blog.levelupcoding.com/p/circuit-breakers-explained</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/circuit-breakers-explained</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Thu, 09 Apr 2026 12:03:57 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/cf80439c-073e-435e-9546-107c7ea29ba8_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Get our 142-page System Design Handbook for free on newsletter signup:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2><a href="https://lucode.co/exe-dot-dev-z7nl">Write Software: Private, Persistent, Share with a Link</a></h2><h5>Presented by <a href="https://lucode.co/exe-dot-dev-z7nl">exe.dev</a></h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!M9ig!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111082ac-d23f-453f-9346-7aba1aac2aa1_1009x544.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!M9ig!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111082ac-d23f-453f-9346-7aba1aac2aa1_1009x544.png 424w, https://substackcdn.com/image/fetch/$s_!M9ig!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111082ac-d23f-453f-9346-7aba1aac2aa1_1009x544.png 848w, https://substackcdn.com/image/fetch/$s_!M9ig!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111082ac-d23f-453f-9346-7aba1aac2aa1_1009x544.png 1272w, https://substackcdn.com/image/fetch/$s_!M9ig!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111082ac-d23f-453f-9346-7aba1aac2aa1_1009x544.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!M9ig!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111082ac-d23f-453f-9346-7aba1aac2aa1_1009x544.png" width="1009" height="544" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/111082ac-d23f-453f-9346-7aba1aac2aa1_1009x544.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:544,&quot;width&quot;:1009,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:108855,&quot;alt&quot;:&quot;&quot;,&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://blog.levelupcoding.com/i/193454211?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111082ac-d23f-453f-9346-7aba1aac2aa1_1009x544.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_!M9ig!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111082ac-d23f-453f-9346-7aba1aac2aa1_1009x544.png 424w, https://substackcdn.com/image/fetch/$s_!M9ig!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111082ac-d23f-453f-9346-7aba1aac2aa1_1009x544.png 848w, https://substackcdn.com/image/fetch/$s_!M9ig!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111082ac-d23f-453f-9346-7aba1aac2aa1_1009x544.png 1272w, https://substackcdn.com/image/fetch/$s_!M9ig!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111082ac-d23f-453f-9346-7aba1aac2aa1_1009x544.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 aria-hidden="true" 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><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><a href="https://lucode.co/exe-dot-dev-z7nl">Exe.dev</a></strong> gives you <strong>instant VMs over SSH</strong>. Spin up a full VM in seconds over SSH with built-in HTTPS exposure, persistent storage, and zero cloud configuration. No networking setup, no rebuilding environments, no YAML. Optimized for side projects, internal tools, and AI agents. Start a new sandbox, systemd and all, in a second.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://lucode.co/exe-dot-dev-z7nl&quot;,&quot;text&quot;:&quot;Try it Out&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://lucode.co/exe-dot-dev-z7nl"><span>Try it Out</span></a></p><div><hr></div><h1>Circuit Breakers: How to Stop Small Failures from Spreading</h1><p>Retries make your system more resilient. Until they make it worse.</p><p>When a dependency is genuinely down, retrying doesn&#8217;t help.</p><p>That is how a small outage turns into a bigger one: threads pile up, retries multiply, queues grow, and healthy parts of the system start failing just because they are waiting on something unhealthy.</p><p>A circuit breaker exists to stop that spread.</p><p>It fails fast on purpose, because a quick &#8220;no&#8221; is often safer than a slow collapse.</p><h2>What a circuit breaker actually is</h2><p>A circuit breaker is a proxy that sits between your code and a dependency like an API, database, or downstream service.</p><p>It monitors every call for failures, timeouts, and slow responses. When things look bad enough, it stops forwarding requests entirely and starts failing fast instead of letting threads pile up waiting for a service that won&#8217;t recover on its own.</p><p>Most health-based circuit breakers use three states:</p><ul><li><p><strong>Closed</strong> &#8594; Requests flow normally, and the breaker tracks failures, timeouts, or slow calls.</p></li><li><p><strong>Open</strong> &#8594; Requests fail immediately instead of touching the unhealthy dependency.</p></li><li><p><strong>Half-open</strong> &#8594; A small number of trial calls test whether the dependency has recovered.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!M5FZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdefb79eb-37f0-4f83-b941-c4d2509ffd44_2000x1299.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!M5FZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdefb79eb-37f0-4f83-b941-c4d2509ffd44_2000x1299.png 424w, https://substackcdn.com/image/fetch/$s_!M5FZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdefb79eb-37f0-4f83-b941-c4d2509ffd44_2000x1299.png 848w, https://substackcdn.com/image/fetch/$s_!M5FZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdefb79eb-37f0-4f83-b941-c4d2509ffd44_2000x1299.png 1272w, https://substackcdn.com/image/fetch/$s_!M5FZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdefb79eb-37f0-4f83-b941-c4d2509ffd44_2000x1299.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!M5FZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdefb79eb-37f0-4f83-b941-c4d2509ffd44_2000x1299.png" width="1456" height="946" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/defb79eb-37f0-4f83-b941-c4d2509ffd44_2000x1299.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:946,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:629677,&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://blog.levelupcoding.com/i/192820234?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdefb79eb-37f0-4f83-b941-c4d2509ffd44_2000x1299.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_!M5FZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdefb79eb-37f0-4f83-b941-c4d2509ffd44_2000x1299.png 424w, https://substackcdn.com/image/fetch/$s_!M5FZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdefb79eb-37f0-4f83-b941-c4d2509ffd44_2000x1299.png 848w, https://substackcdn.com/image/fetch/$s_!M5FZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdefb79eb-37f0-4f83-b941-c4d2509ffd44_2000x1299.png 1272w, https://substackcdn.com/image/fetch/$s_!M5FZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdefb79eb-37f0-4f83-b941-c4d2509ffd44_2000x1299.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 aria-hidden="true" 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><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><h2>What triggers a trip</h2><p>Not all failures look the same, so not all circuit breakers trip for the same reason.</p><p>Some open after a run of consecutive failures. That works well for low-traffic calls where even a few failures are meaningful.</p><p>Some open on failure rate. Instead of asking &#8220;Did five calls fail in a row?&#8221; they ask &#8220;Is too large a share of recent traffic failing?&#8221; That works better for high-volume services because it filters out noise.</p><p>Some open on slow-call rate. This is important because a dependency does not need to be fully down to be dangerous. A slow database can burn your connection pool long before it starts returning errors.</p><p>And some proxy or mesh-level breakers focus on capacity rather than health. They trip on too many active requests, pending requests, retries, or connections. These don&#8217;t ask whether the dependency is broken. They ask whether the system can safely take more load.</p><p>Here is the key difference:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!o-_t!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ff16d28-f905-42b9-8877-ad1d2fc8944f_2000x639.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!o-_t!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ff16d28-f905-42b9-8877-ad1d2fc8944f_2000x639.png 424w, https://substackcdn.com/image/fetch/$s_!o-_t!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ff16d28-f905-42b9-8877-ad1d2fc8944f_2000x639.png 848w, https://substackcdn.com/image/fetch/$s_!o-_t!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ff16d28-f905-42b9-8877-ad1d2fc8944f_2000x639.png 1272w, https://substackcdn.com/image/fetch/$s_!o-_t!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ff16d28-f905-42b9-8877-ad1d2fc8944f_2000x639.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!o-_t!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ff16d28-f905-42b9-8877-ad1d2fc8944f_2000x639.png" width="1456" height="465" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9ff16d28-f905-42b9-8877-ad1d2fc8944f_2000x639.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:465,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:406566,&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://blog.levelupcoding.com/i/192820234?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ff16d28-f905-42b9-8877-ad1d2fc8944f_2000x639.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_!o-_t!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ff16d28-f905-42b9-8877-ad1d2fc8944f_2000x639.png 424w, https://substackcdn.com/image/fetch/$s_!o-_t!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ff16d28-f905-42b9-8877-ad1d2fc8944f_2000x639.png 848w, https://substackcdn.com/image/fetch/$s_!o-_t!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ff16d28-f905-42b9-8877-ad1d2fc8944f_2000x639.png 1272w, https://substackcdn.com/image/fetch/$s_!o-_t!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ff16d28-f905-42b9-8877-ad1d2fc8944f_2000x639.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 aria-hidden="true" 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><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 is why teams often use both. One protects against unhealthy behavior. The other protects against unhealthy volume.</p><h2>Why circuit breakers help so much</h2><p>The biggest benefit is not speed. It is containment.</p><p>When a dependency is clearly struggling, the breaker stops your service from wasting resources on calls that are likely to fail anyway.</p><p>That gives the rest of your system room to breathe.</p><p>It also makes failure easier to shape.</p><ul><li><p><strong>Fail fast</strong> &#8594; Users get a quick error or fallback instead of waiting through long timeouts.</p></li><li><p><strong>Protect capacity</strong> &#8594; Threads, sockets, and pools stay available for work that still has a chance to succeed.</p></li><li><p><strong>Reduce blast radius</strong> &#8594; One broken service is less likely to drag healthy services down with it.</p></li><li><p><strong>Support graceful degradation</strong> &#8594; You can return cached data, defaults, or partial results instead of total failure.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!M4Km!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ae3cc8b-ecf9-47ed-ac75-712715fd0aa4_2000x1101.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!M4Km!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ae3cc8b-ecf9-47ed-ac75-712715fd0aa4_2000x1101.png 424w, https://substackcdn.com/image/fetch/$s_!M4Km!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ae3cc8b-ecf9-47ed-ac75-712715fd0aa4_2000x1101.png 848w, https://substackcdn.com/image/fetch/$s_!M4Km!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ae3cc8b-ecf9-47ed-ac75-712715fd0aa4_2000x1101.png 1272w, https://substackcdn.com/image/fetch/$s_!M4Km!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ae3cc8b-ecf9-47ed-ac75-712715fd0aa4_2000x1101.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!M4Km!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ae3cc8b-ecf9-47ed-ac75-712715fd0aa4_2000x1101.png" width="1456" height="802" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0ae3cc8b-ecf9-47ed-ac75-712715fd0aa4_2000x1101.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:802,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1338471,&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://blog.levelupcoding.com/i/192820234?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ae3cc8b-ecf9-47ed-ac75-712715fd0aa4_2000x1101.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_!M4Km!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ae3cc8b-ecf9-47ed-ac75-712715fd0aa4_2000x1101.png 424w, https://substackcdn.com/image/fetch/$s_!M4Km!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ae3cc8b-ecf9-47ed-ac75-712715fd0aa4_2000x1101.png 848w, https://substackcdn.com/image/fetch/$s_!M4Km!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ae3cc8b-ecf9-47ed-ac75-712715fd0aa4_2000x1101.png 1272w, https://substackcdn.com/image/fetch/$s_!M4Km!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ae3cc8b-ecf9-47ed-ac75-712715fd0aa4_2000x1101.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 aria-hidden="true" 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><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>This is why circuit breakers often pair well with fallbacks. If a recommendation service is down, your app can still show popular items. If a profile service is slow, you can still render most of the page.</p><p>The user sees degraded behavior, not a frozen system.</p><h2>Observability is non-negotiable</h2><p>A circuit breaker without monitoring is a black box that silently shapes your availability.</p><p>At minimum, track:</p><ul><li><p><strong>State transitions</strong> (Closed &#8594; Open &#8594; Half-Open)</p></li><li><p><strong>Failure rate</strong> and <strong>slow-call rate</strong> gauges</p></li><li><p><strong>Not-permitted calls</strong>, requests the breaker rejected without forwarding</p></li><li><p><strong>Overflow counters</strong> if you&#8217;re using Envoy (e.g. <code>upstream_cx_overflow</code>)</p></li></ul><p>Alert on state transitions when they exceed a rate threshold, and alert on sustained not-permitted calls correlated with user-impact SLIs (service level indicators).</p><p>One-off blips don&#8217;t warrant pages; sustained opens that burn your error budget do.</p><h2>When not to lean on a circuit breaker</h2><p>Circuit breakers are powerful, but they are not a substitute for basic resilience hygiene.</p><p>Do not use circuit breakers as a bandage for missing timeouts. If your calls can hang indefinitely, a circuit breaker will only react after damage is already done. Always set clear, enforced timeouts first, because they limit how long resources stay blocked.</p><p>Separate retries from circuit breakers. They solve different failure patterns. Retries help with brief, transient failures. Circuit breakers help when failure lasts long enough that retrying becomes harmful.</p><p>Avoid adding breakers everywhere. Not every dependency needs one. Each breaker introduces configuration, monitoring, and edge cases. Use them where failure is costly, not where it is merely inconvenient.</p><p>And be careful with shared breakers. If one breaker covers several independent shards or providers, failures in one can block traffic to the healthy ones too.</p><h2>Wrapping up</h2><p>Cascading failure doesn&#8217;t start with a catastrophic event.</p><p>It starts with one slow service and nothing to stop the pressure from spreading.</p><p>A circuit breaker is that stop.</p><p>That is the real win: a smaller blast radius when something goes wrong. And in distributed systems, survival often depends less on avoiding failure and more on containing it.</p><div><hr></div><p>&#128075; If you liked this post &#8594; Like + Restack + Share to help others learn system design.</p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Subscribe to get high-signal, clear, and visual system design breakdowns straight to your inbox:&nbsp;</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[REST APIs Properly Explained]]></title><description><![CDATA[(4 minutes) | Constraints, trade-offs, when not to use it, and more]]></description><link>https://blog.levelupcoding.com/p/rest-apis-properly-explained</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/rest-apis-properly-explained</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Tue, 31 Mar 2026 11:27:44 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/5f79476c-24c9-42b8-bfd5-744c14ad2086_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Get our 142-page System Design Handbook for FREE on newsletter signup:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2><a href="https://lucode.co/unblocked-z7nl">Unblocked: Context That Saves You Time and Tokens</a></h2><h5>Presented by Unblocked</h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Q2ce!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe880ec27-8639-4d2c-997a-d8c49a81ebac_1920x1080.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Q2ce!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe880ec27-8639-4d2c-997a-d8c49a81ebac_1920x1080.png 424w, https://substackcdn.com/image/fetch/$s_!Q2ce!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe880ec27-8639-4d2c-997a-d8c49a81ebac_1920x1080.png 848w, https://substackcdn.com/image/fetch/$s_!Q2ce!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe880ec27-8639-4d2c-997a-d8c49a81ebac_1920x1080.png 1272w, https://substackcdn.com/image/fetch/$s_!Q2ce!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe880ec27-8639-4d2c-997a-d8c49a81ebac_1920x1080.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Q2ce!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe880ec27-8639-4d2c-997a-d8c49a81ebac_1920x1080.png" width="1456" height="819" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e880ec27-8639-4d2c-997a-d8c49a81ebac_1920x1080.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;:619586,&quot;alt&quot;:&quot;&quot;,&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://blog.levelupcoding.com/i/191124687?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe880ec27-8639-4d2c-997a-d8c49a81ebac_1920x1080.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_!Q2ce!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe880ec27-8639-4d2c-997a-d8c49a81ebac_1920x1080.png 424w, https://substackcdn.com/image/fetch/$s_!Q2ce!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe880ec27-8639-4d2c-997a-d8c49a81ebac_1920x1080.png 848w, https://substackcdn.com/image/fetch/$s_!Q2ce!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe880ec27-8639-4d2c-997a-d8c49a81ebac_1920x1080.png 1272w, https://substackcdn.com/image/fetch/$s_!Q2ce!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe880ec27-8639-4d2c-997a-d8c49a81ebac_1920x1080.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 aria-hidden="true" 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><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>Stop babysitting your coding agents. <strong><a href="https://lucode.co/unblocked-z7nl">Unblocked</a></strong> gives them the organizational knowledge to generate mergeable code without the back and forth. It pulls context from across your engineering stack, resolves conflicts, and cuts the rework cycle by delivering only what agents need for the task at hand.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://lucode.co/unblocked-z7nl&quot;,&quot;text&quot;:&quot;See how it works&quot;,&quot;action&quot;:null,&quot;class&quot;:&quot;button-wrapper&quot;}" data-component-name="ButtonCreateButton"><a class="button primary button-wrapper" href="https://lucode.co/unblocked-z7nl"><span>See how it works</span></a></p><div><hr></div><h1>REST APIs Principles Explained Clearly</h1><p>What makes an API RESTful?</p><p>If your first thought is &#8220;resources and CRUD,&#8221; you&#8217;re missing half the picture.</p><p>REST is an architectural style with specific constraints, and most APIs only follow a subset. Knowing the full model helps you design better interfaces; and know when to choose something else.</p><h2>What is REST</h2><p>REST (Representational State Transfer) is an <strong>architectural style</strong> for distributed systems. It&#8217;s not a protocol, not &#8220;just JSON,&#8221; and not a synonym for &#8220;HTTP API.&#8221;</p><p>To be truly RESTful, a system follows six constraints:</p><ul><li><p><strong>Client&#8211;server separation</strong> &#8594; UI and data/service concerns are split so each can evolve independently</p></li><li><p><strong>Stateless interactions</strong> &#8594; Every request carries the full context; the server stores no client session</p></li><li><p><strong>Cacheable responses</strong> &#8594; Responses say whether they can be cached, so intermediaries can safely reuse them</p></li><li><p><strong>Uniform interface</strong> &#8594; Resources have URIs; standard HTTP methods and status codes describe operations. In strict REST, the interface is also driven by hypermedia (HATEOAS), though most APIs don&#8217;t fully implement this.</p></li><li><p><strong>Layered system</strong> &#8594; Clients can&#8217;t tell if they talk to the origin server, a gateway, or a proxy in the middle</p></li><li><p><strong>Code-on-demand (optional)</strong> &#8594; Servers may send executable code (like JS) to extend client behavior</p></li></ul><p>These rules sound theoretical, but they explain why REST scales, why it&#8217;s easy to debug, and why you can throw a CDN or API gateway in front without rewriting your app.</p><h2>The REST constraints, de-jargoned</h2><p>Here&#8217;s how the core constraints translate into day-to-day API 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_!O90Y!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18d7877-3d85-4ae5-b01a-51423e6ff54d_2000x1477.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!O90Y!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18d7877-3d85-4ae5-b01a-51423e6ff54d_2000x1477.png 424w, https://substackcdn.com/image/fetch/$s_!O90Y!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18d7877-3d85-4ae5-b01a-51423e6ff54d_2000x1477.png 848w, https://substackcdn.com/image/fetch/$s_!O90Y!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18d7877-3d85-4ae5-b01a-51423e6ff54d_2000x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!O90Y!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18d7877-3d85-4ae5-b01a-51423e6ff54d_2000x1477.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!O90Y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18d7877-3d85-4ae5-b01a-51423e6ff54d_2000x1477.png" width="1456" height="1075" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a18d7877-3d85-4ae5-b01a-51423e6ff54d_2000x1477.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1075,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:499310,&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://blog.levelupcoding.com/i/189857171?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18d7877-3d85-4ae5-b01a-51423e6ff54d_2000x1477.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_!O90Y!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18d7877-3d85-4ae5-b01a-51423e6ff54d_2000x1477.png 424w, https://substackcdn.com/image/fetch/$s_!O90Y!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18d7877-3d85-4ae5-b01a-51423e6ff54d_2000x1477.png 848w, https://substackcdn.com/image/fetch/$s_!O90Y!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18d7877-3d85-4ae5-b01a-51423e6ff54d_2000x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!O90Y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18d7877-3d85-4ae5-b01a-51423e6ff54d_2000x1477.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 aria-hidden="true" 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><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>Think of REST as the web&#8217;s &#8220;grammar&#8221; for talking about resources. Once you learn it for one API, others feel familiar because they follow the same structure.</p><h2>How a REST API actually works</h2><p>A REST API is basically: <strong>resources + URIs + HTTP semantics</strong>.</p><ul><li><p><strong>Resources</strong> &#8594; Domain nouns like <code>users</code>, <code>orders</code>, <code>products</code>, <code>employees</code></p></li><li><p><strong>URIs</strong> &#8594; Stable paths: <code>/products</code>, <code>/products/42</code>, <code>/customers/123/orders</code></p></li><li><p><strong>Methods</strong> &#8594; Map closely to CRUD:</p><ul><li><p><code>GET</code> &#8594; Read</p></li><li><p><code>POST</code> &#8594; Create</p></li><li><p><code>PUT</code> / <code>PATCH</code> &#8594; Update</p></li><li><p><code>DELETE</code> &#8594; Remove</p></li></ul></li></ul><p>Add to that:</p><ul><li><p><strong>Representations</strong> &#8594; Usually JSON documents that describe the resource state</p></li><li><p><strong>Status codes</strong> &#8594; Shared language for outcomes (<code>200 OK</code>, <code>201 Created</code>, <code>404 Not Found</code>, <code>500 Internal Server Error</code>)</p></li><li><p><strong>Caching</strong> &#8594; <code>GET</code> endpoints designed to be safely cached at browser, proxy, or CDN layers</p></li></ul><p>For example: in an e-commerce API, <code>GET /products</code> lists items, <code>GET /products/123</code> shows one product, <code>POST /orders</code> creates an order, and <code>GET /customers/123/orders</code> lists a customer&#8217;s history. Internally, the server can switch databases or split into microservices, but as long as those URIs and contracts stay stable, clients don&#8217;t care.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!oVgt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a309145-644f-4041-a4db-4523ac36a61f_1225x572.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oVgt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a309145-644f-4041-a4db-4523ac36a61f_1225x572.png 424w, https://substackcdn.com/image/fetch/$s_!oVgt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a309145-644f-4041-a4db-4523ac36a61f_1225x572.png 848w, https://substackcdn.com/image/fetch/$s_!oVgt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a309145-644f-4041-a4db-4523ac36a61f_1225x572.png 1272w, https://substackcdn.com/image/fetch/$s_!oVgt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a309145-644f-4041-a4db-4523ac36a61f_1225x572.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!oVgt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a309145-644f-4041-a4db-4523ac36a61f_1225x572.png" width="1225" height="572" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3a309145-644f-4041-a4db-4523ac36a61f_1225x572.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:572,&quot;width&quot;:1225,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:203039,&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://blog.levelupcoding.com/i/189857171?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a309145-644f-4041-a4db-4523ac36a61f_1225x572.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_!oVgt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a309145-644f-4041-a4db-4523ac36a61f_1225x572.png 424w, https://substackcdn.com/image/fetch/$s_!oVgt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a309145-644f-4041-a4db-4523ac36a61f_1225x572.png 848w, https://substackcdn.com/image/fetch/$s_!oVgt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a309145-644f-4041-a4db-4523ac36a61f_1225x572.png 1272w, https://substackcdn.com/image/fetch/$s_!oVgt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a309145-644f-4041-a4db-4523ac36a61f_1225x572.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 aria-hidden="true" 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><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><h2>Why REST became the default</h2><p>REST won not because it&#8217;s perfect, but because the trade-offs line up well with how most applications work.</p><ul><li><p><strong>Simple to learn</strong> &#8594; You can poke at a REST API with a browser or <code>curl</code> because it&#8217;s just HTTP</p></li><li><p><strong>Interoperable</strong> &#8594; Any language, framework, or device that can speak HTTP can be a client</p></li><li><p><strong>Scalable</strong> &#8594; Stateless servers are easy to scale horizontally behind a load balancer</p></li><li><p><strong>Fast enough</strong> &#8594; Built-in HTTP caching plus lightweight JSON is plenty for most CRUD-style workloads</p></li><li><p><strong>Decoupled</strong> &#8594; Backend teams can refactor internals or swap infrastructure without breaking clients</p></li><li><p><strong>Great tooling</strong> &#8594; OpenAPI, Postman, language SDK generators, gateways, and observability stacks all &#8220;speak REST&#8221;</p></li></ul><p>If your domain is resource-centric (products, posts, users, tickets) and most operations are CRUD-ish, REST is usually the path of least resistance.</p><h2>Where REST starts to creak</h2><p>REST&#8217;s weaknesses show up once your data needs get more complex or more demanding than &#8220;list + detail&#8221;:</p><ul><li><p><strong>Over-fetching</strong> &#8594; Clients get big objects when they only needed a few fields</p></li><li><p><strong>Under-fetching</strong> &#8594; Clients chain multiple calls (<code>user</code>, then <code>orders</code>, then <code>recommendations</code>) to render one screen</p></li><li><p><strong>Chattiness</strong> &#8594; Many small HTTP requests stack up latency, especially on mobile networks</p></li><li><p><strong>Loose contracts</strong> &#8594; JSON shapes are enforced by convention and docs, not by the protocol itself</p></li><li><p><strong>Versioning pain</strong> &#8594; Breaking changes often mean <code>/v2</code> endpoints or awkward backwards compatibility</p></li><li><p><strong>Real-time gaps</strong> &#8594; REST is request&#8211;response; you need WebSockets or SSE for live updates</p></li></ul><p>These aren&#8217;t fatal flaws, but they&#8217;re signals that you might need something <em>in addition</em> to REST.</p><h2>REST vs GraphQL vs gRPC: choosing wisely</h2><p>You don&#8217;t have to pick a single style for everything. Use them where they fit best: </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!W-GC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99eb1e62-a545-4db7-bad2-8206a850aa89_2000x886.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!W-GC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99eb1e62-a545-4db7-bad2-8206a850aa89_2000x886.png 424w, https://substackcdn.com/image/fetch/$s_!W-GC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99eb1e62-a545-4db7-bad2-8206a850aa89_2000x886.png 848w, https://substackcdn.com/image/fetch/$s_!W-GC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99eb1e62-a545-4db7-bad2-8206a850aa89_2000x886.png 1272w, https://substackcdn.com/image/fetch/$s_!W-GC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99eb1e62-a545-4db7-bad2-8206a850aa89_2000x886.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!W-GC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99eb1e62-a545-4db7-bad2-8206a850aa89_2000x886.png" width="1456" height="645" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/99eb1e62-a545-4db7-bad2-8206a850aa89_2000x886.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:645,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:394294,&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://blog.levelupcoding.com/i/189857171?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99eb1e62-a545-4db7-bad2-8206a850aa89_2000x886.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_!W-GC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99eb1e62-a545-4db7-bad2-8206a850aa89_2000x886.png 424w, https://substackcdn.com/image/fetch/$s_!W-GC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99eb1e62-a545-4db7-bad2-8206a850aa89_2000x886.png 848w, https://substackcdn.com/image/fetch/$s_!W-GC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99eb1e62-a545-4db7-bad2-8206a850aa89_2000x886.png 1272w, https://substackcdn.com/image/fetch/$s_!W-GC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99eb1e62-a545-4db7-bad2-8206a850aa89_2000x886.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 aria-hidden="true" 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><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>A good rule of thumb:</p><ul><li><p><strong>Start with REST</strong> &#8594; because it&#8217;s simple, well-understood, and easy to expose externally</p></li><li><p><strong>Add GraphQL</strong> &#8594; when specific clients juggle too many REST calls or need tailored payloads</p></li><li><p><strong>Use gRPC</strong> &#8594; inside your backend when performance, streaming, or strong typing is critical</p></li></ul><h2>When not to use REST</h2><p>Avoid pure REST as the main interface when:</p><ul><li><p>Your main goal is to <strong>query complex data</strong>, not manage individual resources.</p></li><li><p>Your services call each other <strong>thousands of times per second</strong> and every millisecond and byte counts</p></li><li><p>Your clients need <strong>live streams of updates</strong>, not occasional snapshots</p></li></ul><p>In these cases, REST can still play a supporting role (for management, control, or external access), but it shouldn&#8217;t carry the whole workload.</p><h2>Recap</h2><p>REST is more than JSON over HTTP. It&#8217;s a set of constraints that, when followed, give you APIs that are simple, scalable, cacheable, and widely compatible.</p><p>Understand those principles and you can do three important things: design cleaner APIs, recognize when a &#8220;REST API&#8221; isn&#8217;t really RESTful, and know when to reach for GraphQL or gRPC instead.</p><p>That&#8217;s the difference between copying patterns and making deliberate architectural choices.</p><div><hr></div><p>&#128075; If you liked this post &#8594; Like + Restack + Share to help others learn system design.</p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">&nbsp;Subscribe to get high-signal, clear, and visual system design breakdowns straight to your inbox:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[How SSO Actually Works]]></title><description><![CDATA[(5 minutes) | What actually happens when you click &#8220;Sign in with Google&#8221;]]></description><link>https://blog.levelupcoding.com/p/sso-explained</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/sso-explained</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Sat, 28 Mar 2026 13:38:36 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/f25a42d6-fb1e-4bdc-9e08-43a3f873552a_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Get our 142-page System Design Handbook for FREE on newsletter signup:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2><a href="https://lucode.co/guide-build-multi-agent-rag-system-oracle-z7nl">Build a Multi Agent RAG system with A2A Protocol and LangChain</a></h2><h5>Presented by Oracle</h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!MYg7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fbef3da-e004-486c-b156-5ec3af20d205_1280x720.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MYg7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fbef3da-e004-486c-b156-5ec3af20d205_1280x720.jpeg 424w, https://substackcdn.com/image/fetch/$s_!MYg7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fbef3da-e004-486c-b156-5ec3af20d205_1280x720.jpeg 848w, https://substackcdn.com/image/fetch/$s_!MYg7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fbef3da-e004-486c-b156-5ec3af20d205_1280x720.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!MYg7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fbef3da-e004-486c-b156-5ec3af20d205_1280x720.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MYg7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fbef3da-e004-486c-b156-5ec3af20d205_1280x720.jpeg" width="1280" height="720" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6fbef3da-e004-486c-b156-5ec3af20d205_1280x720.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:720,&quot;width&quot;:1280,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:154603,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.levelupcoding.com/i/192085891?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fbef3da-e004-486c-b156-5ec3af20d205_1280x720.jpeg&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_!MYg7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fbef3da-e004-486c-b156-5ec3af20d205_1280x720.jpeg 424w, https://substackcdn.com/image/fetch/$s_!MYg7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fbef3da-e004-486c-b156-5ec3af20d205_1280x720.jpeg 848w, https://substackcdn.com/image/fetch/$s_!MYg7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fbef3da-e004-486c-b156-5ec3af20d205_1280x720.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!MYg7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fbef3da-e004-486c-b156-5ec3af20d205_1280x720.jpeg 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 aria-hidden="true" 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><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 multi-agent systems hit a bottleneck when one agent gets overloaded. The usual fix is scaling the entire pipeline, which adds cost without solving the real problem. With the A2A protocol, agents can discover each other, declare capabilities, and dynamically share workload so you can scale only the bottleneck.</p><p><strong><a href="https://lucode.co/guide-build-multi-agent-rag-system-oracle-z7nl">This guide</a></strong> walks you through building a scalable multi-agent RAG system.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://lucode.co/guide-build-multi-agent-rag-system-oracle-z7nl&quot;,&quot;text&quot;:&quot;Start building&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://lucode.co/guide-build-multi-agent-rag-system-oracle-z7nl"><span>Start building</span></a></p><div><hr></div><h1>How Single Sign-On Actually Works</h1><p>You&#8217;ve used SSO dozens of times without thinking about it.</p><p>You click &#8220;Sign in with Google,&#8221; land on a familiar login page, and seconds later you&#8217;re inside an app that never asked for your password.</p><p>It felt instant and frictionless.</p><p>But behind that smooth experience is a precise sequence of redirects, tokens, and cryptographic checks played out in an instant.</p><p>SSO isn&#8217;t magic. It&#8217;s a trust protocol; and understanding it changes how you design authentication, debug login failures, and make decisions about identity infrastructure.</p><h2>The core idea: Centralize identity, decentralize access</h2><p>At its heart, SSO separates authentication from application logic.</p><p>Instead of every app verifying usernames and passwords, one central service does it. That service is called the <strong>Identity Provider (IdP)</strong>. The applications you actually use are called <strong>Service Providers (SPs)</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_!cUWE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcecc6857-5dc7-4c2b-b4c0-a6db34dd6e61_2000x1083.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!cUWE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcecc6857-5dc7-4c2b-b4c0-a6db34dd6e61_2000x1083.png 424w, https://substackcdn.com/image/fetch/$s_!cUWE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcecc6857-5dc7-4c2b-b4c0-a6db34dd6e61_2000x1083.png 848w, https://substackcdn.com/image/fetch/$s_!cUWE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcecc6857-5dc7-4c2b-b4c0-a6db34dd6e61_2000x1083.png 1272w, https://substackcdn.com/image/fetch/$s_!cUWE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcecc6857-5dc7-4c2b-b4c0-a6db34dd6e61_2000x1083.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!cUWE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcecc6857-5dc7-4c2b-b4c0-a6db34dd6e61_2000x1083.png" width="1456" height="788" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cecc6857-5dc7-4c2b-b4c0-a6db34dd6e61_2000x1083.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:788,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:419332,&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://blog.levelupcoding.com/i/192175942?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcecc6857-5dc7-4c2b-b4c0-a6db34dd6e61_2000x1083.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_!cUWE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcecc6857-5dc7-4c2b-b4c0-a6db34dd6e61_2000x1083.png 424w, https://substackcdn.com/image/fetch/$s_!cUWE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcecc6857-5dc7-4c2b-b4c0-a6db34dd6e61_2000x1083.png 848w, https://substackcdn.com/image/fetch/$s_!cUWE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcecc6857-5dc7-4c2b-b4c0-a6db34dd6e61_2000x1083.png 1272w, https://substackcdn.com/image/fetch/$s_!cUWE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcecc6857-5dc7-4c2b-b4c0-a6db34dd6e61_2000x1083.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 aria-hidden="true" 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><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 key shift is this: SPs don&#8217;t authenticate you. They verify that the IdP authenticated you.</p><p>That distinction matters because it defines who owns credentials, who signs tokens, and who enforces trust.</p><h2>Why browsers make this necessary</h2><p>Browsers enforce the same-origin policy. That means one website cannot read another website&#8217;s cookies.</p><p>So if <code>app1.com</code> and <code>app2.com</code> are separate domains, they cannot directly share login sessions.</p><p>SSO solves this by introducing a trusted third party: the IdP lives on its own domain (e.g. <code>login.company.com</code>). Each application redirects you there when authentication is required. The IdP becomes the only place where credentials are checked.</p><p>Instead of apps sharing cookies, they share trust.</p><h2>The step-by-step flow</h2><p>Here&#8217;s what happens when you access an SSO-protected app for the first time:</p><h3>1. User requests a protected app</h3><p>You visit <code>serviceprovider.com</code>.</p><p>The SP checks for a valid session cookie, finds none, and knows it needs to authenticate you.</p><h3>2. SP redirects to the IdP</h3><p>Instead of showing a login form, the SP issues a HTTP redirect to the IdP.</p><p>That redirect includes:</p><ul><li><p>A request identifying the SP</p></li><li><p>A return URL</p></li><li><p>Possibly a signed authentication request</p></li></ul><p>Your browser now talks to the IdP.</p><h3>3. IdP authenticates the user</h3><p>If you&#8217;re not already logged in at the IdP, it presents a login page.</p><p>You enter credentials. The IdP verifies them. It may also enforce:</p><ul><li><p>Multi-factor authentication</p></li><li><p>Device checks</p></li><li><p>Risk-based policies</p></li></ul><p>If successful, the IdP creates its own session cookie for you.</p><h3>4. IdP issues a token</h3><p>The IdP generates an authentication token. This token contains:</p><ul><li><p>User identity</p></li><li><p>Issuer (the IdP)</p></li><li><p>Audience (the SP)</p></li><li><p>Expiration timestamp</p></li><li><p>Digital signature</p></li></ul><p>The browser is redirected back to the SP with this token attached.</p><h3>5. SP validates the token</h3><p>The SP verifies:</p><ul><li><p><strong>Signature</strong> &#8594; Was it signed by the trusted IdP?</p></li><li><p><strong>Expiry</strong> &#8594; Is it still valid?</p></li><li><p><strong>Audience</strong> &#8594; Was it intended for this app?</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_!JdOr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa86a91b6-6ac5-4737-9793-05c5cb0f5e96_2000x1268.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JdOr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa86a91b6-6ac5-4737-9793-05c5cb0f5e96_2000x1268.png 424w, https://substackcdn.com/image/fetch/$s_!JdOr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa86a91b6-6ac5-4737-9793-05c5cb0f5e96_2000x1268.png 848w, https://substackcdn.com/image/fetch/$s_!JdOr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa86a91b6-6ac5-4737-9793-05c5cb0f5e96_2000x1268.png 1272w, https://substackcdn.com/image/fetch/$s_!JdOr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa86a91b6-6ac5-4737-9793-05c5cb0f5e96_2000x1268.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!JdOr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa86a91b6-6ac5-4737-9793-05c5cb0f5e96_2000x1268.png" width="1456" height="923" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a86a91b6-6ac5-4737-9793-05c5cb0f5e96_2000x1268.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:923,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:436485,&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://blog.levelupcoding.com/i/192175942?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa86a91b6-6ac5-4737-9793-05c5cb0f5e96_2000x1268.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_!JdOr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa86a91b6-6ac5-4737-9793-05c5cb0f5e96_2000x1268.png 424w, https://substackcdn.com/image/fetch/$s_!JdOr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa86a91b6-6ac5-4737-9793-05c5cb0f5e96_2000x1268.png 848w, https://substackcdn.com/image/fetch/$s_!JdOr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa86a91b6-6ac5-4737-9793-05c5cb0f5e96_2000x1268.png 1272w, https://substackcdn.com/image/fetch/$s_!JdOr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa86a91b6-6ac5-4737-9793-05c5cb0f5e96_2000x1268.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 aria-hidden="true" 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><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 everything checks out, the SP creates its own session and logs the user in.</p><p>At no point did the SP see the password.</p><h2>Where &#8220;single&#8221; sign-on actually happens</h2><p>The magic appears when you visit a second application.</p><p>You go to <code>anotherservice.com</code>.</p><p>It redirects you to the same IdP.</p><p>But now the IdP sees its session cookie. You&#8217;re already authenticated.</p><p>So it immediately generates a new token for the second app without asking for credentials again.</p><p>From your perspective, no login screen appears.</p><p>Behind the scenes, the full protocol still runs. It just skips the credential step.</p><p>That&#8217;s single sign-on.</p><h2>What makes it secure</h2><p>The authentication token is the core artifact. Its security rests on three properties:</p><ul><li><p><strong>Digital signature</strong> &#8594; The IdP signs the token with its private key. The SP verifies the signature with the IdP&#8217;s public key, proving the token wasn&#8217;t forged or altered in transit.</p></li><li><p><strong>Bounded lifetime</strong> &#8594; Tokens include an expiry timestamp. A stolen token becomes useless after minutes, limiting the blast radius of interception.</p></li><li><p><strong>Audience restriction</strong> &#8594; Tokens name the intended SP. A token issued for <code>app1.com</code> is rejected by <code>app2.com</code>, preventing token reuse across services.</p></li></ul><p>The SP never sees the user&#8217;s password. It only sees the signed assertion.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!NNfK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F649ab52f-5a0c-4b30-9b11-a0b48ae03c79_2000x1260.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NNfK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F649ab52f-5a0c-4b30-9b11-a0b48ae03c79_2000x1260.png 424w, https://substackcdn.com/image/fetch/$s_!NNfK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F649ab52f-5a0c-4b30-9b11-a0b48ae03c79_2000x1260.png 848w, https://substackcdn.com/image/fetch/$s_!NNfK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F649ab52f-5a0c-4b30-9b11-a0b48ae03c79_2000x1260.png 1272w, https://substackcdn.com/image/fetch/$s_!NNfK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F649ab52f-5a0c-4b30-9b11-a0b48ae03c79_2000x1260.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!NNfK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F649ab52f-5a0c-4b30-9b11-a0b48ae03c79_2000x1260.png" width="1456" height="917" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/649ab52f-5a0c-4b30-9b11-a0b48ae03c79_2000x1260.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:917,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:416285,&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://blog.levelupcoding.com/i/192175942?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F649ab52f-5a0c-4b30-9b11-a0b48ae03c79_2000x1260.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_!NNfK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F649ab52f-5a0c-4b30-9b11-a0b48ae03c79_2000x1260.png 424w, https://substackcdn.com/image/fetch/$s_!NNfK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F649ab52f-5a0c-4b30-9b11-a0b48ae03c79_2000x1260.png 848w, https://substackcdn.com/image/fetch/$s_!NNfK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F649ab52f-5a0c-4b30-9b11-a0b48ae03c79_2000x1260.png 1272w, https://substackcdn.com/image/fetch/$s_!NNfK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F649ab52f-5a0c-4b30-9b11-a0b48ae03c79_2000x1260.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 aria-hidden="true" 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><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><h2>When SSO becomes a risk</h2><p>SSO centralizes authentication. That&#8217;s powerful, but it concentrates risk.</p><ul><li><p><strong>If the IdP goes down</strong> &#8594; every SP login fails</p></li><li><p><strong>If the IdP is compromised</strong> &#8594; every integrated app is exposed</p></li></ul><p>SSO reduces password sprawl but increases dependency on identity infrastructure.</p><p><strong>It works best when:</strong></p><ul><li><p>The app is used by teams or organizations, not just individuals</p></li><li><p>Customers expect centralized admin control (onboarding, offboarding, permissions)</p></li><li><p>The app handles sensitive data or privileged actions (finance, customer data, infra, admin tooling)</p></li><li><p>You&#8217;re selling into mid-market or enterprise, where SSO is often a requirement</p></li><li><p>Users are part of a broader ecosystem (Google Workspace, Entra, Okta) and need seamless access across tools</p></li><li><p>The product is part of a multi-app suite, and reducing login friction improves workflow</p></li></ul><p><strong>It may be overkill for:</strong></p><ul><li><p>Consumer apps with individual users and no org-level administration</p></li><li><p>Early-stage products where few (or no) customers are asking for SSO yet</p></li><li><p>Low-risk applications that don&#8217;t handle sensitive data or critical operations</p></li><li><p>Small internal tools used by a fixed group, especially behind VPN or other trust boundaries</p></li><li><p>Apps where identity is not central to the workflow and login happens infrequently</p></li></ul><h2>Wrapping up</h2><p>SSO removes the password from your app.</p><p>It doesn&#8217;t remove the responsibility.</p><p>Token validation, session expiry, single logout, and IdP availability all stay on your plate; and they matter more, not less, because authentication is now shared infrastructure.</p><p>The protocol handles the authentication. Everything that follows is still yours to design.</p><div><hr></div><p>&#128075; If you liked this post &#8594; Like + Restack + Share to help others learn system design.</p><div><hr></div><p>Subscribe to get high-signal, clear, and visual system design breakdowns straight to your inbox:</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">&nbsp;</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Hashing vs Encryption vs Tokenization]]></title><description><![CDATA[(5 minutes) | One question decides which one you should use...]]></description><link>https://blog.levelupcoding.com/p/hashing-vs-encryption-vs-tokenization</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/hashing-vs-encryption-vs-tokenization</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Tue, 24 Mar 2026 10:34:31 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/829281df-7d1d-4638-a140-154f2ea93252_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Get our 142-page System Design Handbook for FREE on newsletter signup:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2><a href="https://lucode.co/flox-z7nl">Reproducible Dev Environments That Work Everywhere</a></h2><h5>Presented by Flox</h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YRn8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac69ee37-aa29-4999-bde2-f3b78d2a71b0_1209x461.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YRn8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac69ee37-aa29-4999-bde2-f3b78d2a71b0_1209x461.png 424w, https://substackcdn.com/image/fetch/$s_!YRn8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac69ee37-aa29-4999-bde2-f3b78d2a71b0_1209x461.png 848w, https://substackcdn.com/image/fetch/$s_!YRn8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac69ee37-aa29-4999-bde2-f3b78d2a71b0_1209x461.png 1272w, https://substackcdn.com/image/fetch/$s_!YRn8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac69ee37-aa29-4999-bde2-f3b78d2a71b0_1209x461.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YRn8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac69ee37-aa29-4999-bde2-f3b78d2a71b0_1209x461.png" width="1209" height="461" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ac69ee37-aa29-4999-bde2-f3b78d2a71b0_1209x461.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:461,&quot;width&quot;:1209,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:127351,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:&quot;&quot;,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.levelupcoding.com/i/190729549?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac69ee37-aa29-4999-bde2-f3b78d2a71b0_1209x461.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_!YRn8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac69ee37-aa29-4999-bde2-f3b78d2a71b0_1209x461.png 424w, https://substackcdn.com/image/fetch/$s_!YRn8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac69ee37-aa29-4999-bde2-f3b78d2a71b0_1209x461.png 848w, https://substackcdn.com/image/fetch/$s_!YRn8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac69ee37-aa29-4999-bde2-f3b78d2a71b0_1209x461.png 1272w, https://substackcdn.com/image/fetch/$s_!YRn8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac69ee37-aa29-4999-bde2-f3b78d2a71b0_1209x461.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 aria-hidden="true" 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><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><a href="https://lucode.co/flox-z7nl">Flox</a></strong> lets teams define development environments once and run them consistently across local environments, CI pipelines, and production systems. By capturing dependencies, tools, and environment variables in a single manifest, teams can eliminate environment drift and ship software more reliably.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://lucode.co/flox-z7nl&quot;,&quot;text&quot;:&quot;Learn More&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://lucode.co/flox-z7nl"><span>Learn More</span></a></p><div><hr></div><h1>Hashing vs Encryption vs Tokenization: How to Pick the Right Tool</h1><p>Most security vulnerabilities aren&#8217;t caused by weak algorithms.</p><p>They come from using the right tool in the wrong situation.</p><p>Encrypting what should be hashed, or hashing what should be tokenized, doesn&#8217;t trigger an alarm; it just quietly erodes your defenses while everything appears to be working fine.</p><p>Hashing, encryption, and tokenization all transform sensitive data, but they answer completely different questions. Knowing which question you&#8217;re asking is the whole game.</p><h2>The core question: what are you trying to protect?</h2><p>Before picking a tool, answer one question:</p><p><strong>Do you need to recover the original value?</strong></p><ul><li><p>If no &#8594; hashing is likely the right fit.</p></li><li><p>If yes, and the goal is confidentiality &#8594; use encryption.</p></li><li><p>If yes, but the goal is limiting where sensitive data spreads &#8594; use tokenization.</p></li></ul><p>Each technique maps cleanly to a different security objective:</p><ul><li><p><strong>Hashing &#8594; Integrity and verification</strong></p></li><li><p><strong>Encryption &#8594; Confidentiality with controlled access</strong></p></li><li><p><strong>Tokenization &#8594; Exposure reduction across systems</strong></p></li></ul><p>They overlap in underlying mechanisms. They do not overlap in purpose.</p><h2>Hashing</h2><p>A cryptographic hash function takes input of any size and produces a fixed-length output called a digest. Change a single character, and the output changes completely.</p><p>It is intentionally one-way: you cannot feasibly recover the original input from the digest.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5fM5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd918a5a7-9d3d-4efc-beb4-b12cb2c1c1bc_2000x1000.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5fM5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd918a5a7-9d3d-4efc-beb4-b12cb2c1c1bc_2000x1000.png 424w, https://substackcdn.com/image/fetch/$s_!5fM5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd918a5a7-9d3d-4efc-beb4-b12cb2c1c1bc_2000x1000.png 848w, https://substackcdn.com/image/fetch/$s_!5fM5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd918a5a7-9d3d-4efc-beb4-b12cb2c1c1bc_2000x1000.png 1272w, https://substackcdn.com/image/fetch/$s_!5fM5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd918a5a7-9d3d-4efc-beb4-b12cb2c1c1bc_2000x1000.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5fM5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd918a5a7-9d3d-4efc-beb4-b12cb2c1c1bc_2000x1000.png" width="1456" height="728" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d918a5a7-9d3d-4efc-beb4-b12cb2c1c1bc_2000x1000.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;:339005,&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://blog.levelupcoding.com/i/191344843?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd918a5a7-9d3d-4efc-beb4-b12cb2c1c1bc_2000x1000.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_!5fM5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd918a5a7-9d3d-4efc-beb4-b12cb2c1c1bc_2000x1000.png 424w, https://substackcdn.com/image/fetch/$s_!5fM5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd918a5a7-9d3d-4efc-beb4-b12cb2c1c1bc_2000x1000.png 848w, https://substackcdn.com/image/fetch/$s_!5fM5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd918a5a7-9d3d-4efc-beb4-b12cb2c1c1bc_2000x1000.png 1272w, https://substackcdn.com/image/fetch/$s_!5fM5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd918a5a7-9d3d-4efc-beb4-b12cb2c1c1bc_2000x1000.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 aria-hidden="true" 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><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>Hashing is built for <strong>integrity</strong>:</p><ul><li><p>Verifying file downloads</p></li><li><p>Detecting message tampering</p></li><li><p>Supporting digital signatures</p></li><li><p>Storing passwords (with specialized constructions)</p></li></ul><p>But hashing has a subtlety most developers miss: <strong>not all hashing is the same</strong>.</p><ul><li><p><strong>Unkeyed hash (e.g. SHA-256)</strong> &#8594; Confirm that data hasn&#8217;t changed, but only through a trusted channel. An attacker who controls both the file and its published digest can swap both.</p></li><li><p><strong>Keyed hash (e.g. HMAC)</strong> &#8594; Use a shared secret to authenticate data against an active attacker. Required when you need integrity <em>and</em> authenticity.</p></li><li><p><strong>Password hashing (e.g. Argon2, scrypt, bcrypt)</strong> &#8594; A specialized case. Deliberately slow and memory-hard to make brute-force attacks expensive after a database breach. Never use SHA-256 for passwords.</p></li></ul><p>The most common failure here is using a fast, unkeyed hash as a stand-in for authentication.</p><p>It isn&#8217;t.</p><p><strong>What hashing cannot do:</strong></p><ul><li><p>It cannot provide confidentiality.</p></li><li><p>It cannot restore data.</p></li><li><p>It does not automatically provide authentication unless keyed.</p></li></ul><p>If you need the original value later, hashing is the wrong tool.</p><h2>Encryption</h2><p>Encryption transforms plaintext into ciphertext using a key. Only someone with the right key can reverse 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_!4juA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c0cf7b3-e6d6-45bd-832c-3602f758236c_2000x1000.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4juA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c0cf7b3-e6d6-45bd-832c-3602f758236c_2000x1000.png 424w, https://substackcdn.com/image/fetch/$s_!4juA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c0cf7b3-e6d6-45bd-832c-3602f758236c_2000x1000.png 848w, https://substackcdn.com/image/fetch/$s_!4juA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c0cf7b3-e6d6-45bd-832c-3602f758236c_2000x1000.png 1272w, https://substackcdn.com/image/fetch/$s_!4juA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c0cf7b3-e6d6-45bd-832c-3602f758236c_2000x1000.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4juA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c0cf7b3-e6d6-45bd-832c-3602f758236c_2000x1000.png" width="1456" height="728" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8c0cf7b3-e6d6-45bd-832c-3602f758236c_2000x1000.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;:370155,&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://blog.levelupcoding.com/i/191344843?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c0cf7b3-e6d6-45bd-832c-3602f758236c_2000x1000.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_!4juA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c0cf7b3-e6d6-45bd-832c-3602f758236c_2000x1000.png 424w, https://substackcdn.com/image/fetch/$s_!4juA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c0cf7b3-e6d6-45bd-832c-3602f758236c_2000x1000.png 848w, https://substackcdn.com/image/fetch/$s_!4juA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c0cf7b3-e6d6-45bd-832c-3602f758236c_2000x1000.png 1272w, https://substackcdn.com/image/fetch/$s_!4juA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c0cf7b3-e6d6-45bd-832c-3602f758236c_2000x1000.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 aria-hidden="true" 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><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>Unlike hashing, encryption is reversible by design.</p><p>This makes it the right tool for confidentiality:</p><ul><li><p>Data in transit (TLS)</p></li><li><p>Data at rest (disk/database encryption)</p></li><li><p>Secure messaging</p></li><li><p>Secure storage</p></li></ul><p>Modern encryption comes in two main shapes:</p><ul><li><p><strong>Symmetric encryption (AES)</strong> &#8594; The same key encrypts and decrypts. Fast and designed for bulk data.</p></li><li><p><strong>Asymmetric encryption (RSA, ECC)</strong> &#8594; Public key encrypts, private key decrypts. Slower, used primarily for key exchange and signatures, not bulk data.</p></li></ul><p>Real systems almost always use <strong>hybrid encryption</strong>: symmetric encryption for the data itself, asymmetric encryption to securely exchange the symmetric key. TLS works exactly this way.</p><p>There&#8217;s one critical nuance: <strong>confidentiality is not the same as integrity</strong>.</p><p>Today, encryption without integrity is considered incomplete. Authenticated Encryption with Associated Data (AEAD), such as AES-GCM, protects both:</p><ul><li><p><strong>Confidentiality</strong> &#8594; Attackers can&#8217;t read it.</p></li><li><p><strong>Integrity/authenticity</strong> &#8594; Attackers can&#8217;t modify it undetected .</p></li></ul><p>Older designs that are encrypted without authentication can be manipulated by an attacker who never sees the plaintext. This is why AEAD is now strongly preferred.</p><p>What encryption optimizes for:</p><ul><li><p>Controlled access to original data</p></li><li><p>Strong confidentiality guarantees</p></li><li><p>Regulatory recognition (GDPR, HIPAA references encryption explicitly)</p></li></ul><p>But encryption introduces a heavy dependency:</p><p>Key management.</p><p>Key lifecycle, rotation, storage (often HSM-backed), and cryptoperiod policies become first-class concerns.</p><p>Encryption protects content. It does not reduce how widely that content spreads.</p><h2>Tokenization</h2><p>Tokenization replaces a sensitive value with a surrogate &#8220;token&#8221;. The token carries no exploitable meaning on its own.</p><p>For example, in payment systems a PAN (Primary Account Number) becomes a token and downstream systems store the token, not the card number.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QpNL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8eea45d5-3f70-4fef-bfa3-0466fa21a608_2000x1000.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QpNL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8eea45d5-3f70-4fef-bfa3-0466fa21a608_2000x1000.png 424w, https://substackcdn.com/image/fetch/$s_!QpNL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8eea45d5-3f70-4fef-bfa3-0466fa21a608_2000x1000.png 848w, https://substackcdn.com/image/fetch/$s_!QpNL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8eea45d5-3f70-4fef-bfa3-0466fa21a608_2000x1000.png 1272w, https://substackcdn.com/image/fetch/$s_!QpNL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8eea45d5-3f70-4fef-bfa3-0466fa21a608_2000x1000.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QpNL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8eea45d5-3f70-4fef-bfa3-0466fa21a608_2000x1000.png" width="1456" height="728" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8eea45d5-3f70-4fef-bfa3-0466fa21a608_2000x1000.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;:293321,&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://blog.levelupcoding.com/i/191344843?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8eea45d5-3f70-4fef-bfa3-0466fa21a608_2000x1000.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_!QpNL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8eea45d5-3f70-4fef-bfa3-0466fa21a608_2000x1000.png 424w, https://substackcdn.com/image/fetch/$s_!QpNL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8eea45d5-3f70-4fef-bfa3-0466fa21a608_2000x1000.png 848w, https://substackcdn.com/image/fetch/$s_!QpNL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8eea45d5-3f70-4fef-bfa3-0466fa21a608_2000x1000.png 1272w, https://substackcdn.com/image/fetch/$s_!QpNL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8eea45d5-3f70-4fef-bfa3-0466fa21a608_2000x1000.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 aria-hidden="true" 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><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 difference from encryption is architectural:</p><ul><li><p>Encryption protects data.</p></li><li><p>Tokenization limits exposure of data across systems.</p></li></ul><p>Encryption is the answer to &#8220;how do we hide this data?&#8221;. Tokenization is the answer to &#8220;how do we stop this data from spreading?&#8221;.</p><p>There are three main implementations:</p><ul><li><p><strong>Vault-based tokenization</strong> &#8594; A random token is generated and stored alongside the original value in a protected database (the vault). De-tokenization means querying the vault. Simple to reason about, but the vault becomes your highest-value attack target.</p></li><li><p><strong>Vaultless (cryptographic) tokenization</strong> &#8594; The token is generated using format-preserving encryption. No vault needed, but key management becomes critical.</p></li><li><p><strong>Irreversible tokenization</strong> &#8594; Tokens are never designed to be reversed. Used when you only need to validate or reference a record, not recover the original value.</p></li></ul><p>Tokenization earns its place in regulated environments because it limits <em>where</em> sensitive data lives.</p><h2>Side-by-side comparison</h2><p>Hashing, encryption, and tokenization all transform data, but they protect it in very different ways.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!H5bd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06e18d9e-15cb-44e4-9de6-9dc88cdc1bcc_2000x1474.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!H5bd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06e18d9e-15cb-44e4-9de6-9dc88cdc1bcc_2000x1474.png 424w, https://substackcdn.com/image/fetch/$s_!H5bd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06e18d9e-15cb-44e4-9de6-9dc88cdc1bcc_2000x1474.png 848w, https://substackcdn.com/image/fetch/$s_!H5bd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06e18d9e-15cb-44e4-9de6-9dc88cdc1bcc_2000x1474.png 1272w, https://substackcdn.com/image/fetch/$s_!H5bd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06e18d9e-15cb-44e4-9de6-9dc88cdc1bcc_2000x1474.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!H5bd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06e18d9e-15cb-44e4-9de6-9dc88cdc1bcc_2000x1474.png" width="1456" height="1073" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/06e18d9e-15cb-44e4-9de6-9dc88cdc1bcc_2000x1474.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1073,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:497471,&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://blog.levelupcoding.com/i/191344843?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06e18d9e-15cb-44e4-9de6-9dc88cdc1bcc_2000x1474.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_!H5bd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06e18d9e-15cb-44e4-9de6-9dc88cdc1bcc_2000x1474.png 424w, https://substackcdn.com/image/fetch/$s_!H5bd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06e18d9e-15cb-44e4-9de6-9dc88cdc1bcc_2000x1474.png 848w, https://substackcdn.com/image/fetch/$s_!H5bd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06e18d9e-15cb-44e4-9de6-9dc88cdc1bcc_2000x1474.png 1272w, https://substackcdn.com/image/fetch/$s_!H5bd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06e18d9e-15cb-44e4-9de6-9dc88cdc1bcc_2000x1474.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 aria-hidden="true" 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><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><h2>When not to use each</h2><p>Knowing when <em>not</em> to reach for a tool is as important as knowing when to use it.</p><p><strong>Don&#8217;t use hashing when:</strong></p><ul><li><p>You need to retrieve the original value. A hash is a one-way door.</p></li><li><p>You&#8217;re protecting a password with a fast algorithm like SHA-256. Use bcrypt, scrypt, or Argon2 instead, because speed is the enemy of password security.</p></li><li><p>You&#8217;re treating an unkeyed hash as a MAC. It isn&#8217;t, and extension attacks will prove it.</p></li></ul><p><strong>Don&#8217;t use encryption when:</strong></p><ul><li><p>You never need to read the original value back. Hashing is simpler and removes the key-management burden.</p></li><li><p>You&#8217;re trying to limit data spread across services. Encrypting a PAN and sending the ciphertext everywhere just moves the problem; tokenization removes it.</p></li></ul><p><strong>Don&#8217;t use tokenization when:</strong></p><ul><li><p>Your system is small and doesn&#8217;t have a serious compliance or data-minimization requirement. Running a vault adds availability dependencies and operational overhead that may not be justified.</p></li><li><p>You need the original value to be queryable for range scans or analytics joins. Tokenization scatters values in ways that break ordering and aggregation.</p></li></ul><h2>Recap</h2><p>Hashing, encryption, and tokenization aren&#8217;t variations of the same idea; they&#8217;re answers to different questions.</p><p>Hash when you need to verify. Encrypt when you need to retrieve. Tokenize when you need to contain.</p><p>Get the question wrong and the technique doesn&#8217;t fail loudly; it just quietly protects the wrong thing.</p><p>The algorithm is rarely the problem. The choice usually is.</p><div><hr></div><p>&#128075; If you liked this post &#8594; Like + Restack + Share to help others learn system design.</p><div><hr></div><p>Subscribe to get high-signal, clear, and visual system design breakdowns straight to your inbox:</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">&nbsp;</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Sync vs Async Clearly Explained]]></title><description><![CDATA[(5 minutes) | One design choice determines if your system blocks or flows.]]></description><link>https://blog.levelupcoding.com/p/sync-vs-async-communication</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/sync-vs-async-communication</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Sat, 21 Mar 2026 11:54:22 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/b014a247-2f6d-4888-8107-420d83cc2bd5_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Get our 142-page System Design Handbook for FREE on newsletter signup:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2><a href="https://lucode.co/aiven-free-tier-competition-z7nl">The Aiven Free Tier Competition</a></h2><h5>Presented by Aiven</h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kQ9r!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461f1a79-1e1f-4d71-8fe1-0e67252c9561_800x445.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kQ9r!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461f1a79-1e1f-4d71-8fe1-0e67252c9561_800x445.jpeg 424w, https://substackcdn.com/image/fetch/$s_!kQ9r!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461f1a79-1e1f-4d71-8fe1-0e67252c9561_800x445.jpeg 848w, https://substackcdn.com/image/fetch/$s_!kQ9r!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461f1a79-1e1f-4d71-8fe1-0e67252c9561_800x445.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!kQ9r!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461f1a79-1e1f-4d71-8fe1-0e67252c9561_800x445.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kQ9r!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461f1a79-1e1f-4d71-8fe1-0e67252c9561_800x445.jpeg" width="800" height="445" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/461f1a79-1e1f-4d71-8fe1-0e67252c9561_800x445.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:445,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:32141,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.levelupcoding.com/i/189857171?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461f1a79-1e1f-4d71-8fe1-0e67252c9561_800x445.jpeg&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_!kQ9r!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461f1a79-1e1f-4d71-8fe1-0e67252c9561_800x445.jpeg 424w, https://substackcdn.com/image/fetch/$s_!kQ9r!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461f1a79-1e1f-4d71-8fe1-0e67252c9561_800x445.jpeg 848w, https://substackcdn.com/image/fetch/$s_!kQ9r!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461f1a79-1e1f-4d71-8fe1-0e67252c9561_800x445.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!kQ9r!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461f1a79-1e1f-4d71-8fe1-0e67252c9561_800x445.jpeg 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 aria-hidden="true" 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><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 best way to learn is by doing. Build with <strong><a href="https://lucode.co/aiven-free-tier-competition-z7nl">Aiven&#8217;s</a></strong> free tier services like Kafka and PostgreSQL. No credit cards, no expiring trials, just real, managed instances to help you get your project off the ground. Build, share, and win $1,000!</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://lucode.co/aiven-free-tier-competition-z7nl&quot;,&quot;text&quot;:&quot;Start building&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://lucode.co/aiven-free-tier-competition-z7nl"><span>Start building</span></a></p><div><hr></div><h1>Synchronous vs Asynchronous Communication</h1><p>Why does placing an order feel instant in one product and slow in another?</p><p>The difference is often invisible to users but fundamental to the system.</p><p>It comes down to how much of the checkout flow runs <strong>synchronously</strong>, waiting for every dependency to confirm success, versus how much runs <strong>asynchronously</strong>, allowing non-critical work to complete after the order is accepted.</p><h2>The only difference that matters: do you wait?</h2><p>Imagine clicking <strong>&#8220;Purchase&#8221;.</strong></p><p>Behind that button, the system fans out to payments, inventory, shipping, email, analytics, and fraud checks.</p><p>In a <strong>synchronous</strong> design, the checkout flow waits.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PphT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4616ce36-3985-4030-8397-c0c9558189d9_2000x1154.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PphT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4616ce36-3985-4030-8397-c0c9558189d9_2000x1154.png 424w, https://substackcdn.com/image/fetch/$s_!PphT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4616ce36-3985-4030-8397-c0c9558189d9_2000x1154.png 848w, https://substackcdn.com/image/fetch/$s_!PphT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4616ce36-3985-4030-8397-c0c9558189d9_2000x1154.png 1272w, https://substackcdn.com/image/fetch/$s_!PphT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4616ce36-3985-4030-8397-c0c9558189d9_2000x1154.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PphT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4616ce36-3985-4030-8397-c0c9558189d9_2000x1154.png" width="1456" height="840" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4616ce36-3985-4030-8397-c0c9558189d9_2000x1154.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:840,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:518195,&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://blog.levelupcoding.com/i/189858660?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4616ce36-3985-4030-8397-c0c9558189d9_2000x1154.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_!PphT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4616ce36-3985-4030-8397-c0c9558189d9_2000x1154.png 424w, https://substackcdn.com/image/fetch/$s_!PphT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4616ce36-3985-4030-8397-c0c9558189d9_2000x1154.png 848w, https://substackcdn.com/image/fetch/$s_!PphT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4616ce36-3985-4030-8397-c0c9558189d9_2000x1154.png 1272w, https://substackcdn.com/image/fetch/$s_!PphT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4616ce36-3985-4030-8397-c0c9558189d9_2000x1154.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 aria-hidden="true" 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><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 order service calls each dependency and blocks until every one responds. If payment is slow or the email service hiccups, the user stares at a spinner. Nothing moves forward until the last response comes back.</p><p>In an <strong>asynchronous</strong> design, the order is accepted first.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ogMC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb844c35b-004d-43f9-9eff-6121c636ab1f_2000x1200.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ogMC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb844c35b-004d-43f9-9eff-6121c636ab1f_2000x1200.png 424w, https://substackcdn.com/image/fetch/$s_!ogMC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb844c35b-004d-43f9-9eff-6121c636ab1f_2000x1200.png 848w, https://substackcdn.com/image/fetch/$s_!ogMC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb844c35b-004d-43f9-9eff-6121c636ab1f_2000x1200.png 1272w, https://substackcdn.com/image/fetch/$s_!ogMC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb844c35b-004d-43f9-9eff-6121c636ab1f_2000x1200.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ogMC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb844c35b-004d-43f9-9eff-6121c636ab1f_2000x1200.png" width="1456" height="874" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b844c35b-004d-43f9-9eff-6121c636ab1f_2000x1200.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:874,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:515633,&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://blog.levelupcoding.com/i/189858660?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb844c35b-004d-43f9-9eff-6121c636ab1f_2000x1200.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_!ogMC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb844c35b-004d-43f9-9eff-6121c636ab1f_2000x1200.png 424w, https://substackcdn.com/image/fetch/$s_!ogMC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb844c35b-004d-43f9-9eff-6121c636ab1f_2000x1200.png 848w, https://substackcdn.com/image/fetch/$s_!ogMC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb844c35b-004d-43f9-9eff-6121c636ab1f_2000x1200.png 1272w, https://substackcdn.com/image/fetch/$s_!ogMC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb844c35b-004d-43f9-9eff-6121c636ab1f_2000x1200.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 aria-hidden="true" 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><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 records the order, responds to the user, and emits messages for the rest of the work. Payment confirmation, receipts, analytics, and fulfillment happen independently, often through a queue or event bus, without holding the checkout flow hostage.</p><p>That&#8217;s the real distinction.</p><p>Synchronous communication means sending a request and <strong>waiting</strong> for a reply before continuing.</p><p>Asynchronous communication means sending a message and <strong>moving on</strong>, trusting the system to finish the work later.</p><h2>Synchronous communication: wait for the response</h2><p>Synchronous calls feel clean because the control flow stays linear:</p><ul><li><p><strong>Inline response</strong> &#8594; you get a result (or error) right away, in the same execution path.</p></li><li><p><strong>Known outcome on return</strong> &#8594; the caller knows whether it succeeded as soon as the call finishes.</p></li><li><p><strong>User-facing fit</strong> &#8594; logins, reads, validations, and short operations match the &#8220;user is waiting&#8221; model.</p></li></ul><p>But synchronous has <strong>temporal coupling</strong> (dependency on being up <em>at the same time</em>). If the downstream service slows down or fails, the caller waits, times out, or fails too; often turning one slow component into a platform-wide incident.</p><p>It also stacks latency. A single call can be fast, but a <em>chain</em> of calls is serial: A waits for B, then B waits for C, and the user waits for all of it. Under load, threads pile up waiting and throughput collapses.</p><h3>When not to use synchronous communication</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!almE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59f4cb03-6dfd-4902-91f5-20e0a4593ffa_2001x730.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!almE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59f4cb03-6dfd-4902-91f5-20e0a4593ffa_2001x730.png 424w, https://substackcdn.com/image/fetch/$s_!almE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59f4cb03-6dfd-4902-91f5-20e0a4593ffa_2001x730.png 848w, https://substackcdn.com/image/fetch/$s_!almE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59f4cb03-6dfd-4902-91f5-20e0a4593ffa_2001x730.png 1272w, https://substackcdn.com/image/fetch/$s_!almE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59f4cb03-6dfd-4902-91f5-20e0a4593ffa_2001x730.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!almE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59f4cb03-6dfd-4902-91f5-20e0a4593ffa_2001x730.png" width="1456" height="531" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/59f4cb03-6dfd-4902-91f5-20e0a4593ffa_2001x730.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:531,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:391508,&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://blog.levelupcoding.com/i/189858660?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59f4cb03-6dfd-4902-91f5-20e0a4593ffa_2001x730.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_!almE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59f4cb03-6dfd-4902-91f5-20e0a4593ffa_2001x730.png 424w, https://substackcdn.com/image/fetch/$s_!almE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59f4cb03-6dfd-4902-91f5-20e0a4593ffa_2001x730.png 848w, https://substackcdn.com/image/fetch/$s_!almE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59f4cb03-6dfd-4902-91f5-20e0a4593ffa_2001x730.png 1272w, https://substackcdn.com/image/fetch/$s_!almE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59f4cb03-6dfd-4902-91f5-20e0a4593ffa_2001x730.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 aria-hidden="true" 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><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><h2>Asynchronous communication: send and continue</h2><p>Asynchronous systems usually introduce a <strong>message broker</strong> (a system that stores and routes messages) and communicate via <strong>queues</strong> or <strong>topics</strong>. Producers publish; consumers process when they can.</p><p>This changes the system&#8217;s structure:</p><ul><li><p><strong>Decoupling &amp; resilience</strong> &#8594; messages can wait when a consumer is slow or offline, reducing cascading failures.</p></li><li><p><strong>Throughput &amp; scalability </strong>&#8594; producers don&#8217;t block, and you can scale consumers horizontally to chew through backlog.</p></li><li><p><strong>Fan-out by default</strong> &#8594; one &#8220;order placed&#8221; event can trigger email, analytics, fraud checks, and inventory updates without the producer calling each service directly.</p></li></ul><p>The trade is <strong>eventual consistency</strong>: the system acknowledges the request now, but the final outcome happens later. How long it takes depends on how many messages are waiting and how fast consumers process them.</p><p>Async also raises the engineering bar:</p><ul><li><p><strong>More moving parts</strong> &#8594; brokers, persistence, acknowledgements, retries.</p></li><li><p><strong>Idempotency required </strong>&#8594; consumers must safely handle duplicates (idempotent means &#8220;running it twice produces the same effect as once&#8221;).</p></li><li><p><strong>Harder failure handling </strong>&#8594; errors may surface later, sometimes via a <strong>dead-letter queue</strong> (messages that repeatedly fail and need inspection).</p></li></ul><h3>When not to use asynchronous communication</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!MLDF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13dcb55-6dbe-4716-95c3-05f777f6eda1_2001x729.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MLDF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13dcb55-6dbe-4716-95c3-05f777f6eda1_2001x729.png 424w, https://substackcdn.com/image/fetch/$s_!MLDF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13dcb55-6dbe-4716-95c3-05f777f6eda1_2001x729.png 848w, https://substackcdn.com/image/fetch/$s_!MLDF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13dcb55-6dbe-4716-95c3-05f777f6eda1_2001x729.png 1272w, https://substackcdn.com/image/fetch/$s_!MLDF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13dcb55-6dbe-4716-95c3-05f777f6eda1_2001x729.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MLDF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13dcb55-6dbe-4716-95c3-05f777f6eda1_2001x729.png" width="1456" height="530" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d13dcb55-6dbe-4716-95c3-05f777f6eda1_2001x729.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:530,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:391077,&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://blog.levelupcoding.com/i/189858660?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13dcb55-6dbe-4716-95c3-05f777f6eda1_2001x729.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_!MLDF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13dcb55-6dbe-4716-95c3-05f777f6eda1_2001x729.png 424w, https://substackcdn.com/image/fetch/$s_!MLDF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13dcb55-6dbe-4716-95c3-05f777f6eda1_2001x729.png 848w, https://substackcdn.com/image/fetch/$s_!MLDF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13dcb55-6dbe-4716-95c3-05f777f6eda1_2001x729.png 1272w, https://substackcdn.com/image/fetch/$s_!MLDF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13dcb55-6dbe-4716-95c3-05f777f6eda1_2001x729.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 aria-hidden="true" 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><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><h2>How to choose in practice</h2><p>Most real systems don&#8217;t pick one style.</p><p>They <strong>place synchronous and asynchronous communication deliberately</strong>.</p><p>Use <strong>synchronous communication</strong> when the system cannot move forward without a definitive answer.</p><p>This includes login checks, payment authorization, inventory validation, and critical reads. In these cases, waiting is the point because correctness matters more than throughput. Failures should surface immediately and stop the flow.</p><p>Use <strong>asynchronous communication</strong> when the work does not need to block the user.</p><p>Long-running tasks, bursty workloads, and fan-out behavior belong here. Queuing the work keeps the system responsive and prevents one slow dependency from stalling everything else.</p><p>This is how systems gain autonomy and absorb partial failure.</p><p>Most mature architectures follow a simple pattern:</p><ul><li><p><strong>Sync at the edge</strong> &#8594; confirm the user&#8217;s action quickly and clearly.</p></li><li><p><strong>Async behind the edge</strong> &#8594; process side effects like notifications, analytics, and downstream updates without holding the request open.</p></li></ul><p>That split keeps the user experience fast while letting the system scale and recover under load.</p><p>One important caveat: <strong>&#8220;async code&#8221; is not the same as asynchronous communication</strong>.</p><p>If a service must wait for a response before it can proceed, the interaction is still synchronous at the architecture level; even if it uses promises, callbacks, or non-blocking I/O.</p><h2>Wrapping up</h2><p>Go back to the moment the user clicks <strong>&#8220;Purchase.&#8221;</strong></p><p>Whether that action feels instant or slow is a design choice.</p><p>Payment authorization, inventory checks, and order creation run synchronously because the system needs a definitive answer.</p><p>Waiting there is intentional. That&#8217;s the critical path.</p><p>Everything else (emails, analytics, fraud checks, fulfillment) doesn&#8217;t need to block the user. Those steps run asynchronously so the order can complete even when downstream systems are slow or unavailable.</p><p>That&#8217;s the real trade-off.</p><p>Synchronous communication gives you immediate certainty but shared failure. Asynchronous communication gives you resilience and throughput by letting work finish later.</p><p>Well-designed systems use both.</p><p>If a user flow feels slow, the fix isn&#8217;t always faster processing.</p><p>Often, it&#8217;s deciding what truly needs an answer now; and what can wait.</p><div><hr></div><p>&#128075; If you liked this post &#8594; Like + Restack + Share to help others learn system design.</p><div><hr></div><p>Subscribe to get high-signal, clear, and visual system design breakdowns straight to your inbox:</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">&nbsp;</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Why “Hash the Password” Isn’t Enough]]></title><description><![CDATA[(5 minutes) | How salts, key stretching, and memory-hard algorithms stop brute-force attacks.]]></description><link>https://blog.levelupcoding.com/p/how-databases-keep-passwords-safe</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/how-databases-keep-passwords-safe</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Mon, 16 Mar 2026 11:24:23 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/79417bff-5a3d-4ca9-a83f-2bee7dc5b330_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Get our 142-page System Design Handbook for FREE on newsletter signup:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2><a href="https://lucode.co/agent-memory-article-oracle-z7nl">Why Your AI Agent Has Amnesia</a></h2><h5>Presented by Oracle</h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lXae!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5059d33c-0c70-4911-8ebc-932b0c191a97_1354x826.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lXae!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5059d33c-0c70-4911-8ebc-932b0c191a97_1354x826.png 424w, https://substackcdn.com/image/fetch/$s_!lXae!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5059d33c-0c70-4911-8ebc-932b0c191a97_1354x826.png 848w, https://substackcdn.com/image/fetch/$s_!lXae!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5059d33c-0c70-4911-8ebc-932b0c191a97_1354x826.png 1272w, https://substackcdn.com/image/fetch/$s_!lXae!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5059d33c-0c70-4911-8ebc-932b0c191a97_1354x826.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!lXae!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5059d33c-0c70-4911-8ebc-932b0c191a97_1354x826.png" width="1354" height="826" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5059d33c-0c70-4911-8ebc-932b0c191a97_1354x826.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:826,&quot;width&quot;:1354,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:143183,&quot;alt&quot;:&quot;&quot;,&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://blog.levelupcoding.com/i/190397808?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5059d33c-0c70-4911-8ebc-932b0c191a97_1354x826.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_!lXae!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5059d33c-0c70-4911-8ebc-932b0c191a97_1354x826.png 424w, https://substackcdn.com/image/fetch/$s_!lXae!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5059d33c-0c70-4911-8ebc-932b0c191a97_1354x826.png 848w, https://substackcdn.com/image/fetch/$s_!lXae!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5059d33c-0c70-4911-8ebc-932b0c191a97_1354x826.png 1272w, https://substackcdn.com/image/fetch/$s_!lXae!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5059d33c-0c70-4911-8ebc-932b0c191a97_1354x826.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 aria-hidden="true" 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><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>Many AI agents struggle with memory. They lose context, forget prior steps, and produce inconsistent outputs across sessions. <strong><a href="https://lucode.co/agent-memory-article-oracle-z7nl">This guide</a></strong> explores why it happens and how to fix it using agent memory patterns. A great read!</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://lucode.co/agent-memory-article-oracle-z7nl&quot;,&quot;text&quot;:&quot;Read the article&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://lucode.co/agent-memory-article-oracle-z7nl"><span>Read the article</span></a></p><div><hr></div><h1>How Databases Keep Passwords Safe</h1><p>&#8220;Hash it and you&#8217;re done&#8221; isn&#8217;t a strategy. It&#8217;s how breaches turn into headlines.</p><p>Every system is one misconfiguration, forgotten backup, or zero-day exploit away from a database leak.</p><p>When that happens, the only thing standing between you and a wave of account takeovers is how those passwords were stored.</p><p>Password security isn&#8217;t about keeping data secret; it&#8217;s about making stolen data useless.</p><p>That&#8217;s why modern storage relies on one-way hashing, unique salts, and slow, memory-hard algorithms that make every brute-force attempt painfully expensive.</p><p>Real security doesn&#8217;t assume safety, it assumes compromise and plans for it.</p><h2>How secure storage works</h2><p>When a database breach happens, it&#8217;s already too late to protect the data itself.</p><p>What still matters is <strong>how much that data can be used against you</strong>.</p><p>If your system stores plaintext passwords, attackers can log in immediately. Even &#8220;hashed&#8221; passwords aren&#8217;t safe if you used fast, general-purpose algorithms like MD5 or SHA-1.</p><p>GPUs can brute-force at billions of guesses per second.</p><p>To prevent that, password storage must <strong>slow attackers down</strong>.</p><p>Modern password storage relies on <strong>layered defenses</strong>. Each step (hashing, salting, stretching, and sometimes peppering) closes a different gap that attackers exploit.</p><ul><li><p><strong>Hashing</strong> &#8594; Converts a password into a one-way digest that can&#8217;t be reversed. The server never stores the password itself, only its hash.</p><ul><li><p>Use password-specific algorithms like <strong>bcrypt</strong>, <strong>scrypt</strong>, or <strong>Argon2id</strong>, not general-purpose hashes like SHA-256. Fast hashes are designed for data integrity, not for resisting brute force. A proper password KDF (Key Derivation Function) intentionally slows verification to make offline guessing expensive.</p></li></ul></li><li><p><strong>Salting</strong> &#8594; Adds a random, per-user value to each password before hashing.</p><ul><li><p>Salts ensure that identical passwords never produce the same hash and stop <strong>rainbow table</strong> lookups. They don&#8217;t need to be secret, but they must be <strong>unique and unpredictable</strong> (16 bytes or more).</p></li></ul></li><li><p><strong>Key stretching</strong> &#8594; Increases the cost of each hash operation through extra iterations or memory hardness.</p><ul><li><p>This throttles brute-force attacks: where a fast hash might take microseconds, a stretched one takes hundreds of milliseconds. On your servers, that&#8217;s manageable. For an attacker, multiplied by millions of guesses, it&#8217;s economically pointless.</p></li></ul></li><li><p><strong>Peppering (optional)</strong> &#8594; Adds a server-side secret, stored outside the database (like in an HSM or key vault).</p><ul><li><p>Even if the database leaks, the attacker can&#8217;t verify guesses without the pepper. It strengthens security but complicates rotation; use it only if your infrastructure can protect and rotate secrets safely.</p></li></ul></li></ul><p>The goal isn&#8217;t to make passwords uncrackable, but to make cracking <strong>so slow and individualized</strong> that attackers move on long before they succeed.</p><h2>How passwords are stored and verified</h2><p>When a user creates an account or logs in later, the system never handles their password in plain text.</p><p>Both flows (signup and login) rely on the same hashing process but apply it at different points.</p><h3>1. Signup &#8594; Creating and storing the hash</h3><p>When a user signs up or resets their password, the system never stores the password itself. Instead, it transforms it into a secure representation:</p><ol><li><p><strong>Generate a salt</strong> &#8594; Create a random, unique salt for this user (usually 16 bytes or more).</p></li><li><p><strong>Hash the password</strong> &#8594; Run the password and salt through a <strong>password hashing function</strong> such as Argon2id, bcrypt, or scrypt. The function also takes cost parameters (iterations, memory, or parallelism) that control how slow the process is.</p></li><li><p><strong>Store the result</strong> &#8594; Save the resulting hash, along with the salt and parameters, in the database.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!beBt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45033b17-a125-452b-b970-77e2e74e9ab8_2000x1000.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!beBt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45033b17-a125-452b-b970-77e2e74e9ab8_2000x1000.png 424w, https://substackcdn.com/image/fetch/$s_!beBt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45033b17-a125-452b-b970-77e2e74e9ab8_2000x1000.png 848w, https://substackcdn.com/image/fetch/$s_!beBt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45033b17-a125-452b-b970-77e2e74e9ab8_2000x1000.png 1272w, https://substackcdn.com/image/fetch/$s_!beBt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45033b17-a125-452b-b970-77e2e74e9ab8_2000x1000.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!beBt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45033b17-a125-452b-b970-77e2e74e9ab8_2000x1000.png" width="1456" height="728" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/45033b17-a125-452b-b970-77e2e74e9ab8_2000x1000.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;:424376,&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://blog.levelupcoding.com/i/189851964?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45033b17-a125-452b-b970-77e2e74e9ab8_2000x1000.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_!beBt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45033b17-a125-452b-b970-77e2e74e9ab8_2000x1000.png 424w, https://substackcdn.com/image/fetch/$s_!beBt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45033b17-a125-452b-b970-77e2e74e9ab8_2000x1000.png 848w, https://substackcdn.com/image/fetch/$s_!beBt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45033b17-a125-452b-b970-77e2e74e9ab8_2000x1000.png 1272w, https://substackcdn.com/image/fetch/$s_!beBt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45033b17-a125-452b-b970-77e2e74e9ab8_2000x1000.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 aria-hidden="true" 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><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></ol><p>The original password is discarded immediately. Only the salted hash and configuration is stored.</p><h3>2. Login &#8594; Verifying the password</h3><p>When the user logs in later, the system must check the password without knowing the original one:</p><ol><li><p><strong>Retrieve stored values</strong> &#8594; Fetch the user&#8217;s stored hash, salt, and parameters.</p></li><li><p><strong>Re-hash the input</strong> &#8594; Run the entered password through the same function using the retrieved salt and parameters.</p></li><li><p><strong>Compare securely</strong> &#8594; Use a <strong>constant-time comparison</strong> to check whether the new hash matches the stored one. Unlike normal string checks that exit early on mismatches, constant-time comparisons take the <strong>same amount of time</strong> no matter how similar the inputs are. This prevents timing attacks, where an attacker measures tiny response-time differences to guess parts of the correct hash one byte at a time.</p></li><li><p><strong>Rehash if needed</strong> &#8594; If parameters are outdated (for example, fewer iterations, lower memory, or an outdated algorithm), re-hash and update the stored entry after a successful login.</p></li><li><p><strong>Authorize access</strong> &#8594; If hashes match, issue a session token or JWT for the user.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ACWt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb20f92cd-f211-470a-879c-4ce84cda0a46_2000x1000.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ACWt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb20f92cd-f211-470a-879c-4ce84cda0a46_2000x1000.png 424w, https://substackcdn.com/image/fetch/$s_!ACWt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb20f92cd-f211-470a-879c-4ce84cda0a46_2000x1000.png 848w, https://substackcdn.com/image/fetch/$s_!ACWt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb20f92cd-f211-470a-879c-4ce84cda0a46_2000x1000.png 1272w, https://substackcdn.com/image/fetch/$s_!ACWt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb20f92cd-f211-470a-879c-4ce84cda0a46_2000x1000.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ACWt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb20f92cd-f211-470a-879c-4ce84cda0a46_2000x1000.png" width="1456" height="728" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b20f92cd-f211-470a-879c-4ce84cda0a46_2000x1000.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;:434299,&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://blog.levelupcoding.com/i/189851964?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb20f92cd-f211-470a-879c-4ce84cda0a46_2000x1000.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_!ACWt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb20f92cd-f211-470a-879c-4ce84cda0a46_2000x1000.png 424w, https://substackcdn.com/image/fetch/$s_!ACWt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb20f92cd-f211-470a-879c-4ce84cda0a46_2000x1000.png 848w, https://substackcdn.com/image/fetch/$s_!ACWt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb20f92cd-f211-470a-879c-4ce84cda0a46_2000x1000.png 1272w, https://substackcdn.com/image/fetch/$s_!ACWt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb20f92cd-f211-470a-879c-4ce84cda0a46_2000x1000.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 aria-hidden="true" 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><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></ol><p>At no point does the system store, transmit, or recover the plaintext password. The entire process proves identity by <em>reproducing</em> the same one-way result, not by revealing the secret itself.</p><h2>What not to do</h2><p>Most password breaches don&#8217;t happen because teams ignored security, they happen because they trusted weak defaults or outdated practices.</p><p>Here&#8217;s what to avoid if you want your password storage to hold up under real attacks.</p><ul><li><p><strong>Store plaintext passwords</strong> &#8594; The worst-case scenario. A single database dump means instant access to every account. There&#8217;s no recovery from this.</p></li><li><p><strong>Use general-purpose hashes (MD5, SHA-1, SHA-256)</strong> &#8594; These functions are designed for speed, not security. They are trivial to brute-force at scale with modern GPUs and ASICs.</p></li><li><p><strong>Skip or reuse salts</strong> &#8594; Without a unique, random salt per password, identical passwords produce identical hashes, enabling rainbow table attacks and cross-user correlation.</p></li><li><p><strong>Set low cost factors</strong> &#8594; bcrypt cost=8 or PBKDF2 with a few thousand iterations might have been fine a decade ago. Today, it&#8217;s too cheap to crack. Always tune cost to current hardware performance.</p></li><li><p><strong>Roll out your own algorithm</strong> &#8594; Security through creativity is not security. Established KDFs like Argon2id, bcrypt, or scrypt have been battle-tested and peer-reviewed; your custom hashing function has not.</p></li><li><p><strong>Forget edge behaviors</strong> &#8594; Logging plaintext passwords during debugging or including them in error traces can silently undo all your protections.</p></li><li><p><strong>Expose hints or partial passwords</strong> &#8594; Anything that helps an attacker narrow the search space reduces the work of cracking. Even &#8220;helpful&#8221; password hints expose predictable details.</p></li></ul><h2>Recap</h2><p>Good password storage doesn&#8217;t depend on secrecy; it depends on math, cost, and discipline.</p><p>Hashing, salting, stretching, and (optionally) peppering turn every password into a unique, expensive problem for attackers to solve.</p><p>The goal isn&#8217;t to make breaches impossible, but to make them irrelevant by ensuring stolen data is useless.</p><p>Use proven KDFs like Argon2id or bcrypt, tune them regularly, and avoid shortcuts that trade speed for safety.</p><p>When done right, a database leak becomes an inconvenience; not a disaster.</p><div><hr></div><p>&#128075; If you liked this post &#8594; Like + Restack + Share to help others learn system design.</p><div><hr></div><p>Subscribe to get high-signal, clear, and visual system design breakdowns straight to your inbox:</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">&nbsp;</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[CAP Theorem Clearly Explained]]></title><description><![CDATA[(4 minutes) | Choosing your failure mode, avoiding common mistakes, and a decision checklist.]]></description><link>https://blog.levelupcoding.com/p/cap-theorem-explained</link><guid isPermaLink="false">https://blog.levelupcoding.com/p/cap-theorem-explained</guid><dc:creator><![CDATA[Nikki Siapno]]></dc:creator><pubDate>Fri, 13 Mar 2026 12:40:09 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/68504485-766b-458a-aedd-fa61bd08cf97_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yLV0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yLV0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png" width="1292" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:1292,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:343451,&quot;alt&quot;:&quot;&quot;,&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://lvlupcoding.substack.com/i/171357839?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.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_!yLV0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 424w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 848w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1272w, https://substackcdn.com/image/fetch/$s_!yLV0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa58aa08-bd21-454c-9e82-1d7ba2fedfaa_1292x266.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Get our 142-page System Design Handbook for FREE on newsletter signup:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2><a href="https://lucode.co/mongodb-ai-learning-hub-z7nl">Build AI Apps with MongoDB</a></h2><h5>Presented by MongoDB</h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Hlpw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Hlpw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png 424w, https://substackcdn.com/image/fetch/$s_!Hlpw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png 848w, https://substackcdn.com/image/fetch/$s_!Hlpw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png 1272w, https://substackcdn.com/image/fetch/$s_!Hlpw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Hlpw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png" width="1456" height="562" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:562,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:199786,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:&quot;&quot;,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.levelupcoding.com/i/182433036?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.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_!Hlpw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png 424w, https://substackcdn.com/image/fetch/$s_!Hlpw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png 848w, https://substackcdn.com/image/fetch/$s_!Hlpw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.png 1272w, https://substackcdn.com/image/fetch/$s_!Hlpw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ead0bb5-d130-4f46-889e-49f40dbb4390_2900x1120.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 aria-hidden="true" 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><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>Looking to stay ahead of the curve on AI? <a href="https://lucode.co/mongodb-ai-learning-hub-z7nl">MongoDB AI Learning Hub</a> has the technical training pathways and tools you need to level up your AI app-building game. Explore practical guides, tutorials, and quick starts for all skill levels, from foundational concepts like understanding AI tool stacks to advanced implementations using RAG, MongoDB Vector Search, and LLM optimization.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://lucode.co/mongodb-ai-learning-hub-z7nl&quot;,&quot;text&quot;:&quot;Check it out (it's free)&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://lucode.co/mongodb-ai-learning-hub-z7nl"><span>Check it out (it's free)</span></a></p><div><hr></div><h1>CAP Theorem Clearly Explained</h1><p>&#8220;Make it consistent, highly available, and fault-tolerant&#8221; sounds like a reasonable requirement.</p><p>It isn&#8217;t.</p><p>In any distributed system, a network failure forces a choice that no amount of engineering can avoid: either your nodes agree on the truth and some requests fail, or every request gets an answer and some of those answers are wrong.</p><p>Both are valid designs, and CAP Theorem is the lens that makes that tradeoff explicit so you choose deliberately instead of by accident.</p><h2>What is CAP Theorem?</h2><p>CAP Theorem states that a distributed data store cannot simultaneously guarantee all three of the following properties at the same time:</p><ul><li><p><strong>Consistency (C)</strong> &#8594; Every read returns the most recent write, or an error; never stale data.</p></li><li><p><strong>Availability (A)</strong> &#8594; Every request receives a response, even if some nodes are out of date.</p></li><li><p><strong>Partition Tolerance (P)</strong> &#8594; The system keeps operating despite network failures that split nodes into isolated groups.</p></li></ul><p>The common summary is &#8220;pick two of three.&#8221;</p><p>It&#8217;s catchy, but misleading.</p><p>CAP is not about permanently giving something up. It&#8217;s about what happens when the network splits.</p><p>A clearer way to look at it: when a partition occurs, you must choose between consistency (all nodes agree on the same data) and availability (every request receives a response).</p><p>During normal operation, when nodes can communicate reliably, you can have both.</p><p>The tradeoff only appears the moment the network breaks.</p><h2>CP vs AP: two different failure philosophies</h2><p>Systems that lean toward <strong>Consistency + Partition Tolerance (CP)</strong> will refuse or delay operations when they can&#8217;t guarantee a single, up-to-date view of the data. They&#8217;d rather return an error than return something wrong.</p><p>Systems that lean toward <strong>Availability + Partition Tolerance (AP)</strong> will keep serving requests even when nodes disagree, accepting that some responses may be stale. They&#8217;d rather serve something than serve nothing.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8zE9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a533819-34ee-4e6e-a827-5955d6431b26_2000x1062.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8zE9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a533819-34ee-4e6e-a827-5955d6431b26_2000x1062.png 424w, https://substackcdn.com/image/fetch/$s_!8zE9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a533819-34ee-4e6e-a827-5955d6431b26_2000x1062.png 848w, https://substackcdn.com/image/fetch/$s_!8zE9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a533819-34ee-4e6e-a827-5955d6431b26_2000x1062.png 1272w, https://substackcdn.com/image/fetch/$s_!8zE9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a533819-34ee-4e6e-a827-5955d6431b26_2000x1062.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8zE9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a533819-34ee-4e6e-a827-5955d6431b26_2000x1062.png" width="1456" height="773" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5a533819-34ee-4e6e-a827-5955d6431b26_2000x1062.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:773,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:449451,&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://blog.levelupcoding.com/i/189734261?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a533819-34ee-4e6e-a827-5955d6431b26_2000x1062.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_!8zE9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a533819-34ee-4e6e-a827-5955d6431b26_2000x1062.png 424w, https://substackcdn.com/image/fetch/$s_!8zE9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a533819-34ee-4e6e-a827-5955d6431b26_2000x1062.png 848w, https://substackcdn.com/image/fetch/$s_!8zE9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a533819-34ee-4e6e-a827-5955d6431b26_2000x1062.png 1272w, https://substackcdn.com/image/fetch/$s_!8zE9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a533819-34ee-4e6e-a827-5955d6431b26_2000x1062.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 aria-hidden="true" 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><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><h2>How a partition actually plays out</h2><p>A partition occurs when there&#8217;s a network split and nodes can&#8217;t reliably talk to each other.</p><p>Imagine a five-node cluster. A network failure divides it into two groups: three nodes on one side, two on the other.</p><h3>CP behavior</h3><p>CP systems preserve a single source of truth by refusing to make progress without enough agreement.</p><ul><li><p><strong>Quorums/consensus</strong> &#8594; Writes (and sometimes reads) require enough nodes to agree.</p></li><li><p><strong>Leader-based replication</strong> &#8594; Only one leader can accept writes; the other side of a split becomes read-only or errors out.</p></li><li><p><strong>User experience</strong> &#8594; Some users see failures/timeouts, but you avoid split-brain state.</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_!qiCU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21597c19-dfc3-4b7a-813b-cf119595702c_2000x1042.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qiCU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21597c19-dfc3-4b7a-813b-cf119595702c_2000x1042.png 424w, https://substackcdn.com/image/fetch/$s_!qiCU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21597c19-dfc3-4b7a-813b-cf119595702c_2000x1042.png 848w, https://substackcdn.com/image/fetch/$s_!qiCU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21597c19-dfc3-4b7a-813b-cf119595702c_2000x1042.png 1272w, https://substackcdn.com/image/fetch/$s_!qiCU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21597c19-dfc3-4b7a-813b-cf119595702c_2000x1042.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qiCU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21597c19-dfc3-4b7a-813b-cf119595702c_2000x1042.png" width="1456" height="759" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/21597c19-dfc3-4b7a-813b-cf119595702c_2000x1042.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:759,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:665722,&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://blog.levelupcoding.com/i/189734261?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21597c19-dfc3-4b7a-813b-cf119595702c_2000x1042.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_!qiCU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21597c19-dfc3-4b7a-813b-cf119595702c_2000x1042.png 424w, https://substackcdn.com/image/fetch/$s_!qiCU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21597c19-dfc3-4b7a-813b-cf119595702c_2000x1042.png 848w, https://substackcdn.com/image/fetch/$s_!qiCU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21597c19-dfc3-4b7a-813b-cf119595702c_2000x1042.png 1272w, https://substackcdn.com/image/fetch/$s_!qiCU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21597c19-dfc3-4b7a-813b-cf119595702c_2000x1042.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 aria-hidden="true" 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><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 three-node side has a majority, so it continues processing requests.</p><p>The two-node side does not, so it stops accepting writes. It may become read-only or fully unavailable.</p><p>When the network heals, the minority side syncs from the majority. There is no data conflict because only one side was allowed to move forward.</p><p>The result is clean, but some users saw errors or timeouts during the split.</p><h3>AP behavior</h3><p>An AP system keeps accepting operations on each side of the partition and repairs the mismatch later.</p><ul><li><p><strong>Eventual consistency</strong> &#8594; Replicas converge after communication returns.</p></li><li><p><strong>Conflict resolution</strong> &#8594; You need a resolution plan: last-write-wins, merge, keep multiple versions, or domain-specific reconciliation.</p></li><li><p><strong>User experience</strong> &#8594; The system stays up, but different users may see different answers temporarily.</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_!9LE4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36acfe99-9a6d-49ef-8d55-47c066135952_2000x1054.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9LE4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36acfe99-9a6d-49ef-8d55-47c066135952_2000x1054.png 424w, https://substackcdn.com/image/fetch/$s_!9LE4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36acfe99-9a6d-49ef-8d55-47c066135952_2000x1054.png 848w, https://substackcdn.com/image/fetch/$s_!9LE4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36acfe99-9a6d-49ef-8d55-47c066135952_2000x1054.png 1272w, https://substackcdn.com/image/fetch/$s_!9LE4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36acfe99-9a6d-49ef-8d55-47c066135952_2000x1054.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9LE4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36acfe99-9a6d-49ef-8d55-47c066135952_2000x1054.png" width="1456" height="767" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/36acfe99-9a6d-49ef-8d55-47c066135952_2000x1054.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:767,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:678477,&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://blog.levelupcoding.com/i/189734261?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36acfe99-9a6d-49ef-8d55-47c066135952_2000x1054.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_!9LE4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36acfe99-9a6d-49ef-8d55-47c066135952_2000x1054.png 424w, https://substackcdn.com/image/fetch/$s_!9LE4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36acfe99-9a6d-49ef-8d55-47c066135952_2000x1054.png 848w, https://substackcdn.com/image/fetch/$s_!9LE4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36acfe99-9a6d-49ef-8d55-47c066135952_2000x1054.png 1272w, https://substackcdn.com/image/fetch/$s_!9LE4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36acfe99-9a6d-49ef-8d55-47c066135952_2000x1054.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 aria-hidden="true" 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><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 side believes it has the latest state. When the network reconnects, the system detects divergent updates; for example, two users modifying the same record on different sides.</p><p>Now reconciliation begins.</p><p>The database applies a conflict strategy such as last-write-wins. The service stayed available, but some data required conflict resolution.</p><p>Neither outcome is a bug. Both are deliberate design decisions baked into the system you chose.</p><h2>Common mistakes that cause outages</h2><p>Most confusion around CAP doesn&#8217;t come from the theorem itself.</p><p>It comes from how we simplify it.</p><p>Here are the mistakes that cause the most architectural regret.</p><ul><li><p><strong>Treating CAP as a permanent label</strong> &#8594; A system is not &#8220;CP&#8221; or &#8220;AP&#8221; as a fixed identity. During normal operation, well-designed systems provide both consistency and availability because the network is healthy.</p></li><li><p><strong>Assuming partition tolerance is optional</strong> &#8594; You cannot avoid partitions by trusting your infrastructure. You can reduce their frequency with better networking, tighter time synchronization, or private backbone links, but you cannot eliminate its possibility entirely.</p></li><li><p><strong>Confusing CAP consistency with ACID consistency</strong> &#8594; These are different guarantees. ACID consistency means a transaction leaves the database in a valid state according to defined rules. CAP consistency means every read returns the most recent write across nodes.</p></li><li><p><strong>Forgetting to design recovery logic</strong> &#8594; Choosing availability during a partition is only half the decision. &#8220;Eventually consistent&#8221; requires a reconciliation strategy. You must define how conflicts resolve.</p></li></ul><h2>A decision checklist you can actually use</h2><p>Start by asking one question: <strong>what hurts your product more, returning incorrect data, or returning no data at all?</strong></p><ul><li><p><strong>Returning incorrect data hurts more</strong> &#8594; Choose CP.</p><ul><li><p>Common use cases: payments, balances, inventory counts, permissions, leader election</p></li></ul></li><li><p><strong>Returning no data at all hurts more</strong> &#8594; Choose AP.</p><ul><li><p>Common use cases: feeds, analytics views, caches, activity timelines, search indexes</p></li></ul></li></ul><p>Most real systems don&#8217;t pick one globally; they pick per component.</p><p>A common pattern is to have a small CP core for writes that must be correct (orders, balances, permissions), and AP layers that serve and cache data quickly across regions.</p><p>The core enforces truth; the edge keeps the system fast.</p><p>The worst outcome is not choosing consciously. Systems that ignore CAP don&#8217;t escape its constraints; they just encounter them as surprises.</p><h2>Wrapping up</h2><p>Every distributed system has already answered the CAP question, either deliberately or by default.</p><p>The database you picked, the replication strategy you configured, the consistency level you left unchanged: all of it adds up to a position on the spectrum.</p><p>Understanding CAP doesn&#8217;t give you new options. It tells you which option you&#8217;re already on, and whether it&#8217;s the right one.</p><div><hr></div><p>&#128075; If you liked this post &#8594; Like + Restack + Share to help others learn system design.</p><div><hr></div><p>Subscribe to get high-signal, clear, and visual system design breakdowns straight to your inbox:</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.levelupcoding.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">&nbsp;</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item></channel></rss>