<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[System Design Interview Roadmap]]></title><description><![CDATA[System Design Interview Roadmap - Step by step process that will make you comfortable, familiar & then expert. Preparing for a system design interview, probably at a FAANG-tier company, probably at L4–L6. That's exactly who this newsletter.]]></description><link>https://systemdr.systemdrd.com</link><image><url>https://substackcdn.com/image/fetch/$s_!_3Z_!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9fd573e1-44ca-4a06-be42-264560574975_500x500.png</url><title>System Design Interview Roadmap</title><link>https://systemdr.systemdrd.com</link></image><generator>Substack</generator><lastBuildDate>Fri, 30 Oct 2026 07:35:21 GMT</lastBuildDate><atom:link href="https://systemdr.systemdrd.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[SystemDR Inc]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[systemdr@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[systemdr@substack.com]]></itunes:email><itunes:name><![CDATA[System Design Roadmap]]></itunes:name></itunes:owner><itunes:author><![CDATA[System Design Roadmap]]></itunes:author><googleplay:owner><![CDATA[systemdr@substack.com]]></googleplay:owner><googleplay:email><![CDATA[systemdr@substack.com]]></googleplay:email><googleplay:author><![CDATA[System Design Roadmap]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Real-Time Recommendation Engines: The Architecture of TikTok’s “For You” Page]]></title><description><![CDATA[A user opens the app, watches a video for 1.4 seconds, and swipes away.]]></description><link>https://systemdr.systemdrd.com/p/real-time-recommendation-engines</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/real-time-recommendation-engines</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Fri, 30 Oct 2026 03:30:48 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!jBpw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F345aa759-bf0c-438f-b64f-88ec061db4b0_4000x2480.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote><p>A user opens the app, watches a video for 1.4 seconds, and swipes away. That single swipe has to update what they see next &#8212; not in the next session, not in the next hour, in the next scroll. Most recommendation systems built in the 2010s couldn&#8217;t do that. They retrained overnight, served a static ranked list, and called it personalization. TikTok&#8217;s &#8220;For You&#8221; page broke that model by treating every watch, pause, replay, and skip as a live signal that reshapes the next candidate pool within seconds. That&#8217;s the part worth understanding &#8212; not the neural net architecture, which nobody outside the company has verified, but the systems problem of making feedback loops that fast without falling over.</p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jBpw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F345aa759-bf0c-438f-b64f-88ec061db4b0_4000x2480.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jBpw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F345aa759-bf0c-438f-b64f-88ec061db4b0_4000x2480.png 424w, https://substackcdn.com/image/fetch/$s_!jBpw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F345aa759-bf0c-438f-b64f-88ec061db4b0_4000x2480.png 848w, https://substackcdn.com/image/fetch/$s_!jBpw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F345aa759-bf0c-438f-b64f-88ec061db4b0_4000x2480.png 1272w, https://substackcdn.com/image/fetch/$s_!jBpw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F345aa759-bf0c-438f-b64f-88ec061db4b0_4000x2480.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jBpw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F345aa759-bf0c-438f-b64f-88ec061db4b0_4000x2480.png" width="616" height="382.03846153846155" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/345aa759-bf0c-438f-b64f-88ec061db4b0_4000x2480.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:903,&quot;width&quot;:1456,&quot;resizeWidth&quot;:616,&quot;bytes&quot;:2667601,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://systemdr.systemdrd.com/i/220812148?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F345aa759-bf0c-438f-b64f-88ec061db4b0_4000x2480.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_!jBpw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F345aa759-bf0c-438f-b64f-88ec061db4b0_4000x2480.png 424w, https://substackcdn.com/image/fetch/$s_!jBpw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F345aa759-bf0c-438f-b64f-88ec061db4b0_4000x2480.png 848w, https://substackcdn.com/image/fetch/$s_!jBpw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F345aa759-bf0c-438f-b64f-88ec061db4b0_4000x2480.png 1272w, https://substackcdn.com/image/fetch/$s_!jBpw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F345aa759-bf0c-438f-b64f-88ec061db4b0_4000x2480.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><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 Core Problem: Candidate Generation Under a Latency Budget</h2><p>A &#8220;For You&#8221; feed request has roughly 100&#8211;200 milliseconds to go from &#8220;user opened app&#8221; to &#8220;here are 10 ranked videos.&#8221; In that window, the system has to narrow a catalog of hundreds of millions of videos down to a few hundred candidates&#8230;</p>
      <p>
          <a href="https://systemdr.systemdrd.com/p/real-time-recommendation-engines">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Design Tinder Matching — Walkthrough]]></title><description><![CDATA[Archetype: Marketplace & Matching &#183; Asked at: Match Group, Bumble, Hinge]]></description><link>https://systemdr.systemdrd.com/p/design-tinder-matching-walkthrough</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/design-tinder-matching-walkthrough</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Tue, 27 Oct 2026 03:30:45 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Q4r7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b62184c-3e36-4bd4-b4ca-87f323d1f073_4750x4500.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>The probe</h2><blockquote><p>Two-sided marketplace matching with asymmetric information (you don&#8217;t know who liked you until you match). The interesting system design problem is the &#8220;like&#8221; storage &#8212; when user A likes user B, how do you efficiently detect that B has also liked A (a mutual match)?</p></blockquote><h2>Step 1 &#8212; Data Model</h2><p>profiles: user_id, age, gender, location (geohash), photos[], bio, preferences{...} likes: liker_id, liked_id, created_at</p><p>UNIQUE INDEX: (liker_id, liked_id)</p><p>matches: match_id, user_id_1, user_id_2, created_at</p><div class="callout-block" data-callout="true"><p><strong><mark data-color="rgb(255, 255, 0)" style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">52 FAANG Question Vault</mark></strong> &#8212; $299 one-time (or $249 for paid subscribers)</p><p>All 52 walkthroughs + 52 drill cards + 6 framework cheatsheets + the Senior+ System Design Playbook. Everything, immediately. Lifetime access with all future updates included. &#8594; <strong><a href="https://systemdrd.com/ebooks/52-faang-questions-drillcards-cheatsheets/">Get the 52 FAANG Question Vault</a></strong></p></div><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.com/subscribe&quot;,&quot;text&quot;:&quot;Get Access to Github Repo&quot;,&quot;action&quot;:null,&quot;class&quot;:&quot;button-wrapper&quot;}" data-component-name="ButtonCreateButton"><a class="button primary button-wrapper" href="https://systemdr.systemdrd.com/subscribe"><span>Get Access to Github Repo</span></a></p><h2>Step 2 &#8212; Match detection</h2><div class="callout-block" data-callout="true"><p>When user A likes user B:</p><p>INSERT INTO likes (liker_id, liked_id) VALUES (A, B);</p><p>-- Check if B already liked A</p><p>SELECT 1 FROM likes WHERE liker_id=B AND liked_id=A LIMIT 1;</p><p>-- If found: create a match record and notify both users</p><p>INSERT INTO matches (user_id_1, user_id_2) VALUES (LEAST(A,B), GREATEST(A,B));</p></div><p>At scale: the mutual-like check is a hot query path. Cache it in Redis: SET likes:{B}:{A} 1 on every like. Match detection = GET likes:{B}:{A} &#8212; O(1), &lt; 1ms.</p>
      <p>
          <a href="https://systemdr.systemdrd.com/p/design-tinder-matching-walkthrough">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[The difference between "Hire" and "Strong Hire"]]></title><description><![CDATA[After the trade-offs section, before the interviewer wraps up, there is a 2-minute move that upgrades a Hire to a Strong Hire more reliably than anything else:]]></description><link>https://systemdr.systemdrd.com/p/the-difference-between-hire-and-strong</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/the-difference-between-hire-and-strong</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Sun, 25 Oct 2026 03:30:45 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!LHHC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff33e140f-f32e-439f-b2bf-fb10dc8be641_3600x2560.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>After the trade-offs section, before the interviewer wraps up, there is a 2-minute move that upgrades a Hire to a Strong Hire more reliably than anything else:</strong></p><p>Name two failure modes you haven&#8217;t fixed and the conditions under which you&#8217;d revisit the design.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.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">System Design Interview Roadmap is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</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><p>Not generic failure modes. Specific ones from your design.</p><p>&#8220;The two things I&#8217;d revisit: first, if the celebrity threshold for switching from fanout-on-write to fanout-on-read turns out to be lower than 1M followers in practice &#8212; I&#8217;d tune it based on actual write amplification metrics after the first week in production. Second, if the change_log grows faster than anticipated &#8212; I&#8217;d add a compaction job earlier than the 30-day window I assumed.&#8221;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.com/subscribe&quot;,&quot;text&quot;:&quot;Subscribe for Question Walkthrough&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://systemdr.systemdrd.com/subscribe"><span>Subscribe for Question Walkthrough</span></a></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LHHC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff33e140f-f32e-439f-b2bf-fb10dc8be641_3600x2560.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LHHC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff33e140f-f32e-439f-b2bf-fb10dc8be641_3600x2560.png 424w, https://substackcdn.com/image/fetch/$s_!LHHC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff33e140f-f32e-439f-b2bf-fb10dc8be641_3600x2560.png 848w, https://substackcdn.com/image/fetch/$s_!LHHC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff33e140f-f32e-439f-b2bf-fb10dc8be641_3600x2560.png 1272w, https://substackcdn.com/image/fetch/$s_!LHHC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff33e140f-f32e-439f-b2bf-fb10dc8be641_3600x2560.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LHHC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff33e140f-f32e-439f-b2bf-fb10dc8be641_3600x2560.png" width="688" height="489.0659340659341" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f33e140f-f32e-439f-b2bf-fb10dc8be641_3600x2560.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1035,&quot;width&quot;:1456,&quot;resizeWidth&quot;:688,&quot;bytes&quot;:638983,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://systemdr.systemdrd.com/i/220314444?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff33e140f-f32e-439f-b2bf-fb10dc8be641_3600x2560.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_!LHHC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff33e140f-f32e-439f-b2bf-fb10dc8be641_3600x2560.png 424w, https://substackcdn.com/image/fetch/$s_!LHHC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff33e140f-f32e-439f-b2bf-fb10dc8be641_3600x2560.png 848w, https://substackcdn.com/image/fetch/$s_!LHHC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff33e140f-f32e-439f-b2bf-fb10dc8be641_3600x2560.png 1272w, https://substackcdn.com/image/fetch/$s_!LHHC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff33e140f-f32e-439f-b2bf-fb10dc8be641_3600x2560.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>This demonstrates:</h3><p>1. You understand your design is an approximation, not a solution.</p><p>2. You&#8217;ve already thought about the monitoring signals that would tell you it&#8217;s failing.</p><p>3. You know how to respond when it fails.</p><p>That&#8217;s the entire difference between a candidate who has read about systems and a candidate</p><p>who has been on-call for them.</p><p><strong>CTA:</strong> The cohort curriculum goes beyond textbook designs &#8212; training you to proactively identify specific failure modes, establish clear production monitoring thresholds, and articulate exact trigger conditions for revisiting architecture before an interviewer even asks.</p><h2><strong>Subscription link</strong></h2><p><a href="https://systemdr.systemdrd.com/subscribe">https://systemdr.systemdrd.com/subscribe</a></p><p><strong>This free lesson is designed to get you started.</strong> </p><p>The paid content helps you master the topic with structured deep dives.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.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">System Design Interview Roadmap is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</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[Designing for Hallucination Mitigation — Guardrails and Verification Layers]]></title><description><![CDATA[Section 9: AI & LLM Infrastructure]]></description><link>https://systemdr.systemdrd.com/p/designing-for-hallucination-mitigation</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/designing-for-hallucination-mitigation</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Fri, 23 Oct 2026 03:30:38 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!GGcB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89e31146-b29d-4cce-bef4-d12ffd033e39_3600x2400.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote><p>A legal-tech startup shipped a contract-summarization feature in late 2024. It cited &#8220;Section 8.3(b)&#8221; of an NDA that had no Section 8.3(b) &#8212; the document only ran to Section 6. Nobody caught it before a paying customer did, in front of their own lawyer. The model wasn&#8217;t broken. It was doing exactly what autoregressive generation does: producing the most statistically plausible next token, with no built-in mechanism that checks whether &#8220;8.3(b)&#8221; actually exists in the source text. That gap between fluent and true is the entire reason guardrail and verification layers exist.</p></blockquote><h2>What a Verification Layer Actually Does</h2><p>A hallucination isn&#8217;t a bug in the traditional sense &#8212; there&#8217;s no stack trace, no exception, no failed assertion. The model produces well-formed, confident-sounding text that happens to be false, fabricated, or unsupported by the input it was given. Guardrails don&#8217;t fix the model. They wrap it, checking outputs (and sometimes inputs) against something more reliable than the model&#8217;s own confidence.</p><p>There are three broad layers, and most production systems use some combination of all three.</p><p><strong>Input-side guardrails</strong> constrain what the model is allowed to reason about in the first place. Retrieval scoping, strict system prompts, and schema-constrained generation (forcing JSON output against a defined schema) all reduce the surface area for fabrication before generation even starts.</p><p><strong>Output-side verification</strong> checks what came out. The simplest version is a grounding check: does every factual claim in the response trace back to a span in the retrieved context? This is usually implemented as a second LLM call &#8212; a smaller, cheaper model reads the source documents and the generated answer, then flags claims it can&#8217;t locate. Some teams use natural language inference (NLI) models instead, scoring entailment between source and claim rather than doing a full generative re-read, which is faster and cheaper per call but less able to catch subtle misattributions.</p><p><strong>Structural constraints</strong> enforce format and citation requirements at generation time rather than after the fact. Forcing every factual sentence to end with a bracketed source reference, then programmatically verifying that reference resolves to a real chunk ID, catches the NDA problem directly &#8212; an unresolvable citation is a hard signal, not a probabilistic guess.</p><p>The trade-off nobody likes to say out loud: every layer you add increases latency and cost, and none of them get you to zero. A verification layer running on a second model call typically adds 300&#8211;900ms and roughly doubles your per-request token cost. You&#8217;re buying a lower hallucination rate, not immunity from 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_!GGcB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89e31146-b29d-4cce-bef4-d12ffd033e39_3600x2400.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GGcB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89e31146-b29d-4cce-bef4-d12ffd033e39_3600x2400.png 424w, https://substackcdn.com/image/fetch/$s_!GGcB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89e31146-b29d-4cce-bef4-d12ffd033e39_3600x2400.png 848w, https://substackcdn.com/image/fetch/$s_!GGcB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89e31146-b29d-4cce-bef4-d12ffd033e39_3600x2400.png 1272w, https://substackcdn.com/image/fetch/$s_!GGcB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89e31146-b29d-4cce-bef4-d12ffd033e39_3600x2400.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GGcB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89e31146-b29d-4cce-bef4-d12ffd033e39_3600x2400.png" width="608" height="405.4725274725275" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/89e31146-b29d-4cce-bef4-d12ffd033e39_3600x2400.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:971,&quot;width&quot;:1456,&quot;resizeWidth&quot;:608,&quot;bytes&quot;:1814136,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://systemdr.systemdrd.com/i/219067019?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89e31146-b29d-4cce-bef4-d12ffd033e39_3600x2400.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_!GGcB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89e31146-b29d-4cce-bef4-d12ffd033e39_3600x2400.png 424w, https://substackcdn.com/image/fetch/$s_!GGcB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89e31146-b29d-4cce-bef4-d12ffd033e39_3600x2400.png 848w, https://substackcdn.com/image/fetch/$s_!GGcB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89e31146-b29d-4cce-bef4-d12ffd033e39_3600x2400.png 1272w, https://substackcdn.com/image/fetch/$s_!GGcB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89e31146-b29d-4cce-bef4-d12ffd033e39_3600x2400.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.com/subscribe&quot;,&quot;text&quot;:&quot;Subscribe to Access Private Github Repo&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://systemdr.systemdrd.com/subscribe"><span>Subscribe to Access Private Github Repo</span></a></p>
      <p>
          <a href="https://systemdr.systemdrd.com/p/designing-for-hallucination-mitigation">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Design a Log Aggregation System (ELK/Splunk) — Walkthrough]]></title><description><![CDATA[Archetype: Infrastructure & Platform &#183; Asked at: Elastic, Splunk, Datadog, FAANG-wide]]></description><link>https://systemdr.systemdrd.com/p/design-a-log-aggregation-system-elksplunk</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/design-a-log-aggregation-system-elksplunk</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Tue, 20 Oct 2026 03:30:41 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!H0H8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d8b8543-db7b-442e-8716-7f7c23f18f9f_4750x4500.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>The probe</h2><blockquote><p>Logs are high-volume, write-once, read-rarely data. The system must ingest millions of log lines per second, store them durably, and make them searchable within seconds. The tension: write throughput (sequential append) vs search (inverted index, which requires knowing content in advance).</p></blockquote><h2>Step 1 &#8212; Clarify</h2><p>- Ingestion rate: 1M log lines/sec (large deployment)</p><p>- Average log size: 500 bytes &#8594; 500 MB/sec ingestion bandwidth</p><p>- Search SLO: search across last 24h of logs within 5 seconds</p><p>- Retention: 30 days hot (searchable), 1 year cold (archive)</p><p>- Structured (JSON) logs or unstructured (free text)?</p><div class="callout-block" data-callout="true"><p><strong><mark data-color="rgb(255, 255, 0)" style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">52 FAANG Question Vault</mark></strong> &#8212; $299 one-time (or $249 for paid subscribers)</p><p>All 52 walkthroughs + 52 drill cards + 6 framework cheatsheets + the Senior+ System Design Playbook. Everything, immediately. Lifetime access with all future updates included. &#8594; <strong><a href="https://systemdrd.com/ebooks/52-faang-questions-drillcards-cheatsheets/">Get the 52 FAANG Question Vault</a></strong></p></div><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.com/subscribe&quot;,&quot;text&quot;:&quot;Get Access to Github Repo&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://systemdr.systemdrd.com/subscribe"><span>Get Access to Github Repo</span></a></p>
      <p>
          <a href="https://systemdr.systemdrd.com/p/design-a-log-aggregation-system-elksplunk">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Indexes: B-Tree, Hash, Composite, Covering]]></title><description><![CDATA[Indexes are the most commonly mentioned and least explained element in system design interviews.]]></description><link>https://systemdr.systemdrd.com/p/indexes-b-tree-hash-composite-covering</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/indexes-b-tree-hash-composite-covering</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Sun, 18 Oct 2026 03:30:49 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!B_qk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F723a461f-6555-4f90-bfd0-7a5e86f12fcb_3600x2480.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Indexes are the most commonly mentioned and least explained element in system design interviews. &#8220;I&#8217;d add an index on user_id&#8221; is a complete sentence in most answers. It tells the interviewer almost nothing.</p><p>Here&#8217;s the complete framework for talking about indexes in an interview &#8212; specific enough to signal expertise, concise enough to not derail the conversation.</p><h3><strong>B-tree index (the default)</strong></h3><p>A B-tree index stores values in sorted order as a balanced tree. Lookups, range queries, and ORDER BY operations all use it efficiently.</p><p>Use for: equality queries (<code>WHERE user_id = 123</code>), range queries (<code>WHERE created_at BETWEEN x AND y</code>), sorting (<code>ORDER BY created_at DESC</code>).</p><p>The B-tree is the default index type in Postgres, MySQL, and most relational databases. When you say &#8220;I&#8217;d add an index&#8221; without specifying a type, this is what you&#8217;re getting.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!B_qk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F723a461f-6555-4f90-bfd0-7a5e86f12fcb_3600x2480.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!B_qk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F723a461f-6555-4f90-bfd0-7a5e86f12fcb_3600x2480.png 424w, https://substackcdn.com/image/fetch/$s_!B_qk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F723a461f-6555-4f90-bfd0-7a5e86f12fcb_3600x2480.png 848w, https://substackcdn.com/image/fetch/$s_!B_qk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F723a461f-6555-4f90-bfd0-7a5e86f12fcb_3600x2480.png 1272w, https://substackcdn.com/image/fetch/$s_!B_qk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F723a461f-6555-4f90-bfd0-7a5e86f12fcb_3600x2480.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!B_qk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F723a461f-6555-4f90-bfd0-7a5e86f12fcb_3600x2480.png" width="1456" height="1003" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/723a461f-6555-4f90-bfd0-7a5e86f12fcb_3600x2480.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1003,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:909005,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://systemdr.systemdrd.com/i/219533285?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F723a461f-6555-4f90-bfd0-7a5e86f12fcb_3600x2480.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_!B_qk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F723a461f-6555-4f90-bfd0-7a5e86f12fcb_3600x2480.png 424w, https://substackcdn.com/image/fetch/$s_!B_qk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F723a461f-6555-4f90-bfd0-7a5e86f12fcb_3600x2480.png 848w, https://substackcdn.com/image/fetch/$s_!B_qk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F723a461f-6555-4f90-bfd0-7a5e86f12fcb_3600x2480.png 1272w, https://substackcdn.com/image/fetch/$s_!B_qk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F723a461f-6555-4f90-bfd0-7a5e86f12fcb_3600x2480.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><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><strong>Hash index</strong></h3><p>A hash index maps each value to a hash. Lookups by exact equality are O(1). Range queries are impossible &#8212; the hash has no ordering.</p><p>Use for: pure equality lookups where range queries will never be needed. Session ID lookups. Token validation. Cache key lookups.</p><p>In practice: Redis and most key-value stores use hash indexes internally. Postgres supports hash indexes but they&#8217;re rarely the right choice over B-tree because B-tree handles both equality and range queries while hash handles only equality.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.com/subscribe&quot;,&quot;text&quot;:&quot;Subscribe for Question Walkthrough&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://systemdr.systemdrd.com/subscribe"><span>Subscribe for Question Walkthrough</span></a></p><h3><strong>Composite index</strong></h3><p>A composite index covers multiple columns: <code>CREATE INDEX ON orders (user_id, status, created_at)</code>.</p><p>The critical rule: <strong>composite indexes follow the left-prefix rule.</strong> This index serves queries on <code>(user_id)</code>, <code>(user_id, status)</code>, and <code>(user_id, status, created_at)</code>. It does NOT serve queries on <code>(status)</code> alone or <code>(created_at)</code> alone.</p><p>Use for: queries that always filter by a leading column and sometimes filter by subsequent columns. &#8220;Give me all pending orders for user X from the last 7 days&#8221; &#8212; <code>(user_id, status, created_at)</code> is the right index.</p><p>The order of columns in a composite index matters: put the most selective columns first if you want to cover a range of queries, or put the equality predicates before the range predicates.</p><h3><strong>Partial index</strong></h3><p>A partial index covers only a subset of rows, defined by a WHERE clause.</p><p><code>CREATE INDEX ON orders (created_at) WHERE status = 'pending'</code></p><p>This index only stores rows where status is &#8216;pending&#8217;. It&#8217;s much smaller than a full index on created_at. Queries that filter by <code>status = 'pending'</code> and then sort by created_at will use this index. Queries that don&#8217;t filter by status won&#8217;t.</p><p>Use for: high-cardinality tables where most queries filter on the same condition. &#8220;Show pending orders&#8221; is a common query; &#8220;show completed orders&#8221; is rare. Index the pending subset specifically.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.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">System Design Interview Roadmap is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</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><h3><strong>Covering index</strong></h3><p>A covering index includes all columns needed to satisfy a query, so the database can answer the query entirely from the index without touching the underlying table.</p><p>If your query is <code>SELECT user_id, status FROM orders WHERE user_id = 123</code>, an index on <code>(user_id, status)</code> is a covering index &#8212; it has both columns. The query engine never touches the orders table rows.</p><p>The performance difference is significant: a covering index means one I/O operation (read the index), not two (read the index, then follow the pointer to the table row for each result).</p><p>Use for: frequently-run queries on large tables where you want to eliminate the table access entirely. Add the extra columns at the cost of a slightly larger index.</p><h3><strong>How to talk about indexes in an interview</strong></h3><p>The right pattern: identify the hot queries first, then derive the indexes.</p><p>&#8220;The hot query is: all pending orders for a given user, sorted by creation time. I&#8217;d create a composite index on <code>(user_id, status, created_at)</code>. This serves the user_id equality, the status equality, and the created_at range all from one index. I&#8217;d make it a partial index filtered to status=&#8217;pending&#8217; to reduce the index size since orders spend very little time in pending state at scale.&#8221;</p><p>Four sentences. Names the query. Names the index type. Names the column order reasoning. Names the optimization.</p><p>That&#8217;s the L5 format for any index discussion. L6 adds: name the trade-off (write overhead &#8212; every INSERT and UPDATE on the indexed columns must also update the index) and the conditions under which you&#8217;d remove it (if write performance degrades and the query is no longer hot).</p><p><strong>CTA</strong>: The cohort curriculum goes beyond surface-level statements &#8212; walking through exact index selection for high-throughput queries, ordering composite keys, leveraging partial and covering indexes to drop table read I/O, and evaluating the write-amplification trade-offs at scale.</p><h2><strong>Subscription link</strong></h2><p><a href="https://systemdr.systemdrd.com/subscribe">https://systemdr.systemdrd.com/subscribe</a></p><p><strong>Interested in mastering this topic?</strong> Unlock premium content with deeper explanations and real implementation patterns.</p>]]></content:encoded></item><item><title><![CDATA[AI Gateway Patterns: Rate Limiting and Cost Control for LLM APIs]]></title><description><![CDATA[A team at a mid-size fintech shipped a support-ticket summarizer in March.]]></description><link>https://systemdr.systemdrd.com/p/ai-gateway-patterns-rate-limiting</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/ai-gateway-patterns-rate-limiting</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Fri, 16 Oct 2026 04:10:35 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!onUF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3706eeae-384a-4c4c-8a7a-5a0c8da6ef72_3600x2240.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote><p>A team at a mid-size fintech shipped a support-ticket summarizer in March. It worked fine in staging. Three days after launch, one customer&#8217;s integration retried a failed webhook every 400 milliseconds, each retry firing a fresh call to Claude. The bill for that one afternoon came out to $4,200. Nobody had built a rate limiter in front of the model calls, because in staging nobody needed one. That&#8217;s the whole argument for an AI gateway in six sentences.</p></blockquote><h2>What a gateway actually does</h2><p>An AI gateway is a proxy layer sitting between your application code and the model providers &#8212; Anthropic, OpenAI, whoever. It&#8217;s not a new idea; it&#8217;s the same reverse-proxy pattern API teams have used for REST services since the 2000s, aimed at a workload that happens to be metered by tokens instead of requests. The gateway does three jobs: it limits how fast callers can hit the model, it tracks what every call costs in near-real time, and it decides what happens when a caller exceeds their budget or the provider throttles you back.</p><p>The rate-limiting piece almost always uses a token bucket, not a fixed window counter. Fixed windows have a well-known edge case: a caller can burn their entire quota in the last second of one window and the first second of the next, doubling their effective rate at the boundary. A token bucket avoids that. Each API key gets a bucket that holds up to N tokens (say, 50) and refills at a steady rate (say, 10 per second). Every request costs some number of tokens &#8212; often the actual LLM token count, not a flat &#8220;1 request = 1 token&#8221; charge, since a 50-token prompt and a 4,000-token prompt do very different amounts of work downstream. Request comes in, gateway checks the bucket, if there&#8217;s enough capacity it deducts and forwards the call; if not, it returns a 429 immediately, before the request ever reaches the model provider.</p><p>That last detail matters more than it sounds. Rejecting locally, in Redis, costs you a few milliseconds. Rejecting after the provider call has already gone out costs you the full latency of that call &#8212; and, worse, you&#8217;ve already been billed for the tokens. A gateway that rate-limits <em>after</em> the fact isn&#8217;t a rate limiter, it&#8217;s a cost report.</p><p>Cost tracking runs in parallel. Every response from the provider comes back with usage metadata &#8212; input tokens, output tokens, sometimes cached tokens billed at a different rate. The gateway multiplies those against a price table (which you have to keep updated by hand or by scraping the provider&#8217;s pricing page, because there&#8217;s no standard API for &#8220;tell me your current prices&#8221;) and writes a ledger entry: which API key, which model, how many tokens, what it cost. Aggregate that ledger by key, by team, by hour, and you get a live spend dashboard instead of a surprise on the monthly invoice.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!onUF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3706eeae-384a-4c4c-8a7a-5a0c8da6ef72_3600x2240.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!onUF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3706eeae-384a-4c4c-8a7a-5a0c8da6ef72_3600x2240.png 424w, https://substackcdn.com/image/fetch/$s_!onUF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3706eeae-384a-4c4c-8a7a-5a0c8da6ef72_3600x2240.png 848w, https://substackcdn.com/image/fetch/$s_!onUF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3706eeae-384a-4c4c-8a7a-5a0c8da6ef72_3600x2240.png 1272w, https://substackcdn.com/image/fetch/$s_!onUF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3706eeae-384a-4c4c-8a7a-5a0c8da6ef72_3600x2240.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!onUF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3706eeae-384a-4c4c-8a7a-5a0c8da6ef72_3600x2240.png" width="628" height="390.77472527472526" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3706eeae-384a-4c4c-8a7a-5a0c8da6ef72_3600x2240.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:906,&quot;width&quot;:1456,&quot;resizeWidth&quot;:628,&quot;bytes&quot;:848157,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://systemdr.systemdrd.com/i/217807114?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3706eeae-384a-4c4c-8a7a-5a0c8da6ef72_3600x2240.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_!onUF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3706eeae-384a-4c4c-8a7a-5a0c8da6ef72_3600x2240.png 424w, https://substackcdn.com/image/fetch/$s_!onUF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3706eeae-384a-4c4c-8a7a-5a0c8da6ef72_3600x2240.png 848w, https://substackcdn.com/image/fetch/$s_!onUF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3706eeae-384a-4c4c-8a7a-5a0c8da6ef72_3600x2240.png 1272w, https://substackcdn.com/image/fetch/$s_!onUF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3706eeae-384a-4c4c-8a7a-5a0c8da6ef72_3600x2240.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><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 this gets subtle</h2><p><strong>Common knowledge:</strong> everyone building on LLM APIs eventually adds <em>some</em> rate limiting, usually a naive per-minute counter, usually after a bill scare.</p><p><strong>Rare knowledge:</strong> token buckets need per-key buckets, not one global bucket, or your best customer gets throttled because a different customer is misbehaving. Getting this wrong is the single most common gateway bug &#8212; I&#8217;ve seen it ship to production at three different companies.</p><p><strong>Advanced insight:</strong> at real scale, the bucket state itself becomes a bottleneck. A single Redis instance doing a check-and-decrement on every request for thousands of keys per second will show up as your p99 latency floor before the model call even starts. Sharding buckets by key hash, or using Redis Cluster with client-side hashing, fixes it &#8212; but now you&#8217;ve got a distributed rate limiter, which has its own consistency headaches (two gateway nodes racing to decrement the same bucket).</p><p><strong>Strategic impact:</strong> cost control isn&#8217;t just finance hygiene. A gateway that tracks spend per feature lets you kill a runaway feature without killing the whole product &#8212; set a hard budget cap on the &#8220;auto-summarize&#8221; endpoint specifically, and when it hits zero, that endpoint degrades to a cached or non-LLM fallback while checkout, search, and everything else keeps working. Without per-feature attribution, your only lever is an all-or-nothing kill switch on the whole gateway.</p><p><strong>Implementation nuance:</strong> decide up front whether rate limits apply to <em>requests</em> or <em>tokens per minute</em>. Most providers rate-limit you on both, separately, and your gateway&#8217;s limits should mirror that shape &#8212; otherwise you&#8217;ll pass your own gateway&#8217;s check and get throttled by the provider anyway, which is a confusing failure mode to debug at 2 a.m.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!j6OR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0cdcfc-b664-4e5d-b416-e0edd2d01314_3600x2480.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!j6OR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0cdcfc-b664-4e5d-b416-e0edd2d01314_3600x2480.png 424w, https://substackcdn.com/image/fetch/$s_!j6OR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0cdcfc-b664-4e5d-b416-e0edd2d01314_3600x2480.png 848w, https://substackcdn.com/image/fetch/$s_!j6OR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0cdcfc-b664-4e5d-b416-e0edd2d01314_3600x2480.png 1272w, https://substackcdn.com/image/fetch/$s_!j6OR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0cdcfc-b664-4e5d-b416-e0edd2d01314_3600x2480.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!j6OR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0cdcfc-b664-4e5d-b416-e0edd2d01314_3600x2480.png" width="596" height="410.56868131868134" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9f0cdcfc-b664-4e5d-b416-e0edd2d01314_3600x2480.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1003,&quot;width&quot;:1456,&quot;resizeWidth&quot;:596,&quot;bytes&quot;:664205,&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://systemdr.systemdrd.com/i/217807114?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0cdcfc-b664-4e5d-b416-e0edd2d01314_3600x2480.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_!j6OR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0cdcfc-b664-4e5d-b416-e0edd2d01314_3600x2480.png 424w, https://substackcdn.com/image/fetch/$s_!j6OR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0cdcfc-b664-4e5d-b416-e0edd2d01314_3600x2480.png 848w, https://substackcdn.com/image/fetch/$s_!j6OR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0cdcfc-b664-4e5d-b416-e0edd2d01314_3600x2480.png 1272w, https://substackcdn.com/image/fetch/$s_!j6OR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0cdcfc-b664-4e5d-b416-e0edd2d01314_3600x2480.png 1456w" sizes="auto, 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 buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><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 href="https://systemdr.systemdrd.com/p/ai-gateway-patterns-rate-limiting">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Design a Distributed Task Queue (Celery/SQS) — Walkthrough]]></title><description><![CDATA[Archetype: Infrastructure & Platform &#183; Asked at: Amazon, Shopify, Stripe]]></description><link>https://systemdr.systemdrd.com/p/design-a-distributed-task-queue-celerysqs</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/design-a-distributed-task-queue-celerysqs</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Tue, 13 Oct 2026 03:31:40 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!0kDF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc0f25006-dcf0-43c8-850a-bd3bf1fa8ed1_4750x4500.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>The probe</h2><blockquote><p>A task queue decouples work submission from work execution. The key systems design problems: at-least-once vs exactly-once delivery, task visibility timeout (what happens if a worker dies mid-task), retry with backoff, and dead-letter queues.</p></blockquote><h2>Step 1 &#8212; Clarify</h2><p>- At-least-once or exactly-once task execution? (At-least-once is standard &#8212; tasks must be idempotent)</p><p>- Priority queues? (Yes &#8212; critical tasks jump the queue)</p><p>- Task timeout (maximum execution time before considering a worker dead)? - Retry policy (max attempts, backoff strategy)?</p><p>- Dead-letter queue for permanently failed tasks?</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0kDF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc0f25006-dcf0-43c8-850a-bd3bf1fa8ed1_4750x4500.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0kDF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc0f25006-dcf0-43c8-850a-bd3bf1fa8ed1_4750x4500.png 424w, https://substackcdn.com/image/fetch/$s_!0kDF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc0f25006-dcf0-43c8-850a-bd3bf1fa8ed1_4750x4500.png 848w, https://substackcdn.com/image/fetch/$s_!0kDF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc0f25006-dcf0-43c8-850a-bd3bf1fa8ed1_4750x4500.png 1272w, https://substackcdn.com/image/fetch/$s_!0kDF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc0f25006-dcf0-43c8-850a-bd3bf1fa8ed1_4750x4500.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0kDF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc0f25006-dcf0-43c8-850a-bd3bf1fa8ed1_4750x4500.png" width="1456" height="1379" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c0f25006-dcf0-43c8-850a-bd3bf1fa8ed1_4750x4500.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1379,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1578628,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://systemdr.systemdrd.com/i/218298475?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc0f25006-dcf0-43c8-850a-bd3bf1fa8ed1_4750x4500.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_!0kDF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc0f25006-dcf0-43c8-850a-bd3bf1fa8ed1_4750x4500.png 424w, https://substackcdn.com/image/fetch/$s_!0kDF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc0f25006-dcf0-43c8-850a-bd3bf1fa8ed1_4750x4500.png 848w, https://substackcdn.com/image/fetch/$s_!0kDF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc0f25006-dcf0-43c8-850a-bd3bf1fa8ed1_4750x4500.png 1272w, https://substackcdn.com/image/fetch/$s_!0kDF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc0f25006-dcf0-43c8-850a-bd3bf1fa8ed1_4750x4500.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><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>Step 2 &#8212; Data Model</h2><p>tasks table:</p><p>task_id (UUID), queue_name, payload (JSON), status</p><p>(queued/in_progress/completed/failed/dead),</p><p>priority (int), attempt_count, max_attempts, visibility_timeout_at, next_attempt_at, created_at, completed_at, error_message</p><div class="callout-block" data-callout="true"><p><strong><mark data-color="rgb(255, 255, 0)" style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">52 FAANG Question Vault</mark></strong> &#8212; $299 one-time (or $249 for paid subscribers)</p><p>All 52 walkthroughs + 52 drill cards + 6 framework cheatsheets + the Senior+ System Design Playbook. Everything, immediately. Lifetime access with all future updates included. &#8594; <strong><a href="https://systemdrd.com/ebooks/52-faang-questions-drillcards-cheatsheets/">Get the 52 FAANG Question Vault</a></strong></p></div><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.com/subscribe&quot;,&quot;text&quot;:&quot;Get a Access to Github Repo&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://systemdr.systemdrd.com/subscribe"><span>Get a Access to Github Repo</span></a></p>
      <p>
          <a href="https://systemdr.systemdrd.com/p/design-a-distributed-task-queue-celerysqs">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Handling Questions You Haven't Seen]]></title><description><![CDATA[You will get a question you haven&#8217;t drilled. This is guaranteed. The point of the question bank is pattern recognition, not memorization.]]></description><link>https://systemdr.systemdrd.com/p/handling-questions-you-havent-seen</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/handling-questions-you-havent-seen</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Sun, 11 Oct 2026 03:31:22 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!covP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbed6012-a9ac-42ae-93e0-44ae39717879_3600x2080.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>The recovery process &#8212; four steps:</h2><h4>Step 1: Buy 90 seconds with clarifying questions. </h4><p>You don&#8217;t need to know the answer before you ask the questions. &#8220;Let me make sure I understand the scope &#8212; are we designing for real-time delivery or batch? How many users at peak?&#8221; You&#8217;re not stalling &#8212; you&#8217;re genuinely narrowing the problem while your brain maps the question to the nearest archetype.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.com/subscribe&quot;,&quot;text&quot;:&quot;Subscribe for Question Walkthrough&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://systemdr.systemdrd.com/subscribe"><span>Subscribe for Question Walkthrough</span></a></p><h4>Step 2: Name the archetype out loud. </h4><p>&#8220;This sounds like it has the same core tension as a feed fanout system &#8212; lots of writes amplifying into lots of reads, with a latency constraint.&#8221; If you&#8217;re right, the interviewer will nod. If you&#8217;re wrong, they&#8217;ll redirect. Either way, you&#8217;ve signaled you have a framework.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.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">System Design Interview Roadmap is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</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><h4>Step 3: Run the 6-step framework on the archetype, not the specific question. </h4><p>If you&#8217;ve identified it as a &#8220;real-time messaging&#8221; problem, run the messaging framework &#8212; WebSocket, delivery semantics, offline handling &#8212; and adapt the names to fit the new question.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!covP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbed6012-a9ac-42ae-93e0-44ae39717879_3600x2080.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!covP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbed6012-a9ac-42ae-93e0-44ae39717879_3600x2080.png 424w, https://substackcdn.com/image/fetch/$s_!covP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbed6012-a9ac-42ae-93e0-44ae39717879_3600x2080.png 848w, https://substackcdn.com/image/fetch/$s_!covP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbed6012-a9ac-42ae-93e0-44ae39717879_3600x2080.png 1272w, https://substackcdn.com/image/fetch/$s_!covP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbed6012-a9ac-42ae-93e0-44ae39717879_3600x2080.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!covP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbed6012-a9ac-42ae-93e0-44ae39717879_3600x2080.png" width="1456" height="841" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cbed6012-a9ac-42ae-93e0-44ae39717879_3600x2080.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:841,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:703567,&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://systemdr.systemdrd.com/i/219216301?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbed6012-a9ac-42ae-93e0-44ae39717879_3600x2080.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_!covP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbed6012-a9ac-42ae-93e0-44ae39717879_3600x2080.png 424w, https://substackcdn.com/image/fetch/$s_!covP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbed6012-a9ac-42ae-93e0-44ae39717879_3600x2080.png 848w, https://substackcdn.com/image/fetch/$s_!covP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbed6012-a9ac-42ae-93e0-44ae39717879_3600x2080.png 1272w, https://substackcdn.com/image/fetch/$s_!covP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbed6012-a9ac-42ae-93e0-44ae39717879_3600x2080.png 1456w" sizes="auto, 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 buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4>Step 4: Go deep on the hard part, not the familiar parts. </h4><p>If you&#8217;ve never seen the question before, the interviewer knows it. They&#8217;re not expecting a polished answer. They&#8217;re watching whether you can reason under uncertainty. Go to the hardest distributed systems problem in the question and show that you can think through it, even imperfectly.</p><p><strong>What not to do:</strong> Don&#8217;t say &#8220;I haven&#8217;t seen this question before.&#8221; It signals that you were expecting to pattern-match, not think. Even if the question is new, treat it as a normal design round and work through it.</p><div><hr></div><p><strong>CTA:</strong> The cohort curriculum is built around recovering when the question is unfamiliar &#8212; clarifying the scope, identifying the right system archetype, applying a proven framework, and going deep on the hardest distributed-systems trade-off instead of relying on pattern-matching.</p><h2><strong>Subscription link</strong></h2><p><a href="https://systemdr.systemdrd.com/subscribe">https://systemdr.systemdrd.com/subscribe</a></p><p><strong>Want the full picture?</strong> </p><p>The premium lessons include advanced insights, practical exercises, and comprehensive walkthroughs.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.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">System Design Interview Roadmap is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</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[Multi-Modal System Design — Handling Text, Image, and Audio Simultaneously]]></title><description><![CDATA[A customer uploads a 40-second phone video of a leaking pipe and types &#8220;is this covered under my policy?&#8221; One request, three payloads: a text question, an audio track, and roughly 1,200 video frames.]]></description><link>https://systemdr.systemdrd.com/p/multi-modal-system-design-handling</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/multi-modal-system-design-handling</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Fri, 09 Oct 2026 09:08:01 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!gCt3!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1137a8b1-eb2d-4d8b-91a1-4d061d119146_3600x2480.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote><p>A customer uploads a 40-second phone video of a leaking pipe and types &#8220;is this covered under my policy?&#8221; One request, three payloads: a text question, an audio track, and roughly 1,200 video frames. Most teams building this feature start by wiring the video into a vision model, the audio into a transcription service, and the text straight to the LLM, then stitching the three outputs together in a prompt. It works in the demo. It falls apart at 200 requests per second, when the video encoder queue backs up, the transcription service returns four seconds after the vision model already timed out, and the LLM ends up reasoning over a transcript-shaped hole. Multi-modal system design is mostly about not letting that happen.</p></blockquote><h2>The Core Problem: Modalities Don&#8217;t Move at the Same Speed</h2><p>A multi-modal system ingests inputs of fundamentally different sizes, formats, and processing costs, then produces a unified response. The naive architecture treats this as three parallel single-modal pipelines that converge at the end. The problem is that text tokenizes in microseconds, a 512&#215;512 image embeds in 30&#8211;80ms on a decent GPU, and a 40-second audio clip takes 1&#8211;3 seconds to transcribe even with a fast ASR model. If your orchestrator waits for all three before calling the LLM, your p99 latency is set by your slowest modality, every time, regardless of how fast the other two are.</p><p>The fix isn&#8217;t a faster audio model. It&#8217;s decoupling ingestion from fusion. Each modality gets its own preprocessing pipeline &#8212; resize and encode for images, chunk and transcribe for audio, tokenize for text &#8212; running independently and writing normalized output to a shared store (commonly Redis or a lightweight message queue keyed by request ID). A fusion layer watches for all required pieces to arrive, or a timeout to expire, before assembling the final prompt.</p><p>That timeout decision is where most of the design tension lives. Do you wait for the slow modality, or degrade gracefully and answer with partial context? Insurance claims can&#8217;t guess at what&#8217;s in a video. A customer support chatbot answering &#8220;what&#8217;s this error mean&#8221; from a screenshot plus text can often proceed on text alone if the vision pipeline is backed up, flagging the response as partial. The right answer is domain-specific, but the architecture has to support both paths &#8212; most teams only build the happy path and discover the gap during an incident.</p><p>Fusion itself has two common strategies. <strong>Early fusion</strong> projects every modality into a shared embedding space (think CLIP-style joint embeddings) before any reasoning happens &#8212; this is what lets a model compare &#8220;a photo of a dog&#8221; against an actual photo directly. <strong>Late fusion</strong> keeps modalities separate through their own specialized models and only combines outputs at the decision layer, e.g., concatenating a transcript, an image caption, and the user&#8217;s text into a single LLM prompt. Late fusion is easier to build and debug, since each component fails independently and visibly. Early fusion captures cross-modal relationships that late fusion misses entirely &#8212; a joint embedding model can tell you the audio tone doesn&#8217;t match the words, while three separate pipelines never make that comparison at all.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gCt3!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1137a8b1-eb2d-4d8b-91a1-4d061d119146_3600x2480.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gCt3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1137a8b1-eb2d-4d8b-91a1-4d061d119146_3600x2480.png 424w, https://substackcdn.com/image/fetch/$s_!gCt3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1137a8b1-eb2d-4d8b-91a1-4d061d119146_3600x2480.png 848w, https://substackcdn.com/image/fetch/$s_!gCt3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1137a8b1-eb2d-4d8b-91a1-4d061d119146_3600x2480.png 1272w, https://substackcdn.com/image/fetch/$s_!gCt3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1137a8b1-eb2d-4d8b-91a1-4d061d119146_3600x2480.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gCt3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1137a8b1-eb2d-4d8b-91a1-4d061d119146_3600x2480.png" width="618" height="425.7239010989011" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1137a8b1-eb2d-4d8b-91a1-4d061d119146_3600x2480.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1003,&quot;width&quot;:1456,&quot;resizeWidth&quot;:618,&quot;bytes&quot;:1375858,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://systemdr.systemdrd.com/i/216857020?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1137a8b1-eb2d-4d8b-91a1-4d061d119146_3600x2480.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_!gCt3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1137a8b1-eb2d-4d8b-91a1-4d061d119146_3600x2480.png 424w, https://substackcdn.com/image/fetch/$s_!gCt3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1137a8b1-eb2d-4d8b-91a1-4d061d119146_3600x2480.png 848w, https://substackcdn.com/image/fetch/$s_!gCt3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1137a8b1-eb2d-4d8b-91a1-4d061d119146_3600x2480.png 1272w, https://substackcdn.com/image/fetch/$s_!gCt3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1137a8b1-eb2d-4d8b-91a1-4d061d119146_3600x2480.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><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 href="https://systemdr.systemdrd.com/p/multi-modal-system-design-handling">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Design Reddit’s Front Page — Walkthrough ]]></title><description><![CDATA[The probe]]></description><link>https://systemdr.systemdrd.com/p/design-reddits-front-page-walkthrough</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/design-reddits-front-page-walkthrough</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Tue, 06 Oct 2026 03:30:36 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Tuyt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bef3213-1942-44fa-a40d-7738bc4045e5_4750x4750.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>The probe</h2><blockquote><p>Reddit&#8217;s front page is community-aggregated content ranked by the &#8220;hot&#8221; algorithm. The interesting system design question is: how do you maintain a ranked list across thousands of subreddits with millions of concurrent voters, without recomputing the full ranking on every vote?</p></blockquote><h2>The Hot Algorithm</h2><div class="callout-block" data-callout="true"><p>Reddit&#8217;s hot score for a post: score = log10(max(abs(ups - downs), 1)) + sign(ups - downs) * seconds_since_epoch / 45000</p></div><p>This decays old posts naturally without a cron job &#8212; the time term shrinks the relative contribution of votes as a post ages. An hour-old post needs 10&#215; more upvotes to rank above a brand-new post.</p><h2>Architecture</h2><p>- <strong>Vote events: </strong></p><p>User upvotes &#8594; Kafka &#8594; vote aggregation worker &#8594; update posts.score in the posts table</p><p>- <strong>Front page: </strong></p><p>Precomputed per-subreddit sorted lists in Redis ZSETs, score = hot algorithm value. On vote: re-score the post and ZADD with new score. Front page read = ZREVRANGE /r/all 0 24 &#8212; O(log N)</p><p>- <strong>The r/all problem: </strong></p><p>r/all aggregates top posts from all subreddits. At peak, millions of posts compete. Maintain a separate ZSET for r/all, updated when any subreddit post&#8217;s score enters the top-1000 of its subreddit</p><p>- <strong>New posts: </strong></p><p>Use a separate new ZSET per subreddit sorted by created_at. New tab = ZREVRANGE on this set. No algorithm needed.</p><p>- <strong>Award/controversy: </strong></p><p>Track controversiality score (high upvotes AND high downvotes) in a separate sorted set for the controversial sort</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.com/subscribe&quot;,&quot;text&quot;:&quot;Get Access to GitHub Repo&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://systemdr.systemdrd.com/subscribe"><span>Get Access to GitHub Repo</span></a></p><div><hr></div>
      <p>
          <a href="https://systemdr.systemdrd.com/p/design-reddits-front-page-walkthrough">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[The Hardest Question in the Question Bank]]></title><description><![CDATA[Of the 52 questions in the system design bank, one comes up in cohort feedback more than any other.]]></description><link>https://systemdr.systemdrd.com/p/the-hardest-question-in-the-question</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/the-hardest-question-in-the-question</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Sun, 04 Oct 2026 03:30:42 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!QfD7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21654ae3-b968-408d-b625-24be8fcf7156_4800x3400.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Of the 52 questions in the system design bank, one comes up in cohort feedback more than any other. Members write more questions about it, get more wrong, and learn more from getting it wrong.</p><p>It&#8217;s the Google Docs question. Design a real-time collaborative editor.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.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">System Design Interview Roadmap is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</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><p>Here&#8217;s why it&#8217;s the hardest &#8212; and why that makes it the most valuable one to understand deeply even if you never get asked it directly.</p><h3><strong>Why it&#8217;s different from every other question</strong></h3><p>Most system design questions have a &#8220;store data, serve data&#8221; structure underneath. Messages are stored and delivered. Files are stored and synced. Videos are stored and streamed. The interesting problems are about doing these operations reliably at scale.</p><p>Collaborative editing is different. The problem isn&#8217;t storage or delivery. It&#8217;s <em>merging</em> &#8212; two users type simultaneously into the same document, and both changes must survive in a consistent order on both clients, in real time, without either user&#8217;s edits being lost.</p><p>This is a fundamentally different problem. Storage and delivery can be solved with good distributed systems primitives. Merging concurrent edits requires a different class of solution: Operational Transformation or CRDTs.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.com/subscribe&quot;,&quot;text&quot;:&quot;Subscribe for Question Walkthrough&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://systemdr.systemdrd.com/subscribe"><span>Subscribe for Question Walkthrough</span></a></p><h3><strong>The naive approaches fail interestingly</strong></h3><p>Most candidates start with one of two intuitions.</p><p>The first: &#8220;the server is the source of truth &#8212; last write wins.&#8221; This silently destroys data. User A types &#8220;Hello&#8221; and user B types &#8220;World&#8221; simultaneously. Whichever write arrives at the server last overwrites the first. One user loses their edit invisibly. Not acceptable.</p><p>The second: &#8220;the server merges conflicting writes.&#8221; This sounds right until you try to implement it. What does &#8220;merge&#8221; mean for concurrent text edits? If A inserts a character at position 5 and B deletes a character at position 3 simultaneously, what&#8217;s the correct merged result? The positions have shifted. The server cannot naively apply both operations in sequence.</p><p>This is where OT comes in.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QfD7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21654ae3-b968-408d-b625-24be8fcf7156_4800x3400.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QfD7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21654ae3-b968-408d-b625-24be8fcf7156_4800x3400.png 424w, https://substackcdn.com/image/fetch/$s_!QfD7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21654ae3-b968-408d-b625-24be8fcf7156_4800x3400.png 848w, https://substackcdn.com/image/fetch/$s_!QfD7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21654ae3-b968-408d-b625-24be8fcf7156_4800x3400.png 1272w, https://substackcdn.com/image/fetch/$s_!QfD7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21654ae3-b968-408d-b625-24be8fcf7156_4800x3400.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!QfD7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21654ae3-b968-408d-b625-24be8fcf7156_4800x3400.png" width="682" height="482.9271978021978" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/21654ae3-b968-408d-b625-24be8fcf7156_4800x3400.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1031,&quot;width&quot;:1456,&quot;resizeWidth&quot;:682,&quot;bytes&quot;:1161420,&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://systemdr.systemdrd.com/i/217794108?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21654ae3-b968-408d-b625-24be8fcf7156_4800x3400.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_!QfD7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21654ae3-b968-408d-b625-24be8fcf7156_4800x3400.png 424w, https://substackcdn.com/image/fetch/$s_!QfD7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21654ae3-b968-408d-b625-24be8fcf7156_4800x3400.png 848w, https://substackcdn.com/image/fetch/$s_!QfD7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21654ae3-b968-408d-b625-24be8fcf7156_4800x3400.png 1272w, https://substackcdn.com/image/fetch/$s_!QfD7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21654ae3-b968-408d-b625-24be8fcf7156_4800x3400.png 1456w" sizes="auto, 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 buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><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><strong>What Operational Transformation actually does</strong></h3><p>Each edit is represented as an operation: <code>insert(position, character)</code> or <code>delete(position)</code>. When two operations are generated concurrently &#8212; before either user has seen the other&#8217;s edit &#8212; they must be <em>transformed</em> against each other before both can be applied.</p><p>The classic example: document is &#8220;Hello.&#8221; User A inserts &#8220; World&#8221; at position 5. User B simultaneously inserts &#8220;!&#8221; at position 5.</p><p>After A&#8217;s operation, position 5 has shifted &#8212; &#8220;!&#8221; should now be inserted at position 11. The transform function adjusts B&#8217;s operation before applying it. Result: &#8220;Hello World!&#8221;</p><p>The server maintains a history of all operations. When it receives an operation, it transforms that operation against all operations the client hasn&#8217;t yet seen, then broadcasts the transformed version to all clients. The document converges to the same state on all clients.</p><h3><strong>Why this matters for questions you will get asked</strong></h3><p>Understanding OT deeply unlocks several adjacent concepts:</p><p><em>The operation log as a data model.</em> An OT-based system stores operations, not document state. The document is the result of replaying all operations from the beginning. This is event sourcing &#8212; the same pattern used in payment ledgers, audit trails, and any system where history matters more than current state.</p><p><em>The difference between mutable and immutable data models.</em> Most system design candidates default to mutable state (update the row when something changes). The operation log is immutable &#8212; you only ever append. Understanding why immutable append-only logs are often better than mutable state is one of the higher-order concepts in distributed systems.</p><p><em>CRDTs as an alternative.</em> Conflict-free Replicated Data Types solve the same merging problem differently &#8212; by designing data structures where all operations commute (can be applied in any order and produce the same result). Notion uses CRDTs. Google Docs uses OT. Both work.</p><p>If you understand one of these deeply, you understand a design principle that appears in message delivery systems, distributed databases, version control systems, and collaborative tools.</p><p>The Google Docs question is hard because it requires understanding a class of problem &#8212; concurrent state merging &#8212; that doesn&#8217;t appear in most backend engineering work. But once you understand it, you see it everywhere.</p><p>The full walkthrough is in the Vault under Real-Time Messaging. The drill card is the most complex card in the set. Both are there when you&#8217;re ready to go deep.</p><div><hr></div><p><strong>CTA</strong>: The cohort curriculum is built around closing exactly these three gaps &#8212; state merging, immutable operation logs, and real-time OT mechanics</p><h2><strong>Subscription link</strong></h2><p><a href="https://systemdr.systemdrd.com/subscribe">https://systemdr.systemdrd.com/subscribe</a></p><p><strong>The deeper concepts start where this lesson ends.</strong> </p><p>Explore the premium content for advanced techniques and system-level thinking.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.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">System Design Interview Roadmap is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</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[LangChain & LlamaIndex Internal Architecture: How Orchestration Frameworks Work]]></title><description><![CDATA[A team at a 30-person fintech startup wires up a LangChain agent to answer support tickets: check account balance, look up a transaction, escalate if fraud-flagged.]]></description><link>https://systemdr.systemdrd.com/p/langchain-and-llamaindex-internal</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/langchain-and-llamaindex-internal</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Fri, 02 Oct 2026 03:30:45 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!jewF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d4f2238-8921-4f2a-94ed-e5c3af6a9694_4000x2640.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote><p>A team at a 30-person fintech startup wires up a LangChain agent to answer support tickets: check account balance, look up a transaction, escalate if fraud-flagged. Day two in production, one agent run calls the &#8220;check balance&#8221; tool 41 times in a row before the request times out at 60 seconds. Nobody touched the code. The model just got stuck restating the same thought and re-invoking the same tool, and the framework had no built-in ceiling to stop it. That&#8217;s not a bug report you&#8217;ll find in the docs. It&#8217;s the default behavior of an orchestration loop with no guardrails, and it&#8217;s why understanding what&#8217;s actually happening under <code>AgentExecutor.invoke()</code> matters more than knowing the API surface.</p></blockquote><h2>The Core Mechanism</h2><p>Strip away the abstractions and both frameworks are doing the same basic thing: turning a sequence of LLM calls, tool calls, and data transformations into a graph, then walking that graph. LangChain&#8217;s LCEL (LangChain Expression Language) builds this as a <strong>static DAG</strong> &#8212; you pipe a prompt into a model into an output parser using the <code>|</code> operator, and the shape of that graph is fixed at definition time. A chain built this way runs the same three or four nodes every time, in the same order, regardless of input. That&#8217;s a chain, and it&#8217;s the easy 80% case.</p><p>Agents are different, and this is where most of the confusion (and most of the production incidents) live. An agent doesn&#8217;t have a fixed graph. Instead, it runs a <strong>loop</strong>: the LLM receives the user&#8217;s goal plus a scratchpad of everything done so far, decides what to do next, and the framework parses that decision, executes it, appends the result to the scratchpad, and calls the LLM again. This is the ReAct pattern (Reason + Act) that both LangChain&#8217;s <code>AgentExecutor</code> and LlamaIndex&#8217;s <code>ReActAgent</code> implement almost identically under different class names. The graph is decided at runtime, one node at a time, by the model itself.</p><p>LlamaIndex frames this slightly differently at the retrieval layer. Its <code>QueryEngine</code> abstraction splits the pipeline into a <strong>retriever</strong> (fetch candidate nodes from a vector index), a <strong>node postprocessor</strong> chain (rerank, filter by similarity threshold, deduplicate), and a <strong>response synthesizer</strong> (combine retrieved chunks into a final answer, using strategies like <code>compact</code> &#8212; stuff everything into one prompt &#8212; or <code>tree_summarize</code> &#8212; recursively summarize in a binary-tree pattern when context won&#8217;t fit). Each stage is swappable, which is the actual value proposition: you&#8217;re not buying &#8220;RAG,&#8221; you&#8217;re buying a slot machine of interchangeable retrieval and synthesis strategies you can A/B test without rewriting glue code.</p><p>The part vendors don&#8217;t advertise: the output parser sitting between &#8220;LLM emits text&#8221; and &#8220;framework executes an action&#8221; is doing enormous, fragile work. The LLM outputs a string. Something has to turn <code>Action: search_transactions\nAction Input: {"account_id": "4471"}</code> into an actual Python function call with actual arguments. That parser is a regex or a JSON-mode contract, and it breaks constantly &#8212; trailing commas, an extra sentence before the JSON blob, a tool name the model slightly misremembers. When it breaks, the default behavior in most setups isn&#8217;t to fail loudly. It&#8217;s to catch the exception, shove &#8220;Invalid format, try again&#8221; back into the scratchpad, and loop. That&#8217;s your 41-call incident.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jewF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d4f2238-8921-4f2a-94ed-e5c3af6a9694_4000x2640.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jewF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d4f2238-8921-4f2a-94ed-e5c3af6a9694_4000x2640.png 424w, https://substackcdn.com/image/fetch/$s_!jewF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d4f2238-8921-4f2a-94ed-e5c3af6a9694_4000x2640.png 848w, https://substackcdn.com/image/fetch/$s_!jewF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d4f2238-8921-4f2a-94ed-e5c3af6a9694_4000x2640.png 1272w, https://substackcdn.com/image/fetch/$s_!jewF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d4f2238-8921-4f2a-94ed-e5c3af6a9694_4000x2640.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jewF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d4f2238-8921-4f2a-94ed-e5c3af6a9694_4000x2640.png" width="1456" height="961" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9d4f2238-8921-4f2a-94ed-e5c3af6a9694_4000x2640.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:961,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1552407,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://systemdr.systemdrd.com/i/213502681?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d4f2238-8921-4f2a-94ed-e5c3af6a9694_4000x2640.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_!jewF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d4f2238-8921-4f2a-94ed-e5c3af6a9694_4000x2640.png 424w, https://substackcdn.com/image/fetch/$s_!jewF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d4f2238-8921-4f2a-94ed-e5c3af6a9694_4000x2640.png 848w, https://substackcdn.com/image/fetch/$s_!jewF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d4f2238-8921-4f2a-94ed-e5c3af6a9694_4000x2640.png 1272w, https://substackcdn.com/image/fetch/$s_!jewF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d4f2238-8921-4f2a-94ed-e5c3af6a9694_4000x2640.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><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 href="https://systemdr.systemdrd.com/p/langchain-and-llamaindex-internal">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Design an API Gateway — Walkthrough]]></title><description><![CDATA[Archetype: Infrastructure & Platform &#183; Asked at: AWS, Kong, Google Apigee]]></description><link>https://systemdr.systemdrd.com/p/design-an-api-gateway-walkthrough</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/design-an-api-gateway-walkthrough</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Tue, 29 Sep 2026 03:30:41 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!D5qe!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84a1a46d-5c7d-427c-9f46-98af2858ff1f_5000x2600.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2><span>The probe</span></h2><blockquote><p><span>The API gateway is a cross-cutting infrastructure component that every FAANG-tier system uses. The question tests whether you understand authentication, rate limiting, routing, and load balancing as composable middleware layers &#8212; and what the operational challenges are when this component is in the critical path of every API call.</span></p></blockquote><h2><span>Step 1 &#8212; Clarify</span></h2><p><span>- What features: auth, rate limiting, routing, load balancing, caching, request transformation, observability?</span></p><p><span>- Scale: 1M req/sec aggregate across all upstream services</span></p><p><span>- Multi-tenant (different customers, different routing rules) or single-tenant? - SLO: gateway latency overhead &lt; 5ms p99 (adds &lt; 5ms to every request)</span></p><h2><span>Step 2 &#8212; Architecture</span></h2><p><strong><span>The middleware chain (executed in order for every request):</span></strong></p><p><span>1. </span><strong><span>TLS termination </span></strong><span>&#8212; decrypt HTTPS at the gateway; upstream services communicate in plaintext within the datacenter</span></p><p><span>2. </span><strong><span>Authentication </span></strong><span>&#8212; validate API key or JWT token. Token validation: symmetric JWT (verify signature with shared secret, ~0.5ms) or asymmetric (fetch public key from auth service &#8212; cache aggressively, 24h TTL)</span></p><p><span>3. </span><strong><span>Rate limiting </span></strong><span>&#8212; per API key, per endpoint, sliding window counter in Redis (see Rate Limiter walkthrough)</span></p><p><span>4. </span><strong><span>Request routing </span></strong><span>&#8212; match URL pattern to upstream service. Stored in a routing table (Redis or in-memory hash map, updated via config push)</span></p><p><span>5. </span><strong><span>Load balancing </span></strong><span>&#8212; pick a healthy upstream instance (round-robin, least-connections, or consistent hash for sticky sessions)</span></p><p><span>6. </span><strong><span>Request forwarding </span></strong><span>&#8212; proxy the request to the upstream; handle upstream timeout and retry</span></p><p><span>7. </span><strong><span>Response transformation </span></strong><span>&#8212; add CORS headers, strip internal headers, compress response</span></p><p><span>8. </span><strong><span>Observability </span></strong><span>&#8212; emit request log, latency metric, status code metric to monitoring pipeline</span></p><p><strong><span>Configuration plane: </span></strong><span>Routing rules, rate limits, auth policies are stored in a config database (etcd or Postgres) and pushed to gateway instances via pub-sub. Gateways cache config in-memory; config staleness of 30 seconds is acceptable.</span></p><p><strong><span>Health checking: </span></strong><span>Gateway maintains a health map of all upstream instances. Active health checks (HTTP probe every 5s) + passive health checks (circuit breaker on error rate). Unhealthy instances removed from the load balancing pool.</span></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.com/subscribe&quot;,&quot;text&quot;:&quot;Get Access to GitHub Repo&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://systemdr.systemdrd.com/subscribe"><span>Get Access to GitHub Repo</span></a></p>
      <p>
          <a href="https://systemdr.systemdrd.com/p/design-an-api-gateway-walkthrough">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[India Engineers Targeting FAANG: What's Different and What Isn't]]></title><description><![CDATA[The system design interview is the same interview in Bangalore as it is in San Francisco.]]></description><link>https://systemdr.systemdrd.com/p/india-engineers-targeting-faang-whats</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/india-engineers-targeting-faang-whats</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Sun, 27 Sep 2026 03:30:34 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!jw9P!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb743259e-452a-4881-85ef-a75d5b6732ef_4000x2400.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The system design interview is the same interview in Bangalore as it is in San Francisco. The questions, the rubric, the archetypes &#8212; identical. An L5 system design answer in India is an L5 system design answer anywhere.</p><p>But the path to the interview room, the logistics surrounding it, and the context after an offer are different in ways that matter. Here&#8217;s what actually differs.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.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">System Design Interview Roadmap is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</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 class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jw9P!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb743259e-452a-4881-85ef-a75d5b6732ef_4000x2400.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jw9P!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb743259e-452a-4881-85ef-a75d5b6732ef_4000x2400.png 424w, https://substackcdn.com/image/fetch/$s_!jw9P!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb743259e-452a-4881-85ef-a75d5b6732ef_4000x2400.png 848w, https://substackcdn.com/image/fetch/$s_!jw9P!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb743259e-452a-4881-85ef-a75d5b6732ef_4000x2400.png 1272w, https://substackcdn.com/image/fetch/$s_!jw9P!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb743259e-452a-4881-85ef-a75d5b6732ef_4000x2400.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jw9P!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb743259e-452a-4881-85ef-a75d5b6732ef_4000x2400.png" width="1456" height="874" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b743259e-452a-4881-85ef-a75d5b6732ef_4000x2400.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;:2495160,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://systemdr.systemdrd.com/i/216841786?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb743259e-452a-4881-85ef-a75d5b6732ef_4000x2400.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_!jw9P!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb743259e-452a-4881-85ef-a75d5b6732ef_4000x2400.png 424w, https://substackcdn.com/image/fetch/$s_!jw9P!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb743259e-452a-4881-85ef-a75d5b6732ef_4000x2400.png 848w, https://substackcdn.com/image/fetch/$s_!jw9P!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb743259e-452a-4881-85ef-a75d5b6732ef_4000x2400.png 1272w, https://substackcdn.com/image/fetch/$s_!jw9P!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb743259e-452a-4881-85ef-a75d5b6732ef_4000x2400.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><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><strong>What&#8217;s genuinely different</strong></h3><p><em>The remote-first hiring pipeline.</em> Most FAANG-tier companies now conduct all interviews remotely. This is an advantage for India-based engineers &#8212; you&#8217;re no longer at a geographic disadvantage for the initial loop. The downside: time zones. A loop with a US-based company typically means some interviews between 7:30 PM and midnight IST. This is worth planning around &#8212; don&#8217;t schedule a round at midnight if you have a critical work deadline the next morning.</p><p><em>Level calibration.</em> A &#8220;Senior Engineer&#8221; at a well-regarded Indian tech company (Flipkart, Meesho, Swiggy, Juspay) maps to L4&#8211;L5 at Google/Meta depending on tenure and scope. An &#8220;architect&#8221; or &#8220;lead&#8221; at a larger Indian IT firm (Infosys, Wipro, TCS) typically maps to L4. This isn&#8217;t a judgment &#8212; it&#8217;s a calibration issue. Know your actual level going into the interview, not just your title.</p><p><em>The PPP pricing reality.</em> FAANG-tier base salaries for India-based roles are significantly lower than their US equivalents &#8212; typically &#8377;40L&#8211;&#8377;1.2Cr TC for L4&#8211;L6, versus $200K&#8211;$600K TC in the US for equivalent levels. This is expected and not negotiable in the same way US offers are. The negotiating leverage for India-based roles is typically in joining bonus and ESOP vesting schedules, not base.</p><p><em>Visa and relocation.</em> If you&#8217;re targeting a US relocation, the current H-1B backlog for Indian nationals is 10&#8211;15 years. This is a real constraint. Some engineers time their loop specifically to target companies with large India offices or a clear path to a Canada/Singapore transfer as an intermediate step. Worth being explicit about your relocation preferences early in the recruiter conversation, not after the offer.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!V8H8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F096c43f3-d3e0-4681-8031-a599fbcc3372_4000x2600.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!V8H8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F096c43f3-d3e0-4681-8031-a599fbcc3372_4000x2600.png 424w, https://substackcdn.com/image/fetch/$s_!V8H8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F096c43f3-d3e0-4681-8031-a599fbcc3372_4000x2600.png 848w, https://substackcdn.com/image/fetch/$s_!V8H8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F096c43f3-d3e0-4681-8031-a599fbcc3372_4000x2600.png 1272w, https://substackcdn.com/image/fetch/$s_!V8H8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F096c43f3-d3e0-4681-8031-a599fbcc3372_4000x2600.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!V8H8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F096c43f3-d3e0-4681-8031-a599fbcc3372_4000x2600.png" width="654" height="424.9203296703297" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/096c43f3-d3e0-4681-8031-a599fbcc3372_4000x2600.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;:654,&quot;bytes&quot;:1138253,&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://systemdr.systemdrd.com/i/216841786?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F096c43f3-d3e0-4681-8031-a599fbcc3372_4000x2600.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_!V8H8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F096c43f3-d3e0-4681-8031-a599fbcc3372_4000x2600.png 424w, https://substackcdn.com/image/fetch/$s_!V8H8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F096c43f3-d3e0-4681-8031-a599fbcc3372_4000x2600.png 848w, https://substackcdn.com/image/fetch/$s_!V8H8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F096c43f3-d3e0-4681-8031-a599fbcc3372_4000x2600.png 1272w, https://substackcdn.com/image/fetch/$s_!V8H8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F096c43f3-d3e0-4681-8031-a599fbcc3372_4000x2600.png 1456w" sizes="auto, 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 buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><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><strong>What isn&#8217;t different</strong></h3><p><em>The technical bar.</em> Identical. The system design questions are the same. The rubric is the same. The expected depth for L5 in Bangalore is the expected depth for L5 in Seattle.</p><p><em>The preparation path.</em> Identical. Cold drills, walkthroughs, mock interviews with peers. The prep that works in the US works in India. This newsletter covers both.</p><p><em>The failure modes.</em> Identical. Scoping too broadly, communicating at the wrong level, not handling failure modes &#8212; the same mistakes fail the round everywhere.</p><p><em>The timeline pressure.</em> Identical. Most engineers underestimate how long a loop takes. Initial screen, technical screen, onsite loop, offer, negotiation, background check &#8212; 6&#8211;12 weeks is typical. Plan accordingly.</p><h3><strong>One practical difference in preparation</strong></h3><p>The pool of practice partners in India is large but unevenly distributed. Engineers at Flipkart, Meesho, PhonePe, Razorpay, and similar companies have usually seen these interviews and can give calibrated mock feedback. Engineers at service companies may not have. Be deliberate about who you practice with &#8212; the value of a mock is entirely in the quality of the feedback.</p><p>The Discord has a regional channel specifically for India-based members. The <code>#india</code> channel is where timezone coordination, India-specific company intel, and INR pricing questions go. Post there if you&#8217;re looking for mock partners in IST.</p><h3><strong>The INR pricing</strong></h3><p>This newsletter&#8217;s paid content is available at &#8377;399/month or &#8377;2,999/year. The Vault is &#8377;9,999. The Cohort is &#8377;49,999. These are PPP-adjusted prices &#8212; the same content, different checkout link. Email with subject &#8220;INR pricing&#8221; and I&#8217;ll send the local currency link.</p><p>The technical content is identical regardless of which pricing you use.</p><div><hr></div><p><strong>CTA:</strong><span> The cohort curriculum is built around closing exactly these three gaps &#8212; each module targets one of them directly.</span></p><h2><strong>Subscription link</strong></h2><p><a href="https://systemdr.systemdrd.com/subscribe">https://systemdr.systemdrd.com/subscribe</a></p><p>&#8212;Sumedh</p><p><strong>The free lesson gives you the overview.</strong> </p><p>The premium version shows you exactly how to apply it step by step</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.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">System Design Interview Roadmap is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</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[Quantization & Pruning — Optimizing Models for Edge Deployment]]></title><description><![CDATA[Section 9: AI & LLM Infrastructure]]></description><link>https://systemdr.systemdrd.com/p/quantization-and-pruning-optimizing</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/quantization-and-pruning-optimizing</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Fri, 25 Sep 2026 08:30:46 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!fiXZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc13ad095-37ee-4351-adc7-a2f25b82d584_4000x2640.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote><p><strong>Date Notice:</strong> Today is September 25, 2026. This article reflects knowledge verified through January 2026. Specific benchmark numbers, chip specs, and framework version details should be checked against current vendor documentation before you cite them anywhere serious.</p></blockquote><div><hr></div><p>A Pixel phone running a 7B parameter model on-device sounds impossible until you check the math twice. Full precision, that model needs 28GB of memory just to hold the weights &#8212; more RAM than the phone has, period. Ship the same model at 4-bit precision and it drops to roughly 3.5GB. Suddenly it fits, with room left for the KV cache and the rest of the OS. Nothing about the model&#8217;s architecture changed. The numbers representing its weights got smaller. That&#8217;s quantization, and it&#8217;s the reason on-device AI stopped being a demo and started being a product category.</p><h2>Two Different Knives</h2><p>Quantization and pruning both shrink a model, but they cut in different places, and conflating them causes real design mistakes.</p><p><strong>Quantization</strong> reduces the numerical precision used to store and compute weights and activations &#8212; typically FP32 or BF16 down to INT8, INT4, or even lower. A weight of 0.7328491 stored in FP32 takes 32 bits. Quantized to INT8 with a scale factor, it might round to a value representable in 8 bits, reconstructed at inference as <code>scale &#215; int_value</code>. You lose precision, not parameters. The model keeps every neuron, every connection &#8212; they just get expressed more coarsely.</p><p><strong>Pruning</strong> removes parameters entirely. Unstructured pruning zeroes out individual weights below some magnitude threshold, producing a sparse matrix. Structured pruning removes whole channels, attention heads, or layers, which is the version that actually speeds things up on standard hardware, because unstructured sparsity needs specialized kernels (NVIDIA&#8217;s 2:4 sparsity on Ampere+ GPUs being the main mainstream exception) to translate into real latency wins. Without that hardware support, an unstructured-pruned model still runs the same dense matmuls, just with a lot of the multiplications wasted on zeros.</p><p>The two compose. A common pipeline: prune a model structurally to cut parameter count 30-40%, fine-tune to recover accuracy, then quantize the survivors to INT8 or INT4 for the final size and latency win. Doing it in the other order &#8212; quantize then prune &#8212; usually produces worse results, because pruning decisions made on a lower-precision model are less reliable; small weight magnitudes get harder to distinguish from quantization noise.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!fiXZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc13ad095-37ee-4351-adc7-a2f25b82d584_4000x2640.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fiXZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc13ad095-37ee-4351-adc7-a2f25b82d584_4000x2640.png 424w, https://substackcdn.com/image/fetch/$s_!fiXZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc13ad095-37ee-4351-adc7-a2f25b82d584_4000x2640.png 848w, https://substackcdn.com/image/fetch/$s_!fiXZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc13ad095-37ee-4351-adc7-a2f25b82d584_4000x2640.png 1272w, https://substackcdn.com/image/fetch/$s_!fiXZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc13ad095-37ee-4351-adc7-a2f25b82d584_4000x2640.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!fiXZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc13ad095-37ee-4351-adc7-a2f25b82d584_4000x2640.png" width="640" height="422.4175824175824" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c13ad095-37ee-4351-adc7-a2f25b82d584_4000x2640.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:961,&quot;width&quot;:1456,&quot;resizeWidth&quot;:640,&quot;bytes&quot;:1815700,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://systemdr.systemdrd.com/i/210712514?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc13ad095-37ee-4351-adc7-a2f25b82d584_4000x2640.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_!fiXZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc13ad095-37ee-4351-adc7-a2f25b82d584_4000x2640.png 424w, https://substackcdn.com/image/fetch/$s_!fiXZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc13ad095-37ee-4351-adc7-a2f25b82d584_4000x2640.png 848w, https://substackcdn.com/image/fetch/$s_!fiXZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc13ad095-37ee-4351-adc7-a2f25b82d584_4000x2640.png 1272w, https://substackcdn.com/image/fetch/$s_!fiXZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc13ad095-37ee-4351-adc7-a2f25b82d584_4000x2640.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><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 href="https://systemdr.systemdrd.com/p/quantization-and-pruning-optimizing">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Design a Metrics Monitoring System (Datadog) — Walkthrough]]></title><description><![CDATA[Archetype: Infrastructure & Platform &#183; Asked at: Datadog, Google (Monarch), Meta (ODS)]]></description><link>https://systemdr.systemdrd.com/p/design-a-metrics-monitoring-system</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/design-a-metrics-monitoring-system</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Tue, 22 Sep 2026 03:30:49 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!IXAG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6b05f3-aa06-4d80-810f-944a8f5020be_5750x4750.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2><span>The probe</span></h2><blockquote><p><span>Time-series data at massive scale. The interesting problem is write throughput (millions of metrics per second from thousands of servers) vs query throughput (interactive dashboards needing sub-second response over months of data). These two requirements pull the architecture in opposite directions &#8212; you optimize writes by sequential append, you optimize range queries by pre-aggregation.</span></p></blockquote><h2><span>Step 1 &#8212; Clarify</span></h2><p><span>- What types of data: metrics (numeric time-series), logs (text events), traces (distributed request spans)? Scope to metrics.</span></p><p><span>- Ingestion rate: 1M metrics/sec (single large deployment)</span></p><p><span>- Query SLO: dashboard queries over last 24h should return in &lt; 2 seconds - Retention: 15-second resolution for 24h, 1-minute resolution for 30 days, 1-hour resolution for 2 years</span></p><p><span>- Alerting required? (Yes &#8212; threshold-based and anomaly-detection alerts)</span></p><h2><span>Step 2 &#8212; Estimate</span></h2><p><span>- 1M metrics/sec &#215; 8 bytes/datapoint = 8 MB/sec write throughput</span></p><p><span>- At 15-second resolution: 1M &#215; 4 datapoints/min &#215; 60min &#215; 24h = 5.8B datapoints/day - At 8 bytes/point: 46 GB/day raw. Over 30 days: 1.4 TB</span></p><p><span>- With rollup (15s &#8594; 1min &#8594; 1h): ~50GB/month per compression tier</span></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.com/subscribe&quot;,&quot;text&quot;:&quot;Get Access to GitHub Repo&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://systemdr.systemdrd.com/subscribe"><span>Get Access to GitHub Repo</span></a></p><h2><span>Step 3 &#8212; Data Model</span></h2><p><strong><span>Time-series storage: </span></strong><span>Each metric is identified by a </span><strong><span>metric name + tag set </span></strong><span>(e.g., cpu.usage{host=web-01, region=us-east}). Stored as:</span></p><p><span>- Metric metadata: metric_id &#8594; {name, tags, retention_policy}</span></p><p><span>- Datapoints: (metric_id, timestamp) &#8594; value &#8212; ordered by timestamp, stored in a write-optimized time-series DB (InfluxDB, Prometheus TSDB, or custom LSM-tree)</span></p><p><strong><span>Rollup tables: </span></strong><span>Three separate tables &#8212; raw (15s resolution), hourly (pre-aggregated to 1-minute), daily (pre-aggregated to 1-hour). Background jobs roll raw data up periodically, dropping the raw data after the retention window.</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_!IXAG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6b05f3-aa06-4d80-810f-944a8f5020be_5750x4750.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IXAG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6b05f3-aa06-4d80-810f-944a8f5020be_5750x4750.png 424w, https://substackcdn.com/image/fetch/$s_!IXAG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6b05f3-aa06-4d80-810f-944a8f5020be_5750x4750.png 848w, https://substackcdn.com/image/fetch/$s_!IXAG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6b05f3-aa06-4d80-810f-944a8f5020be_5750x4750.png 1272w, https://substackcdn.com/image/fetch/$s_!IXAG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6b05f3-aa06-4d80-810f-944a8f5020be_5750x4750.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!IXAG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6b05f3-aa06-4d80-810f-944a8f5020be_5750x4750.png" width="628" height="518.8763736263736" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6d6b05f3-aa06-4d80-810f-944a8f5020be_5750x4750.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1203,&quot;width&quot;:1456,&quot;resizeWidth&quot;:628,&quot;bytes&quot;:4486907,&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://systemdr.systemdrd.com/i/214112046?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6b05f3-aa06-4d80-810f-944a8f5020be_5750x4750.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_!IXAG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6b05f3-aa06-4d80-810f-944a8f5020be_5750x4750.png 424w, https://substackcdn.com/image/fetch/$s_!IXAG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6b05f3-aa06-4d80-810f-944a8f5020be_5750x4750.png 848w, https://substackcdn.com/image/fetch/$s_!IXAG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6b05f3-aa06-4d80-810f-944a8f5020be_5750x4750.png 1272w, https://substackcdn.com/image/fetch/$s_!IXAG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6b05f3-aa06-4d80-810f-944a8f5020be_5750x4750.png 1456w" sizes="auto, 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 buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><blockquote></blockquote><div class="callout-block" data-callout="true"><p><span>Preparing for a distributed systems interview?</span><br><span>&#8594;</span><a href="https://systemdrd.com/ebooks/sdcourse-distributed-systems-interview">Download the free Interview Pack</a><br><span>&#8594; </span><a href="https://systemdr.systemdrd.com/subscribe">Subscribe</a><span> now to access source code repository - 200 + coding lessons</span></p></div>
      <p>
          <a href="https://systemdr.systemdrd.com/p/design-a-metrics-monitoring-system">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Message Queues: Kafka vs SQS vs Task Queue]]></title><description><![CDATA[Three technologies for moving work between services.]]></description><link>https://systemdr.systemdrd.com/p/message-queues-kafka-vs-sqs-vs-task</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/message-queues-kafka-vs-sqs-vs-task</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Sun, 20 Sep 2026 03:30:25 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!AWQw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e3ce558-fc5b-4983-8a64-c4f3883e5103_4000x3120.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Three technologies for moving work between services. Frequently confused. Used interchangeably in interview answers. Rarely the same answer in production.</p><p>Here&#8217;s how to tell them apart and when to reach for each one.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.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">System Design Interview Roadmap is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</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><p><strong>What they have in common</strong></p><blockquote><p>All three decouple producers from consumers. Instead of Service A calling Service B directly, A puts a message somewhere and B reads it when it&#8217;s ready. This makes A and B independently scalable, independently deployable, and independently failure-tolerant.</p></blockquote><p>The decoupling is the shared property. Everything else differs.</p><h3><strong>Kafka: streaming and fan-out</strong></h3><p>Kafka is a distributed log. Producers append messages to topics. Consumers read from topics at their own pace. Messages are retained for a configurable period (days or weeks), regardless of whether anyone has read them.</p><h3>The key properties that distinguish Kafka:</h3><p><em>Replay.</em> A consumer can re-read old messages. If you deploy a new service and need to process all historical events, Kafka lets you rewind to the beginning. SQS and task queues don&#8217;t.</p><p><em>Fan-out.</em> Multiple independent consumer groups can read the same topic simultaneously. Each group maintains its own offset. Service A and Service B can both consume the same stream of events without interfering with each other. SQS and task queues don&#8217;t support this natively.</p><p><em>Ordering.</em> Messages within a partition are strictly ordered. If order matters &#8212; event sourcing, audit logs, ledger updates &#8212; Kafka preserves it.</p><p>Use Kafka when: you have multiple consumers that need to read the same events, you need replay capability, you&#8217;re building a streaming pipeline where order matters, or you need to decouple high-throughput event producers from slower consumers.</p><p>Don&#8217;t use Kafka when: you need guaranteed exactly-once delivery of individual work items to exactly one worker, or when you have a small team that can&#8217;t operationally support a Kafka cluster.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.com/subscribe&quot;,&quot;text&quot;:&quot;Subscribe for Question Walkthroughs&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://systemdr.systemdrd.com/subscribe"><span>Subscribe for Question Walkthroughs</span></a></p><h3><strong>SQS: simple at-least-once work distribution</strong></h3><p>SQS is a managed queue. A producer enqueues a message. A consumer polls, processes, and deletes it. The message is invisible to other consumers during processing (the visibility timeout). If the consumer crashes, the message reappears.</p><h4>The key properties:</h4><p><em>Simplicity.</em> Fully managed by AWS. No cluster to operate. You pay per message.</p><p><em>At-least-once delivery.</em> Each message is delivered to at least one consumer. Duplicates are possible (rare but possible). Your consumer must be idempotent.</p><p><em>One consumer per message.</em> Each message is processed by exactly one consumer group. No fan-out. If you need multiple services to process the same message, you need SNS in front of SQS (one topic, multiple queues).</p><p>Use SQS when: you need a simple, reliable queue for distributing work to a pool of workers, you&#8217;re on AWS, and you don&#8217;t need replay or fan-out.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!AWQw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e3ce558-fc5b-4983-8a64-c4f3883e5103_4000x3120.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AWQw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e3ce558-fc5b-4983-8a64-c4f3883e5103_4000x3120.png 424w, https://substackcdn.com/image/fetch/$s_!AWQw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e3ce558-fc5b-4983-8a64-c4f3883e5103_4000x3120.png 848w, https://substackcdn.com/image/fetch/$s_!AWQw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e3ce558-fc5b-4983-8a64-c4f3883e5103_4000x3120.png 1272w, https://substackcdn.com/image/fetch/$s_!AWQw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e3ce558-fc5b-4983-8a64-c4f3883e5103_4000x3120.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!AWQw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e3ce558-fc5b-4983-8a64-c4f3883e5103_4000x3120.png" width="652" height="508.7032967032967" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0e3ce558-fc5b-4983-8a64-c4f3883e5103_4000x3120.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1136,&quot;width&quot;:1456,&quot;resizeWidth&quot;:652,&quot;bytes&quot;:908726,&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://systemdr.systemdrd.com/i/213817200?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e3ce558-fc5b-4983-8a64-c4f3883e5103_4000x3120.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_!AWQw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e3ce558-fc5b-4983-8a64-c4f3883e5103_4000x3120.png 424w, https://substackcdn.com/image/fetch/$s_!AWQw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e3ce558-fc5b-4983-8a64-c4f3883e5103_4000x3120.png 848w, https://substackcdn.com/image/fetch/$s_!AWQw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e3ce558-fc5b-4983-8a64-c4f3883e5103_4000x3120.png 1272w, https://substackcdn.com/image/fetch/$s_!AWQw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e3ce558-fc5b-4983-8a64-c4f3883e5103_4000x3120.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 buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><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><strong>Task queues (Celery, Redis Queue, Postgres FOR UPDATE SKIP LOCKED)</strong></h3><p>Task queues are purpose-built for job execution. A task has a type, a payload, a status, a retry count, and a deadline. Workers claim tasks atomically, process them, and mark them complete. Failed tasks retry with backoff.</p><p>The key properties:</p><p><em>Task lifecycle management.</em> Task queues track the status of individual work items. You can query &#8220;which tasks are in progress right now&#8221; or &#8220;which tasks have failed more than 3 times.&#8221; Kafka and SQS don&#8217;t natively track per-item status.</p><p><em>Retry with backoff.</em> If a task fails, it&#8217;s retried after an exponential delay. Dead-letter queuing for tasks that fail past the max retry count. This is the production pattern for background job processing.</p><p><em>Priority.</em> Tasks can have priority levels. High-priority tasks jump the queue. Standard queues don&#8217;t support this natively.</p><p>Use a task queue when: you&#8217;re running background jobs (email sending, image processing, report generation), you need per-task status visibility, you need retry with backoff, or you need priority queuing.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5mvz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e1c70c-ce82-4017-b008-f620f6bcc2c9_4000x3280.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5mvz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e1c70c-ce82-4017-b008-f620f6bcc2c9_4000x3280.png 424w, https://substackcdn.com/image/fetch/$s_!5mvz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e1c70c-ce82-4017-b008-f620f6bcc2c9_4000x3280.png 848w, https://substackcdn.com/image/fetch/$s_!5mvz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e1c70c-ce82-4017-b008-f620f6bcc2c9_4000x3280.png 1272w, https://substackcdn.com/image/fetch/$s_!5mvz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e1c70c-ce82-4017-b008-f620f6bcc2c9_4000x3280.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5mvz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e1c70c-ce82-4017-b008-f620f6bcc2c9_4000x3280.png" width="660" height="541.2362637362637" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/36e1c70c-ce82-4017-b008-f620f6bcc2c9_4000x3280.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1194,&quot;width&quot;:1456,&quot;resizeWidth&quot;:660,&quot;bytes&quot;:993658,&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://systemdr.systemdrd.com/i/213817200?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e1c70c-ce82-4017-b008-f620f6bcc2c9_4000x3280.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_!5mvz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e1c70c-ce82-4017-b008-f620f6bcc2c9_4000x3280.png 424w, https://substackcdn.com/image/fetch/$s_!5mvz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e1c70c-ce82-4017-b008-f620f6bcc2c9_4000x3280.png 848w, https://substackcdn.com/image/fetch/$s_!5mvz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e1c70c-ce82-4017-b008-f620f6bcc2c9_4000x3280.png 1272w, https://substackcdn.com/image/fetch/$s_!5mvz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e1c70c-ce82-4017-b008-f620f6bcc2c9_4000x3280.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 buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><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><strong>The interview decision</strong></h3><p>In a system design interview, the choice should follow from the requirement:</p><p>Need multiple services to react to the same events? &#8594; Kafka<br>Need to offload work from a web request to a background process? &#8594; SQS or task queue<br>Need to build a streaming analytics pipeline? &#8594; Kafka<br>Need to retry failed jobs with backoff and track their status? &#8594; Task queue<br>Need a managed, simple work queue with no infra overhead? &#8594; SQS<br>Need replay capability for new consumers or debugging? &#8594; Kafka</p><p>The mistake to avoid: defaulting to Kafka for everything. Kafka is operationally heavy (unless you&#8217;re using Confluent Cloud or a managed service). For a small-scale job queue, Postgres with <code>FOR UPDATE SKIP LOCKED</code> is simpler, cheaper, and perfectly adequate up to millions of jobs per day.</p><p>State your choice, name the alternative you&#8217;re not using, and explain why. That&#8217;s the format for any technology decision in this category.</p><blockquote><p><strong>CTA:</strong> The full walkthroughs go beyond knowing what Kafka, SQS, or task queues are. They show you how to make the decision in an interview &#8212; what requirement should drive the choice, which alternative to rule out, and how to explain the tradeoff like a Senior vs Staff engineer.</p></blockquote><p>If you found this valuable, the full library includes 52 walkthroughs, bonus lessons, exercises, and detailed interview breakdowns.</p><p><a href="https://systemdr.systemdrd.com/subscribe">https://systemdr.systemdrd.com/subscribe</a></p><div class="callout-block" data-callout="true"><p>The Question Vault has all 52 walkthroughs organized by archetype &#8212; so you can see the pattern across questions, not just the surface answer.</p><p><strong><span>Access all 52 Questions </span><a href="https://systemdrd.com/ebooks/52-faang-questions-drillcards-cheatsheets/">here</a></strong></p></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.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">System Design Interview Roadmap is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</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[A/B Testing for ML Models — Canary Releases and Shadow Mode in Inference]]></title><description><![CDATA[Introduction]]></description><link>https://systemdr.systemdrd.com/p/ab-testing-for-ml-models-canary-releases</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/ab-testing-for-ml-models-canary-releases</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Fri, 18 Sep 2026 08:30:34 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!F7Io!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9b6e255-7ce6-48d8-997f-7fe54957d9c8_4500x2800.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>Introduction</h2><blockquote><p>In March 2023, a fraud-scoring team at a mid-size payments processor pushed a retrained model straight to 100% of transaction traffic on a Friday afternoon. The new model had a better offline AUC &#8212; 0.94 versus 0.91. Nobody checked what that 3-point gain did to the false-positive rate on transactions over $2,000. By Monday, the support queue had 1,400 tickets from customers whose legitimate purchases got blocked, and the on-call engineer spent six hours rolling back a change that took four minutes to deploy. This is the exact failure canary releases and shadow mode exist to prevent.</p></blockquote><h2>Core Concept</h2><blockquote><p><strong>Canary releases</strong> route a small, controlled slice of live traffic to a new model version while the rest keeps hitting the current one. You start at 1% or 5%, watch the metrics that matter &#8212; latency, error rate, business KPIs like approval rate or click-through &#8212; and ramp up in steps: 5% &#8594; 25% &#8594; 50% &#8594; 100%, usually over hours or days, not minutes. If anything degrades past a threshold, you roll back the percentage to zero instead of rolling back a deployment.</p></blockquote><p><strong>Shadow mode</strong> is a different animal. Every request still goes to the production model and that response is what the user gets. But the same request also gets duplicated &#8212; usually via an async fan-out &#8212; and sent to the candidate model in parallel. The candidate&#8217;s output never reaches the user. It gets logged, compared against the production model&#8217;s output, and scored on agreement rate, latency, and resource cost. Shadow mode carries zero user-facing risk, which is exactly why teams underuse canary and overuse shadow when they should combine both.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!F7Io!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9b6e255-7ce6-48d8-997f-7fe54957d9c8_4500x2800.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!F7Io!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9b6e255-7ce6-48d8-997f-7fe54957d9c8_4500x2800.png 424w, https://substackcdn.com/image/fetch/$s_!F7Io!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9b6e255-7ce6-48d8-997f-7fe54957d9c8_4500x2800.png 848w, https://substackcdn.com/image/fetch/$s_!F7Io!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9b6e255-7ce6-48d8-997f-7fe54957d9c8_4500x2800.png 1272w, https://substackcdn.com/image/fetch/$s_!F7Io!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9b6e255-7ce6-48d8-997f-7fe54957d9c8_4500x2800.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!F7Io!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9b6e255-7ce6-48d8-997f-7fe54957d9c8_4500x2800.png" width="630" height="392.0192307692308" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f9b6e255-7ce6-48d8-997f-7fe54957d9c8_4500x2800.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:906,&quot;width&quot;:1456,&quot;resizeWidth&quot;:630,&quot;bytes&quot;:1327071,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://systemdr.systemdrd.com/i/208950736?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9b6e255-7ce6-48d8-997f-7fe54957d9c8_4500x2800.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_!F7Io!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9b6e255-7ce6-48d8-997f-7fe54957d9c8_4500x2800.png 424w, https://substackcdn.com/image/fetch/$s_!F7Io!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9b6e255-7ce6-48d8-997f-7fe54957d9c8_4500x2800.png 848w, https://substackcdn.com/image/fetch/$s_!F7Io!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9b6e255-7ce6-48d8-997f-7fe54957d9c8_4500x2800.png 1272w, https://substackcdn.com/image/fetch/$s_!F7Io!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9b6e255-7ce6-48d8-997f-7fe54957d9c8_4500x2800.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><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 href="https://systemdr.systemdrd.com/p/ab-testing-for-ml-models-canary-releases">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Design a Web Crawler — Walkthrough]]></title><description><![CDATA[Archetype: Search & Ranking &#183; Asked at: Google, Bing, Common Crawl]]></description><link>https://systemdr.systemdrd.com/p/design-a-web-crawler-walkthrough</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/design-a-web-crawler-walkthrough</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Tue, 15 Sep 2026 03:31:14 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!neAR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1c434c6-106d-4b84-a4b3-12c83015274d_5000x4100.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2><span>The probe</span></h2><blockquote><p><span>The web crawler question tests distributed systems breadth: politeness (don&#8217;t hammer a single server), deduplication (don&#8217;t re-crawl the same URL twice), scheduling (recrawl priority), and parsing at scale. The interesting distributed systems problem is managing a frontier of billions of URLs across a cluster of crawlers without duplication.</span></p></blockquote><h2><span>Step 1 &#8212; Clarify</span></h2><div class="callout-block" data-callout="true"><p><span>- Target scale: crawl the whole web (~50B pages) or a specific domain subset? - Recrawl frequency: how often to revisit pages? (Dynamic pages: hourly. Static: weekly.) - What to extract: HTML only, or also images, PDFs, structured data?</span></p><p><span>- Politeness: respect robots.txt? Rate limit per domain?</span></p><p><span>- SLO: crawl 1B pages within 24 hours (requires ~12K pages/sec)</span></p></div><h2><span>Step 2 &#8212; Estimate</span></h2><div class="callout-block" data-callout="true"><p><span>- 50B pages &#215; 500KB average = 25 PB total web</span></p><p><span>- Crawl rate needed: 1B pages/day = ~12K pages/sec</span></p><p><span>- 12K pages/sec &#215; 500KB = 6 GB/sec download bandwidth &#8212; requires hundreds of crawler nodes</span></p><p><span>- URL frontier size: 50B URLs &#215; 50 bytes/URL = 2.5 TB &#8212; too large for RAM, needs disk-backed priority queue</span></p></div><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.com/subscribe&quot;,&quot;text&quot;:&quot;Get Access to GitHub Repo&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://systemdr.systemdrd.com/subscribe"><span>Get Access to GitHub Repo</span></a></p><h2><span>Step 3 &#8212; Key Components</span></h2><p><strong><span>URL Frontier: </span></strong><span>A distributed priority queue of URLs to crawl. Priority based on: page importance (PageRank estimate), content freshness, recrawl deadline. Implemented as a two-level structure: an in-memory heap of high-priority URLs, backed by a disk-based queue (Kafka or a custom LSM-tree store) for the full frontier.</span></p><p><strong><span>Deduplication: </span></strong><span>Before adding a URL to the frontier, check if it&#8217;s already been crawled. Use a Bloom filter (fast, probabilistic, O(1) membership check) to catch already-seen URLs. False positives acceptable (skip a valid URL) but false negatives not (avoid re-crawling). Secondary deduplication: content hash of the fetched page to detect mirror pages.</span></p><p><strong><span>Politeness policy: </span></strong><span>Per-domain rate limiting. Maintain a domain_last_crawled map. Enforce minimum interval between requests to the same domain (e.g., 1 request/sec per domain). Respect robots.txt &#8212; fetch and cache per domain on first visit.</span></p><p><strong><span>DNS pre-resolution: </span></strong><span>DNS lookup adds latency to every fetch. Pre-resolve and cache DNS for all domains in the frontier. TTL-matched to DNS record TTL.</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_!neAR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1c434c6-106d-4b84-a4b3-12c83015274d_5000x4100.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!neAR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1c434c6-106d-4b84-a4b3-12c83015274d_5000x4100.png 424w, https://substackcdn.com/image/fetch/$s_!neAR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1c434c6-106d-4b84-a4b3-12c83015274d_5000x4100.png 848w, https://substackcdn.com/image/fetch/$s_!neAR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1c434c6-106d-4b84-a4b3-12c83015274d_5000x4100.png 1272w, https://substackcdn.com/image/fetch/$s_!neAR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1c434c6-106d-4b84-a4b3-12c83015274d_5000x4100.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!neAR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1c434c6-106d-4b84-a4b3-12c83015274d_5000x4100.png" width="604" height="495.3131868131868" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b1c434c6-106d-4b84-a4b3-12c83015274d_5000x4100.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1194,&quot;width&quot;:1456,&quot;resizeWidth&quot;:604,&quot;bytes&quot;:4959326,&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://systemdr.systemdrd.com/i/213660781?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1c434c6-106d-4b84-a4b3-12c83015274d_5000x4100.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_!neAR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1c434c6-106d-4b84-a4b3-12c83015274d_5000x4100.png 424w, https://substackcdn.com/image/fetch/$s_!neAR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1c434c6-106d-4b84-a4b3-12c83015274d_5000x4100.png 848w, https://substackcdn.com/image/fetch/$s_!neAR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1c434c6-106d-4b84-a4b3-12c83015274d_5000x4100.png 1272w, https://substackcdn.com/image/fetch/$s_!neAR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1c434c6-106d-4b84-a4b3-12c83015274d_5000x4100.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 buttonBase-GK1x3M"><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" class="icon-noB79L"><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 buttonBase-GK1x3M"><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 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><blockquote></blockquote><div class="callout-block" data-callout="true"><p><span>Preparing for a distributed systems interview?</span><br><span>&#8594;</span><a href="https://systemdrd.com/ebooks/sdcourse-distributed-systems-interview">Download the free Interview Pack</a><br><span>&#8594; </span><a href="https://systemdr.systemdrd.com/subscribe">Subscribe</a><span> now to access source code repository - 200 + coding lessons</span></p></div>
      <p>
          <a href="https://systemdr.systemdrd.com/p/design-a-web-crawler-walkthrough">
              Read more
          </a>
      </p>
   ]]></content:encoded></item></channel></rss>