<?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: System Design Walkthrough]]></title><description><![CDATA[52 paid walkthroughs are named with the company that asks them.
Walkthroughs of actual questions asked at named companies (Design TikTok's For You feed at Meta, Design Uber dispatch at Uber, etc.) with the trade-off discussions interviewers probe]]></description><link>https://systemdr.systemdrd.com/s/system-design-walkthrough</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: System Design Walkthrough</title><link>https://systemdr.systemdrd.com/s/system-design-walkthrough</link></image><generator>Substack</generator><lastBuildDate>Tue, 25 Aug 2026 22:11:53 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[Design TikTok For You Feed — Walkthrough ]]></title><description><![CDATA[The probe]]></description><link>https://systemdr.systemdrd.com/p/design-tiktok-for-you-feed-walkthrough</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/design-tiktok-for-you-feed-walkthrough</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Tue, 25 Aug 2026 03:30:38 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!d6yW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3eeb2afb-78f9-4787-a6ca-1266542bf51b_6000x4500.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2><span>The probe</span></h2><blockquote><p><span>The FYF is not a follow-graph feed &#8212; it&#8217;s a recommendation feed. The candidate pool is &#8220;every video ever uploaded&#8221; filtered by ML, not &#8220;videos from accounts you follow.&#8221; Same fan-out and ranking architecture as Twitter Timeline, but the candidate generation layer is completely different.</span></p></blockquote><h2><span>Step 1 &#8212; Clarify</span></h2><p><span>- Follow-graph feed or pure recommendation? (FYF = recommendation &#8212; no follow required)</span></p><p><span>- Short video only (&#8804;60s) or mixed? This drives storage and encoding decisions - Real-time engagement signals (likes, shares, completion rate) must feed back into ranking within minutes &#8212; how fresh?</span></p><p><span>- DAU? (TikTok: ~1B DAU globally)</span></p><p><span>- SLO: next video must load in &lt; 500ms &#8212; the &#8220;infinite scroll&#8221; UX depends on it</span></p><h2><span>Step 2 &#8212; Estimate</span></h2><p><span>- 1B DAU &#215; 40 videos watched/day = 40B video plays/day = ~463K plays/sec - Each user needs a pre-fetched queue of 10&#8211;20 recommended videos to enable instant scroll</span></p><p><span>- Candidate generation per user: rank top 500 from a pool of billions &#8594; return top 20 - Engagement events (play, like, share, skip): ~5 events per video = 200B events/day = 2.3M events/sec feeding the ranking model</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; API Design</span></h2><div class="callout-block" data-callout="true"><p><span>GET /v1/feed/foryou</span></p><p><span>Query: cursor, limit (default 10), device_type</span></p><p><span>Response: { videos: [{video_id, cdn_url, creator, caption, music}], next_cursor, prefetch_next_10: [urls] }</span></p><p><span>POST /v1/engagement</span></p><p><span>Body: { video_id, event_type: &#8220;play&#8221;|&#8221;like&#8221;|&#8221;share&#8221;|&#8221;skip&#8221;|&#8221;complete&#8221;, watch_duration_ms }</span></p></div><p><span>The prefetch_next_10 in the response is the key design signal &#8212; the client pre-fetches the next 10 videos while the user watches the current one, achieving the illusion of instant load.</span></p><h2><span>Step 4 &#8212; Data Model</span></h2><p><span>- </span><strong><span>videos </span></strong><span>table: video_id, creator_id, s3_key, duration_ms, transcript, embedding (vector), tags[], upload_at</span></p><p><span>- </span><strong><span>engagement_events </span></strong><span>(Kafka &#8594; time-series store): user_id, video_id, event_type, watch_pct, timestamp</span></p><p><span>- </span><strong><span>user_interest_profile</span></strong><span>: user_id, topic_vectors[], creator_affinity[], updated_at &#8212; updated continuously from engagement stream</span></p><p><span>- </span><strong><span>video_recommendation_cache </span></strong><span>(Redis): user_id &#8594; [ordered list of 50 pre-ranked video_ids, TTL=10min]</span></p>
      <p>
          <a href="https://systemdr.systemdrd.com/p/design-tiktok-for-you-feed-walkthrough">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[SQL vs NoSQL: How to Choose Without Hedging]]></title><description><![CDATA[&#8220;It depends on the use case.&#8221;]]></description><link>https://systemdr.systemdrd.com/p/sql-vs-nosql-how-to-choose-without</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/sql-vs-nosql-how-to-choose-without</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Sun, 23 Aug 2026 03:30:40 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!aBdb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56c96550-e499-4eaf-8335-75300c695a90_4400x2750.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>&#8220;It depends on the use case.&#8221;</p><p>This phrase ends more system design answers than any other. It sounds thoughtful. It signals nuance. And it is the single most effective way to tell an interviewer you don&#8217;t know how to make a decision.</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>Every technology choice depends on the use case. That&#8217;s not an answer &#8212; it&#8217;s a preamble. The answer is what it depends <em>on</em>, and how you decide.</p><p>Here&#8217;s the decision framework for choosing between relational and non-relational storage that works in an interview setting.</p><p><strong>Step 1: Write down your two hottest queries</strong></p><p>Before naming any storage technology, write down the two or three queries the system will run most frequently. Specifically: what are the inputs, what are the outputs, and what constraints do they have?</p><p>&#8220;Give me all messages for user X, ordered by time&#8221; &#8212; this is a range query on a partition key. Wide-column store handles this well.</p><p>&#8220;Give me all orders for account X with status=pending, joined to the product table&#8221; &#8212; this has a join. Relational database handles this better.</p><p>&#8220;Give me the 10 nearest restaurants within 5km of this coordinate&#8221; &#8212; this is a spatial query. PostGIS or a geohash index.</p><p>The storage decision follows from the query. The query never follows from the storage decision.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!aBdb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56c96550-e499-4eaf-8335-75300c695a90_4400x2750.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aBdb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56c96550-e499-4eaf-8335-75300c695a90_4400x2750.png 424w, https://substackcdn.com/image/fetch/$s_!aBdb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56c96550-e499-4eaf-8335-75300c695a90_4400x2750.png 848w, https://substackcdn.com/image/fetch/$s_!aBdb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56c96550-e499-4eaf-8335-75300c695a90_4400x2750.png 1272w, https://substackcdn.com/image/fetch/$s_!aBdb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56c96550-e499-4eaf-8335-75300c695a90_4400x2750.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aBdb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56c96550-e499-4eaf-8335-75300c695a90_4400x2750.png" width="1456" height="910" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/56c96550-e499-4eaf-8335-75300c695a90_4400x2750.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:910,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:843008,&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/198945504?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56c96550-e499-4eaf-8335-75300c695a90_4400x2750.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_!aBdb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56c96550-e499-4eaf-8335-75300c695a90_4400x2750.png 424w, https://substackcdn.com/image/fetch/$s_!aBdb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56c96550-e499-4eaf-8335-75300c695a90_4400x2750.png 848w, https://substackcdn.com/image/fetch/$s_!aBdb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56c96550-e499-4eaf-8335-75300c695a90_4400x2750.png 1272w, https://substackcdn.com/image/fetch/$s_!aBdb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56c96550-e499-4eaf-8335-75300c695a90_4400x2750.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.com/subscribe&quot;,&quot;text&quot;:&quot;Subscribe for Payments 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 Payments Walkthrough</span></a></p><p><strong>Step 2: Apply the decision rules</strong></p><p>Use a relational database when:</p><ul><li><p>Your data is structured and schema is stable</p></li><li><p>You need ACID transactions across multiple rows or tables</p></li><li><p>Your queries involve joins, aggregations, or complex filtering</p></li><li><p>Your write volume is under roughly 5&#8211;10K writes per second per node</p></li><li><p>Your total data per table is under roughly 100M rows before sharding gets painful</p></li></ul><p>Use a wide-column store (Cassandra, HBase) when:</p><ul><li><p>You need high write throughput (100K+ writes per second)</p></li><li><p>Your queries are predictable and partition-key-based &#8212; no joins, no ad-hoc filtering</p></li><li><p>Your data is naturally time-ordered (events, messages, metrics)</p></li><li><p>You need built-in TTL on rows (messages that expire, session data)</p></li></ul><p>Use a key-value store (Redis, DynamoDB) when:</p><ul><li><p>Your reads are pure point lookups by a single key</p></li><li><p>You need sub-millisecond latency</p></li><li><p>You&#8217;re storing simple values or small objects</p></li><li><p>You need atomic counters or sorted sets</p></li></ul><p>Use object storage (S3) when:</p><ul><li><p>You&#8217;re storing large binary objects (files, images, video, backups)</p></li><li><p>You need very high read throughput via CDN</p></li><li><p>Latency of 50&#8211;200ms per request is acceptable</p></li></ul><p><strong>Step 3: Name the anti-pattern you&#8217;re avoiding</strong></p><p>The most powerful version of a storage decision isn&#8217;t &#8220;I&#8217;d use Cassandra.&#8221; It&#8217;s &#8220;I&#8217;d use Cassandra instead of Postgres here because the write volume &#8212; 50,000 events per second &#8212; will exceed what a single Postgres instance can handle, and the queries are all partition-key-based so I don&#8217;t need the join capability I&#8217;d be giving up.&#8221;</p><p>The comparison forces you to show you considered the alternative. The reason forces you to show you understand the trade-off.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6P6a!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53eff2cc-6409-4619-8ab9-a104b73f9c9f_4400x2750.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6P6a!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53eff2cc-6409-4619-8ab9-a104b73f9c9f_4400x2750.png 424w, https://substackcdn.com/image/fetch/$s_!6P6a!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53eff2cc-6409-4619-8ab9-a104b73f9c9f_4400x2750.png 848w, https://substackcdn.com/image/fetch/$s_!6P6a!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53eff2cc-6409-4619-8ab9-a104b73f9c9f_4400x2750.png 1272w, https://substackcdn.com/image/fetch/$s_!6P6a!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53eff2cc-6409-4619-8ab9-a104b73f9c9f_4400x2750.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6P6a!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53eff2cc-6409-4619-8ab9-a104b73f9c9f_4400x2750.png" width="1456" height="910" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/53eff2cc-6409-4619-8ab9-a104b73f9c9f_4400x2750.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:910,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:843986,&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/198945504?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53eff2cc-6409-4619-8ab9-a104b73f9c9f_4400x2750.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_!6P6a!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53eff2cc-6409-4619-8ab9-a104b73f9c9f_4400x2750.png 424w, https://substackcdn.com/image/fetch/$s_!6P6a!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53eff2cc-6409-4619-8ab9-a104b73f9c9f_4400x2750.png 848w, https://substackcdn.com/image/fetch/$s_!6P6a!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53eff2cc-6409-4619-8ab9-a104b73f9c9f_4400x2750.png 1272w, https://substackcdn.com/image/fetch/$s_!6P6a!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53eff2cc-6409-4619-8ab9-a104b73f9c9f_4400x2750.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>The one rule that overrides everything</strong></p><p>If you need a multi-row ACID transaction &#8212; an operation where either all rows change or none do &#8212; you need a relational database or a relational-compatible distributed database (CockroachDB, Spanner). No amount of Cassandra tuning gives you true ACID across multiple partition keys.</p><p>Payment systems almost always need ACID. Account balances must be updated atomically. Inventory reservation must be atomic. Order creation and payment capture must be atomic.</p><p>&#8220;I&#8217;d use Cassandra for the payment ledger&#8221; is a common answer that fails almost every payment system design question. The interviewer will ask &#8220;what happens if the debit succeeds but the credit fails?&#8221; and there is no good answer with Cassandra.</p><p>Know what you&#8217;re trading away before you trade it.</p><div><hr></div><p><strong>CTA:</strong> The Stripe Payments walkthrough goes deep on exactly this decision &#8212; why the ledger needs ACID, how double-entry accounting makes the atomicity requirement explicit, and what happens at the infrastructure level when you enforce it. Paid post #2. </p><p><strong>Interested in mastering this topic?</strong></p><p>Unlock premium content with deeper explanations and real implementation patterns.</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><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[Design Airbnb Booking System — Walkthrough]]></title><description><![CDATA[The probe]]></description><link>https://systemdr.systemdrd.com/p/design-airbnb-booking-system-walkthrough</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/design-airbnb-booking-system-walkthrough</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Tue, 18 Aug 2026 03:30:26 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!0GhB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ab4b5bf-7b59-42d6-9b17-9f0a5791910b_4750x4500.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2><span>The probe</span></h2><blockquote><p><span>The inventory reservation problem. A listing is available on specific dates, and two users trying to book the same listing for overlapping dates cannot both succeed. The hard problem: prevent double-booking without making the availability check and reservation a single-threaded bottleneck.</span></p></blockquote><h2><span>Step 1 &#8212; Clarify</span></h2><p><span>- Single room per listing (Airbnb) or multiple rooms (hotel)?</span></p><p><span>- Search: by location + date range + filters?</span></p><p><span>- Booking flow: instant book (reserve immediately) or request-to-book (host approves)? - How to handle the &#8220;someone else just booked it&#8221; race condition?</span></p><h2><span>Step 2 &#8212; Data Model</span></h2><p><span>listings: listing_id, host_id, title, location, price_per_night, instant_book (bool) availability: listing_id, date, status (available/blocked/reserved), booking_id (nullable) PRIMARY KEY: (listing_id, date) &#8212; one row per listing per night</span></p><p><span>bookings: booking_id, listing_id, guest_id, check_in, check_out, status</span></p><p><span>(pending/confirmed/cancelled),</span></p><p><span>total_price, idempotency_key, created_at</span></p><p><span>The availability table with one row per listing per night is the key data model decision. Date range availability check = SELECT COUNT(*) FROM availability WHERE listing_id=X AND date BETWEEN check_in AND check_out AND status=&#8217;available&#8217;. If count = (check_out - check_in) in days, all nights are available.</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; Reservation flow (preventing double booking) BEGIN;</span></h2><p><span>-- Check all nights available and lock them</span></p><div class="callout-block" data-callout="true"><p><span>SELECT COUNT(*) FROM availability</span></p><p><span>WHERE listing_id=:lid AND date BETWEEN :check_in AND :check_out</span></p><p><span>AND status=&#8217;available&#8217;</span></p><p><span>FOR UPDATE; -- locks these rows</span></p><p><span>-- If count != nights_requested: ROLLBACK (someone else has them)</span></p><p><span>-- Reserve all nights atomically</span></p><p><span>UPDATE availability SET status=&#8217;reserved&#8217;, booking_id=:booking_id</span></p><p><span>WHERE listing_id=:lid AND date BETWEEN :check_in AND :check_out; -- Create booking record</span></p><p><span>INSERT INTO bookings VALUES (:booking_id, ...);</span></p><p><span>COMMIT;</span></p></div><p><span>The FOR UPDATE lock on the availability rows means only one transaction can proceed for any given listing+date combination. The second concurrent booking attempt blocks, then fails the count check when it finally runs.</span></p>
      <p>
          <a href="https://systemdr.systemdrd.com/p/design-airbnb-booking-system-walkthrough">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[ The Time Management Problem]]></title><description><![CDATA[The most common reason technically strong candidates get a &#8220;Hire&#8221; instead of &#8220;Strong Hire&#8221; is not technical depth.]]></description><link>https://systemdr.systemdrd.com/p/the-time-management-problem</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/the-time-management-problem</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Sun, 16 Aug 2026 03:30:50 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!LHuN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F699b89b4-7c22-4380-a297-6d1a94bc4016_5225x2750.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote><p>The most common reason technically strong candidates get a &#8220;Hire&#8221; instead of &#8220;Strong Hire&#8221; is not technical depth. It&#8217;s running out of time before demonstrating it.</p><p>The deep dive section &#8212; the hard distributed systems problem at the center of the question &#8212; is where L5 separates from L4, and where L6 separates from L5. It&#8217;s also the section that gets cut when the interview runs short. You spent 20 minutes on estimation and API design and now you have 10 minutes left for the architecture and zero for the deep dive.</p></blockquote><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>The fix is specific time checkpoints that you self-enforce in the room. Not approximate &#8212; specific.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LHuN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F699b89b4-7c22-4380-a297-6d1a94bc4016_5225x2750.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LHuN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F699b89b4-7c22-4380-a297-6d1a94bc4016_5225x2750.png 424w, https://substackcdn.com/image/fetch/$s_!LHuN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F699b89b4-7c22-4380-a297-6d1a94bc4016_5225x2750.png 848w, https://substackcdn.com/image/fetch/$s_!LHuN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F699b89b4-7c22-4380-a297-6d1a94bc4016_5225x2750.png 1272w, https://substackcdn.com/image/fetch/$s_!LHuN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F699b89b4-7c22-4380-a297-6d1a94bc4016_5225x2750.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LHuN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F699b89b4-7c22-4380-a297-6d1a94bc4016_5225x2750.png" width="1456" height="766" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/699b89b4-7c22-4380-a297-6d1a94bc4016_5225x2750.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:766,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:932803,&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/198941510?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F699b89b4-7c22-4380-a297-6d1a94bc4016_5225x2750.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_!LHuN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F699b89b4-7c22-4380-a297-6d1a94bc4016_5225x2750.png 424w, https://substackcdn.com/image/fetch/$s_!LHuN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F699b89b4-7c22-4380-a297-6d1a94bc4016_5225x2750.png 848w, https://substackcdn.com/image/fetch/$s_!LHuN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F699b89b4-7c22-4380-a297-6d1a94bc4016_5225x2750.png 1272w, https://substackcdn.com/image/fetch/$s_!LHuN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F699b89b4-7c22-4380-a297-6d1a94bc4016_5225x2750.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>The 50-minute allocation</strong></p><p>Here is the allocation that consistently produces complete answers with time for depth:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8fty!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9bb8ffe-c62d-4d06-bb65-351cae591e0f_932x466.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8fty!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9bb8ffe-c62d-4d06-bb65-351cae591e0f_932x466.png 424w, https://substackcdn.com/image/fetch/$s_!8fty!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9bb8ffe-c62d-4d06-bb65-351cae591e0f_932x466.png 848w, https://substackcdn.com/image/fetch/$s_!8fty!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9bb8ffe-c62d-4d06-bb65-351cae591e0f_932x466.png 1272w, https://substackcdn.com/image/fetch/$s_!8fty!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9bb8ffe-c62d-4d06-bb65-351cae591e0f_932x466.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8fty!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9bb8ffe-c62d-4d06-bb65-351cae591e0f_932x466.png" width="932" height="466" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d9bb8ffe-c62d-4d06-bb65-351cae591e0f_932x466.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:466,&quot;width&quot;:932,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:50877,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://systemdr.systemdrd.com/i/198941510?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9bb8ffe-c62d-4d06-bb65-351cae591e0f_932x466.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_!8fty!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9bb8ffe-c62d-4d06-bb65-351cae591e0f_932x466.png 424w, https://substackcdn.com/image/fetch/$s_!8fty!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9bb8ffe-c62d-4d06-bb65-351cae591e0f_932x466.png 848w, https://substackcdn.com/image/fetch/$s_!8fty!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9bb8ffe-c62d-4d06-bb65-351cae591e0f_932x466.png 1272w, https://substackcdn.com/image/fetch/$s_!8fty!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9bb8ffe-c62d-4d06-bb65-351cae591e0f_932x466.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Total: 45&#8211;47 minutes, leaving a 3&#8211;5 minute buffer.</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><p><strong>The checkpoints to self-enforce</strong></p><p><strong>Minute 10:</strong> API must be drafted and scope must be locked. If you&#8217;re still asking clarifying questions at minute 10, you&#8217;ve spent your estimation time and you&#8217;ll have to compress the data model.</p><p><strong>Minute 22:</strong> Schema and key flows should be on the board. At this point you should have: at least two tables sketched with primary keys and indexes, and at least one paragraph of the architecture explained. If you&#8217;re still on API design at minute 22, move immediately.</p><p><strong>Minute 35:</strong> The deep dive must be in progress. Not about to start &#8212; actually underway. If you&#8217;re at minute 35 with only the high-level architecture sketched and no deep dive started, you have a problem. Stop the high-level walkthrough and pivot to the deep dive now. An incomplete high-level architecture plus a solid deep dive is worth more than a complete architecture with no deep dive.</p><p><strong>Minute 48:</strong> Trade-offs and failure modes should be underway. If you&#8217;re still deep-diving at minute 48, spend the last two minutes naming the top three things that break in your current design and what you&#8217;d do about them. Even naming them without a full answer is better than silence.</p><p><strong>The discipline required</strong></p><p>The hardest part of time management is stopping something that&#8217;s going well to move on.</p><p>You&#8217;re mid-explanation of the data model. It&#8217;s going well. You understand this part. The interviewer is nodding. You want to finish the thought.</p><p>Move anyway. The next section matters more than this one continued.</p><p>The data model section&#8217;s job is to demonstrate that you can design appropriate schemas with the right indexes and sharding strategy. Once that&#8217;s demonstrated &#8212; once you&#8217;ve covered the main table, the partition key, and at least one non-obvious design decision &#8212; the section is done. More detail doesn&#8217;t add signal; it steals time from sections where signal is still available.</p><p><strong>What to do when you fall behind</strong></p><p>If you realize you&#8217;re behind the checkpoints, the correct response is compression, not panic.</p><p>For the architecture: &#8220;Let me give you the key components and the main flows rather than a complete walkthrough.&#8221; Five minutes instead of ten. Names the components, traces one read path and one write path, stops.</p><p>For the data model: &#8220;The critical table here is the messages table &#8212; let me focus on that one rather than all five tables.&#8221; Two minutes instead of seven. Names the partition key, names the TTL strategy, stops.</p><p>For the API: &#8220;Three endpoints &#8212; the core create, read, and webhook. Let me sketch those quickly.&#8221; Two minutes. Moves on.</p><p>Compression is always better than omission. A compressed section signals that you know what you&#8217;re doing and are managing time deliberately. An omitted section is a missing signal.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!iQt3!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5cf00de-809b-4aa5-adcd-3df5cc3a005b_5225x2970.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!iQt3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5cf00de-809b-4aa5-adcd-3df5cc3a005b_5225x2970.png 424w, https://substackcdn.com/image/fetch/$s_!iQt3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5cf00de-809b-4aa5-adcd-3df5cc3a005b_5225x2970.png 848w, https://substackcdn.com/image/fetch/$s_!iQt3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5cf00de-809b-4aa5-adcd-3df5cc3a005b_5225x2970.png 1272w, https://substackcdn.com/image/fetch/$s_!iQt3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5cf00de-809b-4aa5-adcd-3df5cc3a005b_5225x2970.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!iQt3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5cf00de-809b-4aa5-adcd-3df5cc3a005b_5225x2970.png" width="1456" height="828" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b5cf00de-809b-4aa5-adcd-3df5cc3a005b_5225x2970.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:828,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:951838,&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/198941510?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5cf00de-809b-4aa5-adcd-3df5cc3a005b_5225x2970.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_!iQt3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5cf00de-809b-4aa5-adcd-3df5cc3a005b_5225x2970.png 424w, https://substackcdn.com/image/fetch/$s_!iQt3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5cf00de-809b-4aa5-adcd-3df5cc3a005b_5225x2970.png 848w, https://substackcdn.com/image/fetch/$s_!iQt3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5cf00de-809b-4aa5-adcd-3df5cc3a005b_5225x2970.png 1272w, https://substackcdn.com/image/fetch/$s_!iQt3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5cf00de-809b-4aa5-adcd-3df5cc3a005b_5225x2970.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>The permission to be incomplete</strong></p><p>Most engineers feel they should finish each section before moving to the next. This intuition works in normal engineering work. In a timed interview, it&#8217;s wrong.</p><p>The interview is scored as a whole, not section by section. A round with complete clarification, estimation, API, data model, architecture, deep dive, and trade-offs &#8212; each at 70% coverage &#8212; scores better than a round with perfect clarification, estimation, and API at 100% coverage with no deep dive.</p><p>The deep dive is the section with the highest score differential. It&#8217;s where the round is decided. Everything before it is the setup. Don&#8217;t let the setup consume so much time that the payoff never arrives.</p><div><hr></div><p><strong>CTA:</strong> The drill cards have a time-box bar at the bottom of every card &#8212; the exact minute allocation for that specific question, weighted toward where the probe lands. All 37 are in the Vault.</p><blockquote><p><strong>Curious how this works in real systems?</strong> </p></blockquote><p>The paid lessons cover scalability, optimization, and real-world engineering patterns.</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><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[Design Instagram Feed Ranking — Walkthrough ]]></title><description><![CDATA[The probe]]></description><link>https://systemdr.systemdrd.com/p/design-instagram-feed-ranking-walkthrough</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/design-instagram-feed-ranking-walkthrough</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Tue, 11 Aug 2026 03:31:32 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!j2sC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d5a979-b8a5-4709-9540-b6efd2c75657_4750x4500.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2><span>The probe</span></h2><blockquote><p><span>Same fan-out architecture as Twitter Timeline, but the ranking model is more complex &#8212; Instagram ranks not just by recency but by predicted engagement (like, comment, share probability) for each specific user-post pair. The probe is the ranking pipeline and how features are assembled at query time without violating the 500ms SLO.</span></p></blockquote><p><span>Architecture delta from Twitter Timeline</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_!j2sC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d5a979-b8a5-4709-9540-b6efd2c75657_4750x4500.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!j2sC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d5a979-b8a5-4709-9540-b6efd2c75657_4750x4500.png 424w, https://substackcdn.com/image/fetch/$s_!j2sC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d5a979-b8a5-4709-9540-b6efd2c75657_4750x4500.png 848w, https://substackcdn.com/image/fetch/$s_!j2sC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d5a979-b8a5-4709-9540-b6efd2c75657_4750x4500.png 1272w, https://substackcdn.com/image/fetch/$s_!j2sC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d5a979-b8a5-4709-9540-b6efd2c75657_4750x4500.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!j2sC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d5a979-b8a5-4709-9540-b6efd2c75657_4750x4500.png" width="572" height="541.75" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/84d5a979-b8a5-4709-9540-b6efd2c75657_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;:572,&quot;bytes&quot;:1387727,&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/208037471?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d5a979-b8a5-4709-9540-b6efd2c75657_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_!j2sC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d5a979-b8a5-4709-9540-b6efd2c75657_4750x4500.png 424w, https://substackcdn.com/image/fetch/$s_!j2sC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d5a979-b8a5-4709-9540-b6efd2c75657_4750x4500.png 848w, https://substackcdn.com/image/fetch/$s_!j2sC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d5a979-b8a5-4709-9540-b6efd2c75657_4750x4500.png 1272w, https://substackcdn.com/image/fetch/$s_!j2sC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d5a979-b8a5-4709-9540-b6efd2c75657_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"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div>
      <p>
          <a href="https://systemdr.systemdrd.com/p/design-instagram-feed-ranking-walkthrough">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Three Gaps I See in Almost Every Cohort Assignment]]></title><description><![CDATA[After reading hundreds of system design assignments from cohort members, three gaps show up so consistently that I now watch for them specifically in every submission.]]></description><link>https://systemdr.systemdrd.com/p/three-gaps-i-see-in-almost-every</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/three-gaps-i-see-in-almost-every</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Sun, 09 Aug 2026 03:30:02 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Yi0V!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba98adf2-a6b2-488c-8a50-d25f6f2118ba_4400x2860.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>After reading hundreds of system design assignments from cohort members, three gaps show up so consistently that I now watch for them specifically in every submission.</p><p>They&#8217;re not exotic. They&#8217;re not about knowing obscure algorithms. They&#8217;re about the difference between an answer that sounds right and an answer that demonstrates you understand what you&#8217;re designing.</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>Gap 1: Numbers that don&#8217;t drive anything</strong></p><p>Most cohort members can estimate. They get DAU, they calculate requests per second, they calculate storage. The numbers are usually in the right order of magnitude.</p><p>Then the next section of their answer proceeds as if the numbers never existed.</p><p>&#8220;We&#8217;ll have approximately 50,000 writes per second&#8221; followed by &#8220;I&#8217;d store user data in a Postgres database.&#8221; No mention of whether Postgres handles 50,000 writes per second. No acknowledgment that this number might matter for the technology choice.</p><p>The numbers should be the <em>reason</em> for the architectural decisions. Not a box checked before the real answer begins.</p><p>The fix is simple: after every estimation number, add one sentence starting with &#8220;this means.&#8221; 50,000 writes per second &#8212; this means a single Postgres instance will be the bottleneck; I&#8217;ll need to either shard or move to a write-optimized store like Cassandra. Now the number is doing work.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Yi0V!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba98adf2-a6b2-488c-8a50-d25f6f2118ba_4400x2860.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Yi0V!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba98adf2-a6b2-488c-8a50-d25f6f2118ba_4400x2860.png 424w, https://substackcdn.com/image/fetch/$s_!Yi0V!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba98adf2-a6b2-488c-8a50-d25f6f2118ba_4400x2860.png 848w, https://substackcdn.com/image/fetch/$s_!Yi0V!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba98adf2-a6b2-488c-8a50-d25f6f2118ba_4400x2860.png 1272w, https://substackcdn.com/image/fetch/$s_!Yi0V!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba98adf2-a6b2-488c-8a50-d25f6f2118ba_4400x2860.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Yi0V!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba98adf2-a6b2-488c-8a50-d25f6f2118ba_4400x2860.png" width="506" height="328.760989010989" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ba98adf2-a6b2-488c-8a50-d25f6f2118ba_4400x2860.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;:506,&quot;bytes&quot;:892744,&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/198938714?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba98adf2-a6b2-488c-8a50-d25f6f2118ba_4400x2860.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_!Yi0V!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba98adf2-a6b2-488c-8a50-d25f6f2118ba_4400x2860.png 424w, https://substackcdn.com/image/fetch/$s_!Yi0V!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba98adf2-a6b2-488c-8a50-d25f6f2118ba_4400x2860.png 848w, https://substackcdn.com/image/fetch/$s_!Yi0V!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba98adf2-a6b2-488c-8a50-d25f6f2118ba_4400x2860.png 1272w, https://substackcdn.com/image/fetch/$s_!Yi0V!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fba98adf2-a6b2-488c-8a50-d25f6f2118ba_4400x2860.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Gap 2: The happy path only</strong></p><p>Most cohort submissions design a system that works when everything goes right. The API is called, the database responds, the message is delivered. The walkthrough is coherent.</p><p>Then nothing goes wrong. There are no failure modes. There&#8217;s no offline user, no database timeout, no cache failure, no duplicate message delivery.</p><p>The simplest version of this is in the messaging question: a candidate designs the delivery path for an online user but never addresses what happens when the recipient is offline. The question literally asks about this. The omission is not subtle.</p><p>The fix is one explicit section at the end of every design: &#8220;three things that break.&#8221; Name them, name the conditions, and describe how you detect and handle each. Even if the answer is &#8220;we&#8217;d accept degraded behavior and alert on it&#8221; &#8212; that&#8217;s a real answer.</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><p><strong>Gap 3: Decisions without reasons</strong></p><p>&#8220;I&#8217;d use Kafka for the event stream.&#8221;</p><p>Why Kafka? This sentence appears in dozens of submissions every cohort. Sometimes Kafka is the right answer. Sometimes a simple SQS queue would be better. Sometimes a database table with <code>FOR UPDATE SKIP LOCKED</code> is better. The choice depends entirely on the requirements.</p><p>When you state a technology choice without a reason, you&#8217;re signaling that you know the word, not the trade-off. The interviewer probes exactly here. &#8220;Why Kafka over something simpler?&#8221; is one of the most common follow-up questions in design interviews.</p><p>The fix is to never name a technology without one of these two phrases following it: &#8220;because&#8221; or &#8220;instead of.&#8221;</p><p>&#8220;I&#8217;d use Kafka because the producers and consumers have different throughput &#8212; decoupling them lets each scale independently.&#8221; Now the choice has a reason.</p><p>&#8220;I&#8217;d use Redis instead of Memcached because we need persistence and sorted sets for the leaderboard.&#8221; Now the choice has a comparison.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!wWkT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12921f23-23f7-4b35-843c-72df75f18203_4400x2640.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wWkT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12921f23-23f7-4b35-843c-72df75f18203_4400x2640.png 424w, https://substackcdn.com/image/fetch/$s_!wWkT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12921f23-23f7-4b35-843c-72df75f18203_4400x2640.png 848w, https://substackcdn.com/image/fetch/$s_!wWkT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12921f23-23f7-4b35-843c-72df75f18203_4400x2640.png 1272w, https://substackcdn.com/image/fetch/$s_!wWkT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12921f23-23f7-4b35-843c-72df75f18203_4400x2640.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wWkT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12921f23-23f7-4b35-843c-72df75f18203_4400x2640.png" width="582" height="349.3598901098901" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/12921f23-23f7-4b35-843c-72df75f18203_4400x2640.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;:582,&quot;bytes&quot;:651115,&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/198938714?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12921f23-23f7-4b35-843c-72df75f18203_4400x2640.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_!wWkT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12921f23-23f7-4b35-843c-72df75f18203_4400x2640.png 424w, https://substackcdn.com/image/fetch/$s_!wWkT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12921f23-23f7-4b35-843c-72df75f18203_4400x2640.png 848w, https://substackcdn.com/image/fetch/$s_!wWkT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12921f23-23f7-4b35-843c-72df75f18203_4400x2640.png 1272w, https://substackcdn.com/image/fetch/$s_!wWkT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12921f23-23f7-4b35-843c-72df75f18203_4400x2640.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Why these gaps matter more than knowledge gaps</strong></p><p>The three things above &#8212; numbers with consequences, failure modes, and reasoned decisions &#8212; are what experienced engineers do automatically when they design systems. Not because they&#8217;re trying to impress anyone. Because they&#8217;ve been on-call for systems that failed when the failure mode wasn&#8217;t anticipated, and they&#8217;ve had to defend technology choices to skeptical colleagues.</p><p>The interview is asking: does this person think like someone who has built and operated real systems?</p><p>The three gaps signal no, even when the technical knowledge is there.</p><p>If your answers have all three gaps, the fix is not more studying. It&#8217;s one mock interview where you discipline yourself to add &#8220;this means,&#8221; &#8220;three things that break,&#8221; and &#8220;instead of&#8221; to every section of your answer.</p><div><hr></div><p><strong>CTA:</strong> The cohort curriculum is built around closing exactly these three gaps &#8212; each module targets one of them directly. </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>Curious how this works in real systems?</strong></p><p>The paid lessons cover scalability, optimization, and real-world engineering patterns.</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[Design Slack — Walkthrough ]]></title><description><![CDATA[The probe]]></description><link>https://systemdr.systemdrd.com/p/design-slack-walkthrough</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/design-slack-walkthrough</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Tue, 04 Aug 2026 03:31:44 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!hqd_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4ac38f6-a849-45c7-b1df-4e607a1b1d10_6000x4500.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2><span>The probe</span></h2><blockquote><p><span>Slack is WhatsApp + channels + threads + search. </span></p><p><span>The messaging core is identical to WhatsApp (WebSocket, Cassandra, delivery semantics). The probes unique to Slack: channel message fan-out (a channel with 10,000 members means one message = 10,000 deliveries), message threading (replies live in a separate namespace from channel messages), and full-text search over message history.</span></p></blockquote><h2><span>Step 1 &#8212; Clarify</span></h2><p><span>- Direct messages only, or channels + DMs + threads? (Scope to channels + DMs) - Search over message history? (Yes &#8212; search is a major Slack differentiator) - Max members per channel? (Slack allows ~10K for standard, unlimited for Enterprise Grid)</span></p><p><span>- File sharing? (Yes &#8212; same object storage pattern as WhatsApp media) - SLO: message delivery &lt; 200ms p99 within same workspace</span></p><h2><span>Step 2 &#8212; Estimate</span></h2><p><span>- 20M DAU &#215; 200 messages/day = 4B messages/day = ~46K messages/sec - Average channel size: 50 members &#8594; fan-out 50 deliveries per message - Large channels (10K members): 1 message = 10K WebSocket pushes - Message retention: Slack keeps all history (unlimited on paid plans) &#8594; ~500 bytes/msg &#215; 4B msgs/day &#215; 365 days = ~730 TB/year</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; API Design</span></h2><p><span>WebSocket: wss://slack.com/connect (per workspace per device)</span></p><div class="callout-block" data-callout="true"><p><span>POST /v1/messages</span></p><p><span>Body: { channel_id, text, thread_ts (optional &#8212; reply), blocks[], files[] }</span></p><p><span>Idempotency-Key: header</span></p><p><span>Response: { ts (message timestamp, also its ID), channel_id }</span></p><p><span>GET /v1/channels/:channel_id/messages</span></p><p><span>Query: cursor, limit, oldest, latest (time range)</span></p><p><span>Response: { messages[], has_more, next_cursor }</span></p><p><span>POST /v1/search</span></p><p><span>Body: { query, channel_ids[], from_user, date_range }</span></p><p><span>Response: { messages: [{ts, channel_id, text, permalink}], total }</span></p></div><p><span>ts (timestamp) is Slack&#8217;s actual message ID &#8212; a Unix timestamp with microsecond precision, unique per channel.</span></p><h2><span>Step 4 &#8212; Data Model</span></h2><p><span>- </span><strong><span>messages </span></strong><span>(Cassandra): PARTITION BY channel_id, CLUSTER BY ts DESC &#8212; identical pattern to WhatsApp but scoped to channel</span></p><p><span>- </span><strong><span>threads</span></strong><span>: thread_ts (FK to parent message ts), reply messages in same table with thread_ts as additional cluster key</span></p><p><span>- </span><strong><span>channel_members</span></strong><span>: channel_id, user_id, joined_at &#8212; indexed both ways (channel&#8594;members for fan-out, user&#8594;channels for sidebar)</span></p><p><span>- </span><strong><span>search_index </span></strong><span>(Elasticsearch): message ts, channel_id, text, user_id, timestamp &#8212; updated async via Kafka consumer</span></p><p><span>- </span><strong><span>unread_counts </span></strong><span>(Redis): user_id:channel_id &#8594; {unread_count, last_read_ts} &#8212; updated on every message and read event</span></p>
      <p>
          <a href="https://systemdr.systemdrd.com/p/design-slack-walkthrough">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Why Strong Engineers Fail the Design Round]]></title><description><![CDATA[The system design interview round has a failure rate that surprises most engineers when they first encounter it.]]></description><link>https://systemdr.systemdrd.com/p/why-strong-engineers-fail-the-design</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/why-strong-engineers-fail-the-design</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Sun, 02 Aug 2026 03:30:13 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!MHid!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F210c7de0-e005-4b83-9be2-79382f579fd3_4950x2640.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote><p>The system design interview round has a failure rate that surprises most engineers when they first encounter it. Strong engineers &#8212; people who are genuinely good at their jobs, who have built real systems, who know distributed systems concepts &#8212; fail this round at a rate that doesn&#8217;t correlate with their actual technical competence.</p></blockquote><p>After reading enough post-mortems, the failure pattern is consistent. It&#8217;s almost never the technical content.</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>Failure mode 1: designing instead of scoping</strong></p><p>The question is &#8220;design Twitter.&#8221; The candidate starts designing Twitter. The entire Twitter.</p><p>Fifty minutes is not enough time to design a system with the surface area of Twitter. Everyone who attempts to design all of it produces a shallow sketch of everything. The interviewer wanted a deep design of one or two components. The candidate gave a shallow design of twelve.</p><p>The fix is the first five minutes of the interview. Use them to scope explicitly: &#8220;There are several interesting subsystems here. For this interview, I&#8217;m going to focus on the timeline and the fan-out architecture. I&#8217;ll acknowledge notifications, search, and ads exist but won&#8217;t design them &#8212; does that work for you?&#8221;</p><p>Most interviewers say yes. If they don&#8217;t, they redirect you to what they actually want to probe. Either way you&#8217;ve avoided spending 45 minutes designing the wrong thing.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!MHid!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F210c7de0-e005-4b83-9be2-79382f579fd3_4950x2640.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MHid!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F210c7de0-e005-4b83-9be2-79382f579fd3_4950x2640.png 424w, https://substackcdn.com/image/fetch/$s_!MHid!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F210c7de0-e005-4b83-9be2-79382f579fd3_4950x2640.png 848w, https://substackcdn.com/image/fetch/$s_!MHid!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F210c7de0-e005-4b83-9be2-79382f579fd3_4950x2640.png 1272w, https://substackcdn.com/image/fetch/$s_!MHid!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F210c7de0-e005-4b83-9be2-79382f579fd3_4950x2640.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MHid!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F210c7de0-e005-4b83-9be2-79382f579fd3_4950x2640.png" width="1456" height="777" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/210c7de0-e005-4b83-9be2-79382f579fd3_4950x2640.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:777,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:994302,&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/198938474?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F210c7de0-e005-4b83-9be2-79382f579fd3_4950x2640.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_!MHid!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F210c7de0-e005-4b83-9be2-79382f579fd3_4950x2640.png 424w, https://substackcdn.com/image/fetch/$s_!MHid!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F210c7de0-e005-4b83-9be2-79382f579fd3_4950x2640.png 848w, https://substackcdn.com/image/fetch/$s_!MHid!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F210c7de0-e005-4b83-9be2-79382f579fd3_4950x2640.png 1272w, https://substackcdn.com/image/fetch/$s_!MHid!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F210c7de0-e005-4b83-9be2-79382f579fd3_4950x2640.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Failure mode 2: communicating at the wrong level</strong></p><p>&#8220;I&#8217;d use a database for user data and a cache for performance.&#8221;</p><p>This sentence tells an interviewer almost nothing. Which database? Which cache? What&#8217;s being cached? Why? What&#8217;s the eviction strategy? What happens on cache miss?</p><p>The problem isn&#8217;t that the candidate doesn&#8217;t know the answers. They often do. The problem is they&#8217;re communicating at the level of &#8220;I&#8217;ve heard of these technologies&#8221; rather than &#8220;I understand the trade-offs.&#8221;</p><p>The fix is the three-sentence pattern: the decision, the reason, and the condition under which you&#8217;d change your mind. &#8220;I&#8217;d use Redis for the timeline cache with LRU eviction and a 24-hour TTL. The hot read pattern is point lookups by user_id, and Redis&#8217;s sub-millisecond gets absorb the read load that would otherwise hit Postgres on every feed request. If the working set grows beyond 20% of total DAU being simultaneously active, I&#8217;d evaluate a tiered cache.&#8221;</p><p>That&#8217;s the same knowledge communicated at the right level.</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><p><strong>Failure mode 3: treating the interviewer as an adversary</strong></p><p>The design round is not an oral exam. The interviewer is not trying to catch you out.</p><p>Candidates who treat it like an exam defend their choices when challenged, interpret probing questions as criticism, and become less flexible as the round goes on. The interviewer asks &#8220;what if the scale was 10&#215; what you assumed?&#8221; and the candidate hears &#8220;your estimation was wrong&#8221; and gets defensive.</p><p>The more useful interpretation: the interviewer is helping you get to the interesting part of the question. When they push back, follow their lead. &#8220;Good point &#8212; at 10&#215; scale, the component that breaks first is the Postgres write path. Let me address that.&#8221;</p><p><strong>Failure mode 4: running out of time before the deep dive</strong></p><p>The deep dive &#8212; the hard distributed systems problem at the center of the question &#8212; is where the round is decided. It&#8217;s where L5 candidates separate from L4, and where L6 candidates separate from L5.</p><p>It&#8217;s also the section that gets cut when time runs out.</p><p>The fix is self-enforcing time checkpoints. Minute 10: API must be drafted, scope locked. Minute 20: schema and key flows sketched. Minute 35: deep dive in progress. Minute 48: trade-offs and failure modes underway.</p><p>If you&#8217;re at minute 25 with no architecture on the board, the correct move is to stop wherever you are, skip to the architecture, and do it roughly. A rough architecture with a deep dive is more valuable than a complete schema with no architecture.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Y9fW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1a7035e-2bc6-4da7-9671-9dd303d2d267_4950x1760.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Y9fW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1a7035e-2bc6-4da7-9671-9dd303d2d267_4950x1760.png 424w, https://substackcdn.com/image/fetch/$s_!Y9fW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1a7035e-2bc6-4da7-9671-9dd303d2d267_4950x1760.png 848w, https://substackcdn.com/image/fetch/$s_!Y9fW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1a7035e-2bc6-4da7-9671-9dd303d2d267_4950x1760.png 1272w, https://substackcdn.com/image/fetch/$s_!Y9fW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1a7035e-2bc6-4da7-9671-9dd303d2d267_4950x1760.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Y9fW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1a7035e-2bc6-4da7-9671-9dd303d2d267_4950x1760.png" width="624" height="222" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c1a7035e-2bc6-4da7-9671-9dd303d2d267_4950x1760.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:518,&quot;width&quot;:1456,&quot;resizeWidth&quot;:624,&quot;bytes&quot;:619638,&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/198938474?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1a7035e-2bc6-4da7-9671-9dd303d2d267_4950x1760.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_!Y9fW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1a7035e-2bc6-4da7-9671-9dd303d2d267_4950x1760.png 424w, https://substackcdn.com/image/fetch/$s_!Y9fW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1a7035e-2bc6-4da7-9671-9dd303d2d267_4950x1760.png 848w, https://substackcdn.com/image/fetch/$s_!Y9fW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1a7035e-2bc6-4da7-9671-9dd303d2d267_4950x1760.png 1272w, https://substackcdn.com/image/fetch/$s_!Y9fW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1a7035e-2bc6-4da7-9671-9dd303d2d267_4950x1760.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p><strong>The pattern</strong></p><p>All four failure modes are communication problems, not knowledge problems.</p><p>If you&#8217;ve done the technical prep and you&#8217;re still not passing, the problem is almost certainly one of these four. The fix is not more reading. It&#8217;s a timed mock interview with someone who will score you specifically on scope management, communication depth, interviewer collaboration, and time allocation.</p><p>Knowledge gets you to the room. Communication gets you the offer.</p><div><hr></div><p><strong>CTA:</strong> If you recognise one of these four failure modes in your own prep &#8212; reply and tell me which one. I answer every reply and if you describe your specific situation I&#8217;ll point you to the right resource. </p><p><br><strong>Subscription link</strong></p><p><a href="https://systemdr.systemdrd.com/subscribe">https://systemdr.systemdrd.com/subscribe</a></p><p>&#8212;Sumedh</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 Quesstions </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[Design a Distributed Cache (Redis-style) — The Senior+ Walkthrough]]></title><description><![CDATA[This question is asked as a standalone (&#8221;design a distributed cache&#8221;) and as the deep-dive in almost every other system design question (&#8221;you mentioned adding a cache &#8212; walk me through how you&#8217;d build that&#8221;).]]></description><link>https://systemdr.systemdrd.com/p/design-a-distributed-cache-redis</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/design-a-distributed-cache-redis</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Tue, 28 Jul 2026 03:30:17 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!04tk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c0dc013-8546-418f-84e7-a95f2f32a325_4500x2400.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote><p><span>This question is asked as a standalone (&#8221;design a distributed cache&#8221;) and as the deep-dive in almost every other system design question (&#8221;you mentioned adding a cache &#8212; walk me through how you&#8217;d build that&#8221;). It tests whether you understand cache eviction, consistent hashing, replication, and what happens when a cache node fails.</span></p></blockquote><h2><span>The Question</span></h2><p><span>&#8220;Design a distributed in-memory cache like Redis. Support GET and SET operations. The cache should be fast, scalable, and handle node failures gracefully.&#8221;</span></p><h2><span>Step 1 &#8212; Clarify</span></h2><p><strong><span>1. Capacity? </span></strong><span>Total data size to cache. This determines how many nodes you need. A single Redis instance handles ~10&#8211;25 GB of working memory effectively.</span></p><p><strong><span>2. Eviction policy? </span></strong><span>LRU (least recently used) is the most common. Also: LFU (least frequently used), FIFO, TTL-based expiry. State which one unless the interviewer specifies.</span></p><p><strong><span>3. Write policy? </span></strong><span>Write-through (update cache and DB simultaneously &#8212; strong consistency, higher write latency) vs write-around (bypass cache on writes, populate on read) vs write-back/write-behind (write to cache first, async persist to DB &#8212; lower latency, risk of data loss).</span></p><p><strong><span>4. Read policy? </span></strong><span>Cache-aside (application checks cache first, populates on miss) vs read-through (cache automatically fetches from DB on miss). Cache-aside is the default; read-through requires the cache to know the DB schema.</span></p><p><strong><span>5. Replication? </span></strong><span>Single leader + replicas (Redis Sentinel model) or leaderless (Redis Cluster model)?</span></p><h2><span>Step 2 &#8212; Estimate</span></h2><p><span>- 10 TB of data to cache across the cluster</span></p><p><span>- Target: &lt; 1ms p99 for GET/SET</span></p><p><span>- Each node: 25 GB RAM &#8594; 400 nodes for 10 TB</span></p><p><span>- Throughput: 500K ops/sec per node &#8594; 200M ops/sec cluster capacity - Network: 1 Gbps per node, each GET returns avg 1 KB &#8594; 1M GETs/sec per node on bandwidth alone</span></p><p><span>The key insight: at 400 nodes, the routing layer (consistent hashing) must direct each request to the right node in &lt; 0.1ms overhead, leaving &lt; 0.9ms for the actual lookup.</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; Core Data Structures</span></h2><p><strong><span>Hash table with LRU eviction:</span></strong></p><p><span>The cache is essentially a hash map + a doubly-linked list for LRU tracking.</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_!VTns!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F112f9628-5a47-4ded-a1de-8ea99500968a_4500x1800.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VTns!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F112f9628-5a47-4ded-a1de-8ea99500968a_4500x1800.png 424w, https://substackcdn.com/image/fetch/$s_!VTns!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F112f9628-5a47-4ded-a1de-8ea99500968a_4500x1800.png 848w, https://substackcdn.com/image/fetch/$s_!VTns!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F112f9628-5a47-4ded-a1de-8ea99500968a_4500x1800.png 1272w, https://substackcdn.com/image/fetch/$s_!VTns!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F112f9628-5a47-4ded-a1de-8ea99500968a_4500x1800.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VTns!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F112f9628-5a47-4ded-a1de-8ea99500968a_4500x1800.png" width="716" height="286.2032967032967" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/112f9628-5a47-4ded-a1de-8ea99500968a_4500x1800.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:582,&quot;width&quot;:1456,&quot;resizeWidth&quot;:716,&quot;bytes&quot;:423160,&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/207242844?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F112f9628-5a47-4ded-a1de-8ea99500968a_4500x1800.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_!VTns!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F112f9628-5a47-4ded-a1de-8ea99500968a_4500x1800.png 424w, https://substackcdn.com/image/fetch/$s_!VTns!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F112f9628-5a47-4ded-a1de-8ea99500968a_4500x1800.png 848w, https://substackcdn.com/image/fetch/$s_!VTns!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F112f9628-5a47-4ded-a1de-8ea99500968a_4500x1800.png 1272w, https://substackcdn.com/image/fetch/$s_!VTns!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F112f9628-5a47-4ded-a1de-8ea99500968a_4500x1800.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>- Hash map: key &#8594; (value, pointer to LRU list node) &#8212; O(1) GET</span></p><p><span>- Doubly-linked list: most-recently-used at head, least-recently-used at tail - On GET: move the accessed node to the head of the list &#8212; O(1)</span></p><p><span>- On SET: add to head. If capacity exceeded: remove from tail (evict LRU) &#8212; O(1) - On eviction: remove from hash map and list simultaneously &#8212; O(1)</span></p><p><span>This O(1) for both GET and eviction is the data structure insight interviewers test. A naive LRU using a sorted list would be O(N) on every access.</span></p><h2><span>Step 4 &#8212; Consistent Hashing (the probe)</span></h2><p><span>With 400 nodes, how do you decide which node stores key K?</span></p><p><strong><span>Naive modulo hashing: </span></strong><span>node = hash(key) % N. Simple. But when you add or remove a node (N changes), nearly every key remaps to a different node. A node failure or scale event causes a cache stampede &#8212; every miss hits the DB simultaneously.</span></p><p><strong><span>Consistent hashing:</span></strong></p><p><span>Place nodes on a circular ring (0 to 2&#179;&#178; - 1). Each node is assigned a position by hashing its identifier. To find the node for key K: hash K, find the nearest node clockwise on the ring.</span></p><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-distributed-cache-redis">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Sharding: The Decision You Get Wrong Every Time]]></title><description><![CDATA[&#8220;I&#8217;d shard by user ID.&#8221;]]></description><link>https://systemdr.systemdrd.com/p/sharding-the-decision-you-get-wrong</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/sharding-the-decision-you-get-wrong</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Sun, 26 Jul 2026 03:30:39 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Uo-I!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3755edca-b023-4bc6-aabe-93038180b872_4400x2860.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>&#8220;I&#8217;d shard by user ID.&#8221;</p><p>This sentence appears in roughly 60% of system design interview answers involving a database. Sometimes it&#8217;s correct. Often it isn&#8217;t. Almost always it&#8217;s stated without the reasoning that determines whether it&#8217;s right or wrong.</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>The reasoning is everything. The partition key isn&#8217;t a preference &#8212; it&#8217;s a consequence of your read pattern.</p><p><strong>The rule</strong></p><p>Partition on the dimension you query by most frequently.</p><p>If the most common query is &#8220;give me all messages for user X&#8221; &#8212; partition by user_id. Every message for user X is on the same shard. One network hop.</p><p>If the most common query is &#8220;give me all messages in conversation C&#8221; &#8212; partition by conversation_id. Every message in conversation C is on the same shard.</p><p>Partition by sender_id in a messaging system where reads are by recipient? Every delivery requires querying every shard. You&#8217;ve distributed your data in a way that makes your hot read path maximally expensive.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Uo-I!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3755edca-b023-4bc6-aabe-93038180b872_4400x2860.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Uo-I!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3755edca-b023-4bc6-aabe-93038180b872_4400x2860.png 424w, https://substackcdn.com/image/fetch/$s_!Uo-I!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3755edca-b023-4bc6-aabe-93038180b872_4400x2860.png 848w, https://substackcdn.com/image/fetch/$s_!Uo-I!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3755edca-b023-4bc6-aabe-93038180b872_4400x2860.png 1272w, https://substackcdn.com/image/fetch/$s_!Uo-I!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3755edca-b023-4bc6-aabe-93038180b872_4400x2860.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Uo-I!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3755edca-b023-4bc6-aabe-93038180b872_4400x2860.png" width="1456" height="946" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3755edca-b023-4bc6-aabe-93038180b872_4400x2860.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:946,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:838901,&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/198938251?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3755edca-b023-4bc6-aabe-93038180b872_4400x2860.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_!Uo-I!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3755edca-b023-4bc6-aabe-93038180b872_4400x2860.png 424w, https://substackcdn.com/image/fetch/$s_!Uo-I!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3755edca-b023-4bc6-aabe-93038180b872_4400x2860.png 848w, https://substackcdn.com/image/fetch/$s_!Uo-I!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3755edca-b023-4bc6-aabe-93038180b872_4400x2860.png 1272w, https://substackcdn.com/image/fetch/$s_!Uo-I!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3755edca-b023-4bc6-aabe-93038180b872_4400x2860.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>How to get it right</strong></p><p>Before naming a partition key, write down the two or three most frequent queries the system needs to serve. Then choose the partition key that makes those queries hit one shard.</p><p>For a payment system: the hot query is &#8220;give me all transactions for account X.&#8221; Partition by account_id.</p><p>For a ride-sharing system: the hot query is &#8220;give me all active drivers within 5km of this point.&#8221; Geohashing is the partition key &#8212; drivers in the same geohash cell land on the same shard.</p><p>For a social feed: the hot query is &#8220;give me all posts for user X&#8217;s followers, sorted by time.&#8221; Partition by user_id &#8212; each user&#8217;s feed is co-located.</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><p><strong>The celebrity problem</strong></p><p>Even correct partition key choices have a failure mode: hot partitions.</p><p>If you partition a social graph by user_id and one of your users is a celebrity with 100 million followers, every follow/unfollow event writes to one shard. Every timeline read for those 100 million followers potentially reads from one shard. That shard is getting 100&#215; the load of any other.</p><p>The fix depends on what&#8217;s hot. For write-heavy celebrities: scatter their data across multiple shards using a compound key (user_id + bucket_id), then merge at read time. For read-heavy content: replicate it across shards so reads can be served locally.</p><p>The L5 answer names the hot partition problem. The L6 answer names the specific fix and the conditions under which you&#8217;d apply it.</p><p><strong>The mechanical keys worth memorizing</strong></p><p>Some partition key decisions are standard enough that deviating from them signals a mistake:</p><p>Messages: by recipient_id (the hot read is &#8220;messages for user X&#8221;)</p><p>Notifications: by user_id (same reason)</p><p>Ride locations: by geohash (the hot read is proximity query)</p><p>Payment transactions: by account_id (the hot read is account history)</p><p>Web sessions: by session_id (the hot read is session lookup by ID)</p><p>Analytics events: by event_time or by (user_id, date) if per-user queries dominate</p><p>When you name a partition key in an interview, the follow-up is almost always: &#8220;what&#8217;s the failure mode?&#8221; The correct answer is almost always: &#8220;hot partitions when the distribution is uneven &#8212; here&#8217;s how I&#8217;d detect and address them.&#8221;</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DPH-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdd9cc10-03e3-46c7-9039-a93c26cc156c_4675x3410.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DPH-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdd9cc10-03e3-46c7-9039-a93c26cc156c_4675x3410.png 424w, https://substackcdn.com/image/fetch/$s_!DPH-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdd9cc10-03e3-46c7-9039-a93c26cc156c_4675x3410.png 848w, https://substackcdn.com/image/fetch/$s_!DPH-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdd9cc10-03e3-46c7-9039-a93c26cc156c_4675x3410.png 1272w, https://substackcdn.com/image/fetch/$s_!DPH-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdd9cc10-03e3-46c7-9039-a93c26cc156c_4675x3410.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DPH-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdd9cc10-03e3-46c7-9039-a93c26cc156c_4675x3410.png" width="1456" height="1062" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bdd9cc10-03e3-46c7-9039-a93c26cc156c_4675x3410.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1062,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1045435,&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/198938251?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdd9cc10-03e3-46c7-9039-a93c26cc156c_4675x3410.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_!DPH-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdd9cc10-03e3-46c7-9039-a93c26cc156c_4675x3410.png 424w, https://substackcdn.com/image/fetch/$s_!DPH-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdd9cc10-03e3-46c7-9039-a93c26cc156c_4675x3410.png 848w, https://substackcdn.com/image/fetch/$s_!DPH-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdd9cc10-03e3-46c7-9039-a93c26cc156c_4675x3410.png 1272w, https://substackcdn.com/image/fetch/$s_!DPH-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdd9cc10-03e3-46c7-9039-a93c26cc156c_4675x3410.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>What &#8220;sharding&#8221; actually is</strong></p><blockquote><p>One last thing worth naming explicitly: sharding and partitioning are often used interchangeably in interviews, but they mean slightly different things. Partitioning is dividing data logically. Sharding is distributing those partitions across separate physical nodes. When interviewers ask &#8220;how would you shard the users table?&#8221; they mean both.</p></blockquote><blockquote><p>The answer format that works: state the partition key, explain why it fits the read pattern, name the hot partition risk, and describe the mitigation. Four sentences. Every sharding answer.</p></blockquote><div><hr></div><p><strong>CTA:</strong> The distributed cache walkthrough (paid post #10) goes deep on consistent hashing and the hot partition problem specifically &#8212; including the virtual nodes fix and the thundering herd mitigation when a shard fails. </p><p><br><strong>Interested in mastering this topic?</strong> </p><p>Unlock premium content with deeper explanations and real implementation patterns.</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><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[Design Typeahead / Search Autocomplete — The Senior+ Walkthrough ]]></title><description><![CDATA[This is one of the most common system design interview questions across all company tiers, asked at Google, Amazon, Twitter, and virtually every product company.]]></description><link>https://systemdr.systemdrd.com/p/design-typeahead-search-autocomplete</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/design-typeahead-search-autocomplete</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Tue, 21 Jul 2026 03:31:18 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!H9At!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad79390c-d559-41d7-a8be-b9ade039d2a9_4500x2250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><span>This is one of the most common system design interview questions across all company tiers, asked at Google, Amazon, Twitter, and virtually every product company. </span></p><p><span>The reason: it has a clear probe (the trie data structure and its distributed form), and it reveals whether candidates</span></p><p><span>understand read-heavy system optimization, pre-computation, and the latency constraints of real-time user interaction.</span></p><h3><span>The Question</span></h3><p><span>&#8220;Design the search autocomplete / typeahead system. As a user types in a search box, the system suggests the top 5&#8211;10 completions in real time.&#8221;</span></p><p><span>Variants: &#8220;Design Google search suggestions,&#8221; &#8220;Design Twitter&#8217;s search autocomplete,&#8221; &#8220;Design Amazon&#8217;s search bar.&#8221;</span></p><h3><span>Step 1 &#8212; Clarify</span></h3><p style="text-align: justify;"><strong><span>1. What goes in suggestions? </span></strong><span>Historical search queries (Google-style), titles in a product catalog (Amazon-style), or usernames/topics (Twitter-style)? The data source changes the indexing strategy significantly.</span></p><p><strong><span>2. How many queries is the system handling? </span></strong><span>Google processes ~100K searches/sec. For most interviews: 10M DAU &#215; 10 searches/day = 100M searches/day = ~1,200/sec average, 10K/sec peak.</span></p><p><strong><span>3. How fresh must suggestions be? </span></strong><span>Do new trending searches need to appear in suggestions within minutes, or is 24-hour staleness acceptable? Real-time freshness is much harder. Start by assuming daily updates &#8212; offer to discuss real-time as an extension.</span></p><p><strong><span>4. Personalized or global? </span></strong><span>Global suggestions (same results for all users) are vastly simpler. Personalized (based on your history) requires per-user ranking on top of the global index.</span></p><p><strong><span>5. Latency SLO? </span></strong><span>Suggestions must appear within 100ms of each keystroke to feel real-time. This is the hardest constraint in the system.</span></p><h3><span>Step 2 &#8212; Estimate</span></h3><p><span>- 10K search requests/sec at peak (one autocomplete request per keystroke) - Average query length: 20 characters &#8594; 20 requests per search session in the worst case</span></p><p><span>- Top-K queries to track: top 10 million unique queries globally</span></p><p><span>- Trie storage: each node is ~16 bytes (character + children pointers + metadata) &#8212; a trie of 10M queries averages ~50M nodes &#215; 16 bytes = 800 MB. </span><strong><span>Fits in memory on a single machine.</span></strong></p><p><span>- Response size: 5&#8211;10 query strings, avg 30 bytes each = 300 bytes per response</span></p><p><span>The 800 MB insight is critical. The entire suggestion index for most production systems fits in memory. This is what enables sub-millisecond lookups.</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><h3><span>Step 3 &#8212; Data Model and Core Data Structure</span></h3><p><span>The trie</span></p><p><span>A trie (prefix tree) is the natural structure for autocomplete. Each node represents a character. A path from root to a node spells a prefix. Each node stores the top-K completions for that prefix.</span></p><div class="callout-block" data-callout="true"><p><span>root</span></p><p><span>&#9492;&#9472;&#9472; &#8216;s&#8217;</span></p><p><span>&#9492;&#9472;&#9472; &#8216;e&#8217;</span></p><p><span>&#9492;&#9472;&#9472; &#8216;a&#8217;</span></p><p><span>&#9500;&#9472;&#9472; &#8216;r&#8217; &#8594; [&#8221;search engine&#8221;, &#8220;search bar&#8221;, &#8220;sear...&#8221;] &#8592; top-5 stored here</span></p><p><span>&#9492;&#9472;&#9472; &#8216;s&#8217; &#8594; [&#8221;season&#8221;, &#8220;seasoning&#8221;, ...]</span></p></div><p><strong><span>The key design choice: </span></strong><span>Pre-compute and cache the top-K results at every node in the trie. This trades storage for latency &#8212; instead of traversing to all leaf nodes on every query, the answer is stored at the prefix node. Query time: O(len(prefix)) &#8212; just traverse down the trie.</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_!H9At!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad79390c-d559-41d7-a8be-b9ade039d2a9_4500x2250.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!H9At!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad79390c-d559-41d7-a8be-b9ade039d2a9_4500x2250.png 424w, https://substackcdn.com/image/fetch/$s_!H9At!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad79390c-d559-41d7-a8be-b9ade039d2a9_4500x2250.png 848w, https://substackcdn.com/image/fetch/$s_!H9At!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad79390c-d559-41d7-a8be-b9ade039d2a9_4500x2250.png 1272w, https://substackcdn.com/image/fetch/$s_!H9At!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad79390c-d559-41d7-a8be-b9ade039d2a9_4500x2250.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!H9At!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad79390c-d559-41d7-a8be-b9ade039d2a9_4500x2250.png" width="1456" height="728" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ad79390c-d559-41d7-a8be-b9ade039d2a9_4500x2250.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:728,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:585119,&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/204408046?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad79390c-d559-41d7-a8be-b9ade039d2a9_4500x2250.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_!H9At!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad79390c-d559-41d7-a8be-b9ade039d2a9_4500x2250.png 424w, https://substackcdn.com/image/fetch/$s_!H9At!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad79390c-d559-41d7-a8be-b9ade039d2a9_4500x2250.png 848w, https://substackcdn.com/image/fetch/$s_!H9At!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad79390c-d559-41d7-a8be-b9ade039d2a9_4500x2250.png 1272w, https://substackcdn.com/image/fetch/$s_!H9At!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad79390c-d559-41d7-a8be-b9ade039d2a9_4500x2250.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>Without pre-computation: query time is O(all_suffixes) &#8212; must find all strings below the current node and rank them.</span></p><p><span>query_frequency table (offline aggregation source)</span></p><p><span>query_text, frequency_count, last_updated_at</span></p><p><span>This is the source of truth for what goes in the trie. Updated daily via a MapReduce / Spark job over the day&#8217;s search logs. The job counts query occurrences, normalizes (lowercase, trim), and writes the top-N queries per prefix into the trie build pipeline.</span></p><h3><span>Step 4 &#8212; Architecture</span></h3><p><span>Three components with different update cadences.</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_!MADx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F284b08e7-6971-4167-aab6-209eb70b946e_4750x3250.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MADx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F284b08e7-6971-4167-aab6-209eb70b946e_4750x3250.png 424w, https://substackcdn.com/image/fetch/$s_!MADx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F284b08e7-6971-4167-aab6-209eb70b946e_4750x3250.png 848w, https://substackcdn.com/image/fetch/$s_!MADx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F284b08e7-6971-4167-aab6-209eb70b946e_4750x3250.png 1272w, https://substackcdn.com/image/fetch/$s_!MADx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F284b08e7-6971-4167-aab6-209eb70b946e_4750x3250.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MADx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F284b08e7-6971-4167-aab6-209eb70b946e_4750x3250.png" width="1456" height="996" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/284b08e7-6971-4167-aab6-209eb70b946e_4750x3250.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:996,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:983226,&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/204408046?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F284b08e7-6971-4167-aab6-209eb70b946e_4750x3250.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_!MADx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F284b08e7-6971-4167-aab6-209eb70b946e_4750x3250.png 424w, https://substackcdn.com/image/fetch/$s_!MADx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F284b08e7-6971-4167-aab6-209eb70b946e_4750x3250.png 848w, https://substackcdn.com/image/fetch/$s_!MADx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F284b08e7-6971-4167-aab6-209eb70b946e_4750x3250.png 1272w, https://substackcdn.com/image/fetch/$s_!MADx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F284b08e7-6971-4167-aab6-209eb70b946e_4750x3250.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>Query service (read path &#8212; latency-critical)</span></p><p><span>1. Client types a character &#8594; sends GET /suggest?q=sea</span></p><p><span>2. Request hits a load balancer &#8594; routes to one of N </span><strong><span>Trie servers </span></strong><span>(in-memory trie, sharded by prefix range or consistent hash)</span></p><p><span>3. Trie server traverses the trie in O(len(query)) time &#8594; returns top-5 cached completions 4. Response cached at CDN edge (short TTL &#8212; 60 seconds) for common prefixes (typing &#8220;the&#8221; returns the same results for everyone)</span></p><p><span>5. Total latency: &lt; 10ms (CDN hit) or &lt; 50ms (trie server hit)</span></p><p><span>Trie build service (write path &#8212; offline, daily)</span></p><p><span>1. Raw search logs &#8594; Kafka &#8594; Spark/Flink streaming job</span></p><p><span>2. Aggregation job computes top-10M queries by frequency for the trailing 7 days</span></p><p><span>3. </span><strong><span>Trie builder </span></strong><span>constructs a new trie from scratch and pre-computes top-K at every node 4. New trie serialized to S3</span></p><p><span>5. Trie servers download and hot-swap the in-memory trie (blue-green style &#8212; new trie loaded in background, traffic cut over atomically)</span></p><p><strong><span>The hot-swap is the L5+ signal. </span></strong><span>Naive implementations rebuild the trie in place and serve stale or partially-built data during the rebuild. The correct approach: build the new trie entirely before serving any requests from it.</span></p><p><span>Trending query ingestion (real-time extension)</span></p><p><span>For real-time freshness (new trending query appears within minutes):</span></p><p><span>1. Search events stream to Kafka</span></p><p><span>2. A windowed aggregation job (5-minute tumbling window) identifies queries surging in frequency</span></p><p><span>3. Trending queries are injected into the trie via a small patch update (not a full rebuild) </span></p><p><span>4. Patch propagates to all trie servers via pub-sub</span></p><p><span>This is the L6 extension &#8212; daily batch covers the base case, real-time streaming handles trending. Name both.</span></p><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-typeahead-search-autocomplete">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Reading the Interviewer]]></title><description><![CDATA[The system design interview is a conversation, not a presentation.]]></description><link>https://systemdr.systemdrd.com/p/reading-the-interviewer</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/reading-the-interviewer</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Sun, 19 Jul 2026 03:30:10 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!NGtO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7771f549-3768-4fb8-b23d-505d3cbaf61a_1052x570.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The system design interview is a conversation, not a presentation. The interviewer is giving you signals throughout the session. Most candidates miss them because they&#8217;re heads-down in their own design, narrating as they go, not watching the person on the other side of the table.</p><p>Here&#8217;s what those signals look like and what to do with 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>Signals that you&#8217;re on track</strong></p><p>&#8220;That&#8217;s interesting &#8212; tell me more about that.&#8221;</p><p>This is the best signal you can receive. The interviewer is engaged, they want to go deeper on something you said, and they&#8217;re inviting you to. Do it immediately. Whatever you were about to say next, pause it. Go deeper on the thing they asked about.</p><p>The mistake: treating this as confirmation that everything is fine and continuing your prepared flow. The interviewer told you where the interesting part of the question is. Follow them there.</p><p>Consistent nodding during a long explanation means you&#8217;re not losing them. Keep the same pace and depth.</p><p>A follow-up question that goes one level deeper on something you said &#8212; not redirecting to a new topic, but drilling into something you introduced &#8212; means the interviewer found your point substantive. This is different from a question that redirects you elsewhere</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!NGtO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7771f549-3768-4fb8-b23d-505d3cbaf61a_1052x570.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NGtO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7771f549-3768-4fb8-b23d-505d3cbaf61a_1052x570.png 424w, https://substackcdn.com/image/fetch/$s_!NGtO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7771f549-3768-4fb8-b23d-505d3cbaf61a_1052x570.png 848w, https://substackcdn.com/image/fetch/$s_!NGtO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7771f549-3768-4fb8-b23d-505d3cbaf61a_1052x570.png 1272w, https://substackcdn.com/image/fetch/$s_!NGtO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7771f549-3768-4fb8-b23d-505d3cbaf61a_1052x570.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!NGtO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7771f549-3768-4fb8-b23d-505d3cbaf61a_1052x570.png" width="1052" height="570" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7771f549-3768-4fb8-b23d-505d3cbaf61a_1052x570.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:570,&quot;width&quot;:1052,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:115057,&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/198937869?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7771f549-3768-4fb8-b23d-505d3cbaf61a_1052x570.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_!NGtO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7771f549-3768-4fb8-b23d-505d3cbaf61a_1052x570.png 424w, https://substackcdn.com/image/fetch/$s_!NGtO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7771f549-3768-4fb8-b23d-505d3cbaf61a_1052x570.png 848w, https://substackcdn.com/image/fetch/$s_!NGtO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7771f549-3768-4fb8-b23d-505d3cbaf61a_1052x570.png 1272w, https://substackcdn.com/image/fetch/$s_!NGtO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7771f549-3768-4fb8-b23d-505d3cbaf61a_1052x570.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Signals that you need to change direction</strong></p><p>&#8220;Let&#8217;s skip ahead to...&#8221; or &#8220;Actually, let&#8217;s focus on...&#8221;</p><p>The interviewer is redirecting you. This is not a signal that you did something wrong. It&#8217;s information: you&#8217;ve covered the previous section sufficiently, or you&#8217;re spending time on something that isn&#8217;t the probe they care about, or they have a specific component they want to evaluate and they&#8217;re efficiently navigating you there.</p><p>The correct response: stop mid-sentence if necessary. Don&#8217;t finish the paragraph. Say &#8220;Sure&#8221; and immediately go to where they&#8217;re pointing.</p><p>The wrong response: finishing your current point before the redirect. Taking 90 seconds to wrap up before pivoting. Explaining why you were going in the direction you were before changing direction.</p><p>None of these explanations are useful to the interviewer. The redirect supersedes everything else. Follow it immediately.</p><p>&#8220;What are the trade-offs?&#8221; immediately after you make a decision means: you stated the decision without justifying it. This is a probe, not a compliment. Answer it: what did you choose, what are you giving up, and what would change your mind.</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><p><strong>Signals that you&#8217;ve misunderstood the question</strong></p><p>&#8220;What if this needs to work globally?&#8221;</p><p>&#8220;Let&#8217;s say the scale is 100&#215; what you assumed.&#8221;</p><p>&#8220;Actually, multiple users can edit the file simultaneously.&#8221;</p><p>These are corrections. Not gentle suggestions &#8212; the premise you&#8217;ve been designing for is wrong and the interviewer is telling you.</p><p>The correct response: stop, acknowledge once (&#8221;Good point &#8212; let me revise&#8221;), immediately build forward on the corrected premise.</p><p>The wrong response: defending the original premise, explaining why the correction doesn&#8217;t change things significantly, or taking two minutes to re-explain your reasoning before accepting the correction.</p><p>One acknowledgment, then forward. The interviewer doesn&#8217;t need to understand why you made the original assumption. They need to see you incorporate new information and keep moving.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!z1mh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe91add27-fe2d-4947-abfc-f2f502227ac4_2000x1125.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!z1mh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe91add27-fe2d-4947-abfc-f2f502227ac4_2000x1125.png 424w, https://substackcdn.com/image/fetch/$s_!z1mh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe91add27-fe2d-4947-abfc-f2f502227ac4_2000x1125.png 848w, https://substackcdn.com/image/fetch/$s_!z1mh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe91add27-fe2d-4947-abfc-f2f502227ac4_2000x1125.png 1272w, https://substackcdn.com/image/fetch/$s_!z1mh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe91add27-fe2d-4947-abfc-f2f502227ac4_2000x1125.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!z1mh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe91add27-fe2d-4947-abfc-f2f502227ac4_2000x1125.png" width="1456" height="819" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e91add27-fe2d-4947-abfc-f2f502227ac4_2000x1125.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:819,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:334453,&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/198937869?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe91add27-fe2d-4947-abfc-f2f502227ac4_2000x1125.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_!z1mh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe91add27-fe2d-4947-abfc-f2f502227ac4_2000x1125.png 424w, https://substackcdn.com/image/fetch/$s_!z1mh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe91add27-fe2d-4947-abfc-f2f502227ac4_2000x1125.png 848w, https://substackcdn.com/image/fetch/$s_!z1mh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe91add27-fe2d-4947-abfc-f2f502227ac4_2000x1125.png 1272w, https://substackcdn.com/image/fetch/$s_!z1mh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe91add27-fe2d-4947-abfc-f2f502227ac4_2000x1125.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>The silence probe</strong></p><p>When you finish a section and the interviewer doesn&#8217;t immediately respond &#8212; they look at you, or look at the whiteboard, or just wait &#8212; this is almost always an invitation to go deeper.</p><p>The silence is not &#8220;that was fine, continue to the next section.&#8221; It&#8217;s &#8220;there&#8217;s more here, keep going.&#8221;</p><p>Most candidates treat silence as a signal to move on. The silence probe is actually the opposite: the interviewer has heard the surface answer and wants to see if you&#8217;ll surface the deeper one without being explicitly asked.</p><p>If you finish a section and get silence, don&#8217;t move to the next section. Go deeper on what you just said. Name a failure mode. Name a condition under which your design breaks. Name what you&#8217;d add with more time.</p><p>If you&#8217;ve genuinely exhausted the depth on that component, say so explicitly: &#8220;I think I&#8217;ve covered the core design here &#8212; should I move on to the data model?&#8221; This forces a response rather than leaving both of you in ambiguous silence.</p><p><strong>Using the interviewer actively</strong></p><p>The best candidate-interviewer dynamics aren&#8217;t interviews &#8212; they&#8217;re conversations. Candidates who treat the interviewer as a collaborator rather than an examiner consistently do better.</p><p>&#8220;I&#8217;m torn between two approaches here &#8212; let me think through both with you&#8221; is collaborative.</p><p>&#8220;I&#8217;m not sure which way this scales better &#8212; what factors would you weight more heavily?&#8221; is collaborative. It&#8217;s also information-gathering: if the interviewer says &#8220;I&#8217;d think about the write path specifically,&#8221; they&#8217;ve just told you where the probe is going.</p><p>This doesn&#8217;t mean delegating decisions to the interviewer. You still need to make choices and defend them. But using the interviewer as a thinking partner &#8212; bringing them into your reasoning process rather than presenting finished conclusions &#8212; produces a fundamentally different conversation.</p><p>That conversation is easier to score well on, because the interviewer has seen how you think, not just what you concluded.</p><div><hr></div><p><strong>CTA:</strong> The mock interview partners channel in the Discord is the fastest way to practice reading a real interviewer &#8212; not just a timer. Paid subscribers only.</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><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 Quesstions </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[Design a Distributed Rate Limiter — The Senior+ Walkthrough ]]></title><description><![CDATA[The rate limiter question is compact, deceptively hard, and asked everywhere.]]></description><link>https://systemdr.systemdrd.com/p/design-a-distributed-rate-limiter</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/design-a-distributed-rate-limiter</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Tue, 14 Jul 2026 02:27:09 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!gi0q!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdebdf120-5bd7-420a-b01d-f4890b0c2ddd_1517x800.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote><p><span>The rate limiter question is compact, deceptively hard, and asked everywhere. It tests whether you understand distributed systems coordination problems &#8212; specifically, how to enforce a global limit across a cluster of servers when no single server sees all requests. At L5 the probe is the algorithm choice. At L6 the probe is distributed coordination without a single point of failure.</span></p></blockquote><p><span>The Question</span></p><p><span>&#8220;Design a rate limiter. API clients are limited to N requests per second. Requests that exceed the limit return 429 Too Many Requests.&#8221;</span></p><p><span>Common variants: &#8220;Design Cloudflare&#8217;s rate limiting,&#8221; &#8220;Add rate limiting to a payment API,&#8221; &#8220;Design a per-user request quota system.&#8221;</span></p><h3><span>Step 1 &#8212; Clarify</span></h3><p><strong><span>1. What are we rate limiting on? </span></strong><span>Per IP, per user/API key, per endpoint, or combinations? Answer: typically per API key at the application level, per IP at the network edge.</span></p><p><strong><span>2. What granularity? </span></strong><span>Requests per second, per minute, per hour, per day? Multiple windows simultaneously (100 req/min AND 1,000 req/hour)?</span></p><p><strong><span>3. Hard limit or soft? </span></strong><span>Hard: the 101st request this minute is always rejected. Soft: occasional burst allowed. Most production systems use hard limits.</span></p><p><strong><span>4. Where does the limiter live? </span></strong><span>Middleware inside the API service, or a standalone sidecar/gateway? Standalone scales independently and is language-agnostic &#8212; correct answer for L5+.</span></p><p><strong><span>5. What&#8217;s the SLO? </span></strong><span>The rate limiter must add &lt; 1ms p99 latency to every request. It is in the hot path.</span></p><h3><span>Step 2 &#8212; Estimate</span></h3><p><span>- 50,000 API servers in a large deployment, each handling 10K req/sec - Total: 500M requests/sec &#8212; individual counters per API key must be updated atomically at this rate</span></p><p><span>- Redis cluster: 100K-500K ops/sec per node &#8212; need ~1,000-5,000 Redis nodes for 500M req/sec. In practice, shard by API key.</span></p><p><span>- Counter storage: 1M API keys &#215; 4 bytes per counter &#215; 60 windows = 240 MB &#8212; fits in memory</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><h3><span>Step 3 &#8212; API (internal interface)</span></h3><div class="callout-block" data-callout="true"><p><span>// Called by every API gateway before routing the request</span></p><p><span>bool allow_request(api_key: string, endpoint: string) &#8594; { allowed: bool, remaining: int, reset_at: epoch_ms }</span></p><p><span>// For the management API</span></p><p><span>PUT /v1/limits/:api_key { requests_per_minute: int, requests_per_hour: int } GET /v1/limits/:api_key/status &#8594; { current_count, limit, window_reset_at }</span></p></div><h3><span>Step 4 &#8212; Algorithm choice (the core probe)</span></h3><p><span>Four real algorithms. The senior answer names all four, picks one with justification, and explains what changes at L6.</span></p><p><span>Fixed window counter</span></p><p><span>Divide time into fixed 1-minute windows. Count requests per window per API key. Reset at window boundary.</span></p><p><strong><span>Win: </span></strong><span>Simple. O(1) time and space. One Redis INCR per request.</span></p><p><strong><span>Lose: </span></strong><span>Boundary burst problem. A client can send 100 requests at 12:00:59 and 100 more at 12:01:01 &#8212; that&#8217;s 200 requests in 2 seconds while the &#8220;limit&#8221; is 100/minute. The window reset creates a seam they can exploit.</span></p><p><span>Sliding window log</span></p><p><span>Store the timestamp of every request in the last 60 seconds. On each request, count entries in the log and reject if &gt; limit.</span></p><p><strong><span>Win: </span></strong><span>Perfectly accurate. No boundary burst.</span></p><p><strong><span>Lose: </span></strong><span>O(N) storage per API key (N = limit). For 1,000 req/min across 1M API keys, that&#8217;s 1 billion stored timestamps &#8212; expensive.</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_!Vne0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15f4e1e8-b08f-4290-b415-01a567b545fc_1625x777.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Vne0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15f4e1e8-b08f-4290-b415-01a567b545fc_1625x777.png 424w, https://substackcdn.com/image/fetch/$s_!Vne0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15f4e1e8-b08f-4290-b415-01a567b545fc_1625x777.png 848w, https://substackcdn.com/image/fetch/$s_!Vne0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15f4e1e8-b08f-4290-b415-01a567b545fc_1625x777.png 1272w, https://substackcdn.com/image/fetch/$s_!Vne0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15f4e1e8-b08f-4290-b415-01a567b545fc_1625x777.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Vne0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15f4e1e8-b08f-4290-b415-01a567b545fc_1625x777.png" width="1456" height="696" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/15f4e1e8-b08f-4290-b415-01a567b545fc_1625x777.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:696,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:242849,&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/203661770?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15f4e1e8-b08f-4290-b415-01a567b545fc_1625x777.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_!Vne0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15f4e1e8-b08f-4290-b415-01a567b545fc_1625x777.png 424w, https://substackcdn.com/image/fetch/$s_!Vne0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15f4e1e8-b08f-4290-b415-01a567b545fc_1625x777.png 848w, https://substackcdn.com/image/fetch/$s_!Vne0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15f4e1e8-b08f-4290-b415-01a567b545fc_1625x777.png 1272w, https://substackcdn.com/image/fetch/$s_!Vne0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15f4e1e8-b08f-4290-b415-01a567b545fc_1625x777.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>Sliding window counter (hybrid) &#8592; correct answer for most interviews</span></p><p><span>Approximate the sliding window using two fixed-window counters: the current window and the previous window. Estimate the request count for the sliding window as:</span></p><p><span>rate = prev_count &#215; (1 - elapsed_fraction) + curr_count</span></p><p><span>Where elapsed_fraction = how far into the current window we are. If we&#8217;re 30 seconds into a 60-second window, the weight of the previous window is 0.5.</span></p><p><strong><span>Win: </span></strong><span>O(1) space per API key. Accurate within ~0.003% of the true sliding window (published by Cloudflare). No boundary burst exploit.</span></p><p><strong><span>Lose: </span></strong><span>Approximate (but the error is tiny). Slightly more complex than fixed window.</span></p><p><strong><span>This is what Cloudflare uses in production </span></strong><span>&#8212; they published a blog post on it. Saying &#8220;Cloudflare published their sliding window counter approach&#8221; is an L5+ signal.</span></p><p><span>Token bucket</span></p><p><span>Each API key has a bucket of capacity N tokens. Tokens refill at rate R per second. Each request consumes one token. If the bucket is empty, the request is rejected.</span></p><p><strong><span>Win: </span></strong><span>Allows controlled bursting &#8212; a client can use saved-up tokens in a burst. Better user experience for legitimate burst traffic.</span></p><p><strong><span>Lose: </span></strong><span>Two values to track per key (current tokens, last refill timestamp). Slightly harder to implement atomically.</span></p><p><strong><span>When to use: </span></strong><span>When the product requirement explicitly allows bursting (e.g., &#8220;allow up to 50 requests in any 1-second burst as long as the 1-minute average is under 100/min&#8221;). For strict per-second limits, sliding window counter is simpler.</span></p><p><strong><span>The senior recommendation: </span></strong><span>Default to sliding window counter (Cloudflare&#8217;s approach) for strict per-second/per-minute limits. Token bucket for burst-tolerant limits where the product explicitly needs it.</span></p><div class="callout-block" data-callout="true"><p>Preparing for a distributed systems interview?<br>&#8594;<a href="https://systemdrd.com/ebooks/sdcourse-distributed-systems-interview">Download the free Interview Pack</a><br>&#8594; <a href="https://systemdr.systemdrd.com/subscribe">Subscribe</a> now to access source code repository - 200 + coding lessons</p></div>
      <p>
          <a href="https://systemdr.systemdrd.com/p/design-a-distributed-rate-limiter">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Offers landed — What the Spring Cohort got right]]></title><description><![CDATA[Learn System Design with System building, Subscribe Hands On coding course - LogStream]]></description><link>https://systemdr.systemdrd.com/p/offers-landed-what-the-best-prepared</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/offers-landed-what-the-best-prepared</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Sun, 12 Jul 2026 03:30:29 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!kno5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F499f4983-bf92-48d5-ad8e-31a85d9636fa_5060x2860.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="callout-block" data-callout="true"><p>Learn <strong>System Design with System building, Subscribe Hands On coding course - <a href="https://sdcourse.substack.com/p/start-here-how-to-use-sdcourse">LogStream</a></strong></p></div><p>Every few weeks, someone posts in the Discord&#8217;s <code>#offers-landed</code> channel. L5 at Google. Senior at Stripe. Staff at DoorDash. L6 at Meta after two prior failed loops.</p><p>I read every one. After enough of them, patterns become visible. The engineers who pass consistently are not uniformly technically stronger than the ones who fail. They are systematically different in three specific ways.</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>They scope, then go deep. Not the other way around.</strong></p><p>The most common failure mode I hear in post-mortems from engineers who got &#8220;No Hire&#8221; is some version of: &#8220;I designed a great system but ran out of time before the hard part.&#8221;</p><blockquote><p>Every engineer who has passed at L5 or above in the last six months has told me some version of the same thing: they spent the first five minutes explicitly scoping &#8212; &#8220;I&#8217;m going to focus on the timeline and the fan-out architecture, and I&#8217;m going to acknowledge but not design the notifications, search, and ads&#8221; &#8212; and then went deep on the one component they chose.</p></blockquote><p>The engineers who fail design everything shallowly. The engineers who pass design one thing deeply.</p><blockquote><p>This is not a trivial shift. Most engineers feel obligated to cover everything. The pressure to show breadth is real. Resisting it and committing to depth in the first five minutes is a deliberate choice that requires practice.</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_!kno5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F499f4983-bf92-48d5-ad8e-31a85d9636fa_5060x2860.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kno5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F499f4983-bf92-48d5-ad8e-31a85d9636fa_5060x2860.png 424w, https://substackcdn.com/image/fetch/$s_!kno5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F499f4983-bf92-48d5-ad8e-31a85d9636fa_5060x2860.png 848w, https://substackcdn.com/image/fetch/$s_!kno5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F499f4983-bf92-48d5-ad8e-31a85d9636fa_5060x2860.png 1272w, https://substackcdn.com/image/fetch/$s_!kno5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F499f4983-bf92-48d5-ad8e-31a85d9636fa_5060x2860.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kno5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F499f4983-bf92-48d5-ad8e-31a85d9636fa_5060x2860.png" width="1456" height="823" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/499f4983-bf92-48d5-ad8e-31a85d9636fa_5060x2860.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:823,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:904747,&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/198937705?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F499f4983-bf92-48d5-ad8e-31a85d9636fa_5060x2860.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_!kno5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F499f4983-bf92-48d5-ad8e-31a85d9636fa_5060x2860.png 424w, https://substackcdn.com/image/fetch/$s_!kno5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F499f4983-bf92-48d5-ad8e-31a85d9636fa_5060x2860.png 848w, https://substackcdn.com/image/fetch/$s_!kno5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F499f4983-bf92-48d5-ad8e-31a85d9636fa_5060x2860.png 1272w, https://substackcdn.com/image/fetch/$s_!kno5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F499f4983-bf92-48d5-ad8e-31a85d9636fa_5060x2860.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p 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><p><strong>They say the hard thing out loud before the interviewer asks.</strong></p><p>The standard pattern in a design interview is: candidate draws the happy path, interviewer probes the failure case, candidate scrambles to address it.</p><p>The pattern in successful candidates is different: candidate draws the happy path, then immediately says &#8220;the part of this design I&#8217;m most concerned about is the thundering herd when the cache node recovers &#8212; let me address that.&#8221; The probe never comes because the candidate already went there.</p><p>This signals something important: not just that you know the failure mode, but that you think about your own designs critically. That&#8217;s the operational maturity signal. It&#8217;s very hard to fake, and it&#8217;s very clear when it&#8217;s present.</p><p><strong>They treat the interviewer as a collaborator, not an examiner.</strong></p><p>This one is harder to describe but unmistakable when you see it.</p><p>Candidates who fail tend to treat the design round as a test &#8212; something being administered to them. They present, the interviewer asks, they defend. The dynamic is adversarial even when the interviewer is trying to be helpful.</p><p>Candidates who pass tend to use the interviewer. &#8220;I&#8217;m considering two approaches here &#8212; let me think through both with you.&#8221; &#8220;Does this constraint change which way you&#8217;d go?&#8221; &#8220;I&#8217;m not sure which way this scales better &#8212; what&#8217;s your intuition?&#8221;</p><p>This works for two reasons. First, it makes the interview feel collaborative, which influences the interviewer&#8217;s overall impression. Second, and more importantly, it gets you real information. When you say &#8220;I&#8217;m torn between these two approaches&#8221; and the interviewer says &#8220;let&#8217;s explore the second one,&#8221; they&#8217;ve just told you where the interesting part of the question is. That&#8217;s not cheating &#8212; that&#8217;s good communication.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!K5t2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4459bdf2-867a-40e3-9316-f3130616de40_4950x2640.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!K5t2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4459bdf2-867a-40e3-9316-f3130616de40_4950x2640.png 424w, https://substackcdn.com/image/fetch/$s_!K5t2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4459bdf2-867a-40e3-9316-f3130616de40_4950x2640.png 848w, https://substackcdn.com/image/fetch/$s_!K5t2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4459bdf2-867a-40e3-9316-f3130616de40_4950x2640.png 1272w, https://substackcdn.com/image/fetch/$s_!K5t2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4459bdf2-867a-40e3-9316-f3130616de40_4950x2640.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!K5t2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4459bdf2-867a-40e3-9316-f3130616de40_4950x2640.png" width="1456" height="777" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4459bdf2-867a-40e3-9316-f3130616de40_4950x2640.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:777,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:713389,&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/198937705?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4459bdf2-867a-40e3-9316-f3130616de40_4950x2640.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_!K5t2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4459bdf2-867a-40e3-9316-f3130616de40_4950x2640.png 424w, https://substackcdn.com/image/fetch/$s_!K5t2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4459bdf2-867a-40e3-9316-f3130616de40_4950x2640.png 848w, https://substackcdn.com/image/fetch/$s_!K5t2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4459bdf2-867a-40e3-9316-f3130616de40_4950x2640.png 1272w, https://substackcdn.com/image/fetch/$s_!K5t2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4459bdf2-867a-40e3-9316-f3130616de40_4950x2640.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>What these three things have in common</strong></p><p>None of them are technical. Scoping, self-critique, and collaboration are all communication skills. They&#8217;re skills you can practice in a mock interview. You cannot practice them by reading another walkthrough.</p><p>The most common mistake I see in prep is the ratio: 90% reading walkthroughs, 10% timed drills with feedback. The engineers who pass consistently tend to invert that ratio in the final 4 weeks before the interview.</p><p>The knowledge is necessary. It&#8217;s just not sufficient.</p><p>If you&#8217;ve been reading this newsletter and feel solid on the technical content, the thing to do next is not to read more. It&#8217;s to schedule a mock with someone who will score you honestly on scoping, critique, and collaboration &#8212; not just on whether you knew consistent hashing.</p><div><hr></div><p><strong>CTA:</strong> </p><p>Paid subscribers get one full system design walkthrough </p><p>every Tuesday &#8212; each mapped to its archetype so you build </p><p>pattern recognition, not answer memorization. </p><p>This week:  Rate Limiter.</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>Curious how this works in real systems?</strong> </p><p>The paid lessons cover scalability, optimization, and real-world engineering patterns.</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[Design Google Drive / Dropbox — The Senior+ Walkthrough]]></title><description><![CDATA[This is the question that defines the file sync and storage archetype.]]></description><link>https://systemdr.systemdrd.com/p/design-google-drive-dropbox-the-senior</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/design-google-drive-dropbox-the-senior</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Tue, 07 Jul 2026 01:30:37 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!LXhg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91f60f9d-9f97-41bc-805a-63f668f5be01_468x306.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote><p><span>This is the question that defines the file sync and storage archetype. Eight questions in the question bank are variants &#8212; iCloud Photos, distributed file systems, cloud backup services, Git-style version control storage, CDN edge caching. They share a spine: chunked file storage, metadata management, multi-device consistency, and conflict resolution. Internalize this one and you can answer all eight.</span></p></blockquote><blockquote><p><span>The surface question sounds like object storage with a UI. The probe underneath is what separates candidates: </span><strong><span>what happens when two devices modify the same file simultaneously? </span></strong><span>That conflict resolution problem &#8212; deceptively simple on the surface, genuinely hard in distributed systems &#8212; is where every L5+ interview on this question goes.</span></p></blockquote><blockquote><p><span>For L4 / mid-level: upload/download flow and basic chunked storage. For L5 / senior: delta sync (only transfer what changed, not the whole file), deduplication, and conflict detection. For L6 / staff: vector clocks or last-writer-wins with operational transforms for true conflict resolution, the consistency model across devices, and what Dropbox actually does differently from naive S3.</span></p></blockquote><p><span>The Question</span></p><p><span>&#8220;Design Google Drive or Dropbox. Users upload files from their devices. Files are accessible from any of their devices and sync automatically when changed.&#8221;</span></p><p><span>Common variants:</span></p><p><span>- &#8220;Design iCloud Drive / Apple Files.&#8221;</span></p><p><span>- &#8220;Design a cloud backup service.&#8221;</span></p><p><span>- &#8220;Design the file sync layer for a collaborative tool.&#8221;</span></p><p><span>- &#8220;Design a distributed file system.&#8221;</span></p><h3><span>Step 1 &#8212; Clarify Before You Draw</span></h3><p><strong><span>1. Individual file storage or collaborative editing? </span></strong><span>Dropbox stores files &#8212; one writer at a time, sync on save. Google Docs is collaborative editing &#8212; multiple simultaneous writers with operational transforms. These are fundamentally different systems. Clarify and scope to Dropbox-style unless told otherwise.</span></p><p><strong><span>2. What file types and size limits? </span></strong><span>Documents, images, video &#8212; or everything? Max file size matters: Dropbox supports files up to 50 GB. A naive single-upload approach collapses above a few hundred MB.</span></p><p><strong><span>3. Multi-device sync &#8212; how many devices per user? </span></strong><span>Average user: 3&#8211;5 devices. Power user: 10+. Each device must receive all changes to synced folders. This drives the notification and sync architecture.</span></p><p><strong><span>4. Versioning and deleted file recovery? </span></strong><span>Most cloud storage products retain file versions (Dropbox keeps 30&#8211;180 days of version history). Deleted files go to trash with a retention window. State the assumptions.</span></p><p><strong><span>5. What scale? </span></strong><span>Dropbox at its peak: 700 million registered users, 500 million files uploaded per day. Working assumptions: 100M DAU, 1B files stored, average file size 1 MB.</span></p><p><strong><span>6. What&#8217;s the SLO? </span></strong><span>File upload acknowledges within 5 seconds for files under 10 MB. Sync propagates to other devices within 30 seconds of the change. These two SLOs drive the architecture.</span></p><h3><span>Step 2 &#8212; Estimate</span></h3><p><span>- 100M DAU, each uploads/modifies ~5 files/day average &#8594; 500M file operations/day &#8594; ~5,800 ops/sec</span></p><p><span>- Average file size 1 MB &#8594; 5.8 TB/day of new or modified data ingested - Total files stored: 1B files &#215; 1 MB average = 1 PB</span></p><p><span>- With deduplication (identical files stored once): real storage closer to 400&#8211;600 TB (60% dedup ratio is typical)</span></p><p><span>- Metadata per file: ~500 bytes (name, path, size, hash, version, owner, timestamps) &#8594; 500 bytes &#215; 1B files = 500 GB of metadata &#8212; fits comfortably in a sharded relational database</span></p><p><span>- Change notifications: 500M operations/day / 86,400 seconds &#215; 3 devices per user average = ~17,000 notification fanouts/sec</span></p><p><span>The deduplication estimate is the senior signal in estimation. Dropbox publicly states that deduplication dramatically reduces storage costs because many users store the same files (PDFs, installers, stock photos). Mentioning deduplication in the estimation shows you&#8217;ve thought about the system&#8217;s economics, not just its architecture.</span></p><div class="callout-block" data-callout="true"><p><strong><mark data-color="#ffff00" 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; [<a href="https://systemdrd.com/ebooks/52-faang-questions-drillcards-cheatsheets/">VAULT CHECKOUT LINK</a>]</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><div><hr></div><h3><span>Step 3 &#8212; API Design</span></h3><div class="callout-block" data-callout="true"><p><span>POST /v1/files/upload/init</span></p><p><span>Body: { file_name, file_size_bytes, content_hash_sha256, parent_folder_id } Response: {</span></p><p><span>upload_id: string,</span></p><p><span>upload_urls: [{ chunk_index, presigned_s3_url }], &#8592; chunked upload</span></p><p><span>chunk_size_bytes: 4194304 (4 MB)</span></p><p><span>}</span></p><p><span>PUT {presigned_s3_url} (direct to S3 &#8212; server not in the upload path)</span></p><p><span>Body: binary chunk data</span></p><p><span>POST /v1/files/upload/complete</span></p><p><span>Body: { upload_id, chunk_etags: [{ chunk_index, etag }] }</span></p><p><span>Response: { file_id, version_id, path, created_at }</span></p><p><span>GET /v1/files/:file_id/download</span></p><p><span>Response: { presigned_download_url, expires_at }</span></p><p><span>GET /v1/sync/changes</span></p><p><span>Query: { cursor: string, limit: int } &#8592; long-poll or SSE</span></p><p><span>Response: { changes: [...], new_cursor: string, has_more: bool }</span></p><p><span>POST /v1/files/:file_id/conflict</span></p><p><span>Body: { </span></p><p><span>local_version_id, server_version_id, resolution: &#8220;keep_local&#8221; | &#8220;keep_server&#8221; | &#8220;keep_both&#8221; </span></p><p><span>}</span></p><p><strong><span>The senior moves on this API:</span></strong></p></div><p><strong><span>Chunked upload with presigned URLs. </span></strong><span>Files go directly from the client to S3 &#8212; the API server never handles the binary data. This eliminates the API tier as a bandwidth bottleneck. The upload_id ties the chunks together; the etags from each chunk PUT allow S3 to assemble the final object via S3 multipart upload completion.</span></p><p><strong><span>The /sync/changes endpoint with cursors. </span></strong><span>This is the Dropbox API model (they call it list_folder/continue). Instead of polling &#8220;what changed since timestamp X,&#8221; the client maintains an opaque cursor that encodes its sync state. The server returns everything the client has missed since that cursor position. This handles offline sync correctly: a device that was offline for 2 weeks reconnects, passes its cursor, and gets all 2 weeks of changes in one call.</span></p><p><strong><span>The /conflict endpoint. </span></strong><span>Most candidates forget this exists. Conflict resolution is a user-facing operation &#8212; the client detects a conflict, shows the user, and the user or the system decides. Having an explicit endpoint for conflict resolution signals you&#8217;ve thought about the user-facing side of the distributed systems problem.</span></p><h3><span>Step 4 &#8212; Data Model</span></h3><p><span>files table</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_!OZl2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a0540c8-d1aa-4f5e-95db-38927f815ee5_932x386.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OZl2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a0540c8-d1aa-4f5e-95db-38927f815ee5_932x386.png 424w, https://substackcdn.com/image/fetch/$s_!OZl2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a0540c8-d1aa-4f5e-95db-38927f815ee5_932x386.png 848w, https://substackcdn.com/image/fetch/$s_!OZl2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a0540c8-d1aa-4f5e-95db-38927f815ee5_932x386.png 1272w, https://substackcdn.com/image/fetch/$s_!OZl2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a0540c8-d1aa-4f5e-95db-38927f815ee5_932x386.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!OZl2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a0540c8-d1aa-4f5e-95db-38927f815ee5_932x386.png" width="932" height="386" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1a0540c8-d1aa-4f5e-95db-38927f815ee5_932x386.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:386,&quot;width&quot;:932,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:56076,&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/203652121?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a0540c8-d1aa-4f5e-95db-38927f815ee5_932x386.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_!OZl2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a0540c8-d1aa-4f5e-95db-38927f815ee5_932x386.png 424w, https://substackcdn.com/image/fetch/$s_!OZl2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a0540c8-d1aa-4f5e-95db-38927f815ee5_932x386.png 848w, https://substackcdn.com/image/fetch/$s_!OZl2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a0540c8-d1aa-4f5e-95db-38927f815ee5_932x386.png 1272w, https://substackcdn.com/image/fetch/$s_!OZl2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a0540c8-d1aa-4f5e-95db-38927f815ee5_932x386.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!qnXd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffeed24e7-3438-4a88-9fec-2891c3fb2b99_937x472.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qnXd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffeed24e7-3438-4a88-9fec-2891c3fb2b99_937x472.png 424w, https://substackcdn.com/image/fetch/$s_!qnXd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffeed24e7-3438-4a88-9fec-2891c3fb2b99_937x472.png 848w, https://substackcdn.com/image/fetch/$s_!qnXd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffeed24e7-3438-4a88-9fec-2891c3fb2b99_937x472.png 1272w, https://substackcdn.com/image/fetch/$s_!qnXd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffeed24e7-3438-4a88-9fec-2891c3fb2b99_937x472.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qnXd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffeed24e7-3438-4a88-9fec-2891c3fb2b99_937x472.png" width="937" height="472" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/feed24e7-3438-4a88-9fec-2891c3fb2b99_937x472.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:472,&quot;width&quot;:937,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:96715,&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/203652121?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffeed24e7-3438-4a88-9fec-2891c3fb2b99_937x472.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_!qnXd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffeed24e7-3438-4a88-9fec-2891c3fb2b99_937x472.png 424w, https://substackcdn.com/image/fetch/$s_!qnXd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffeed24e7-3438-4a88-9fec-2891c3fb2b99_937x472.png 848w, https://substackcdn.com/image/fetch/$s_!qnXd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffeed24e7-3438-4a88-9fec-2891c3fb2b99_937x472.png 1272w, https://substackcdn.com/image/fetch/$s_!qnXd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffeed24e7-3438-4a88-9fec-2891c3fb2b99_937x472.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong><span>The content_hash &#8594; storage_key mapping is the deduplication mechanism. </span></strong><span>Before storing a file, the server checks whether content_hash already exists in the storage index. If it does, it reuses the existing S3 object and just creates a new metadata row pointing to it. The same file can be &#8220;owned&#8221; by millions of users but stored in S3 once.</span></p><blockquote><p><span>file_versions table</span></p></blockquote><p><span>version_id, file_id (FK), version_number, content_hash, size_bytes,</span></p><p><span>storage_key, created_by_device_id, created_at, is_current</span></p><p><span>Every modification creates a new version row. The is_current flag moves to the newest version. Old versions are retained for 30 days (configurable), then the storage_key reference is eligible for deletion if no other version or file points to it.</span></p><blockquote><p><span>sync_cursors table</span></p></blockquote><p><span>cursor_id, device_id, user_id, last_processed_change_id, updated_at</span></p><p><span>Each device has a cursor. When the device calls /sync/changes, the server returns all changes after last_processed_change_id for that user, then updates the cursor. The cursor is device-specific, not user-specific &#8212; each device tracks its own sync position independently.</span></p><p><span>change_log table &#8212; the sync feed</span></p><p><span>change_id (SEQUENTIAL), user_id (INDEXED), file_id, change_type</span></p><p><span>(created/modified/deleted/moved),</span></p><p><span>version_id, changed_by_device_id, changed_at</span></p><p><span>This is the append-only event log that drives sync. Every file operation appends a row. When a device calls /sync/changes?cursor=X, the query is simply: SELECT * FROM change_log WHERE user_id=:uid AND change_id &gt; :cursor_change_id ORDER BY change_id LIMIT :limit. Fast, simple, correct.</span></p><p><span>The change_id is a sequential integer (not UUID). Sequential IDs make the range query above maximally efficient. They can be generated by Postgres sequences on a per-user basis, or by a distributed ID sequence (Snowflake-style, with the user_id encoded in the ID).</span></p>
      <p>
          <a href="https://systemdr.systemdrd.com/p/design-google-drive-dropbox-the-senior">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[The 30 Days Before Your Onsite]]></title><description><![CDATA[Learn System Design with System building, Subscribe Hands On coding course - LogStream]]></description><link>https://systemdr.systemdrd.com/p/the-30-days-before-your-onsite</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/the-30-days-before-your-onsite</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Sun, 05 Jul 2026 03:30:50 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!9fp5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd8a98f8-87c5-4711-b5be-e6a23cf7ba38_2000x1125.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="callout-block" data-callout="true"><p><span>Learn </span><strong><span>System Design with System building, Subscribe Hands On coding course - </span><a href="https://sdcourse.substack.com/p/start-here-how-to-use-sdcourse">LogStream</a></strong></p></div><p>Thirty days. One onsite loop. Here&#8217;s the plan I&#8217;d actually follow &#8212; not the plan that covers everything, because thirty days cannot cover everything, but the plan that prepares you for the specific interview in front of you.</p><p><strong>The principle: targeted depth beats broad coverage</strong></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>Thirty days of prep that covers six archetypes shallowly will lose to twenty days of prep that covers two archetypes deeply, plus ten days of mock interviews.</p><p>The engineers who pass consistently aren&#8217;t universally prepared. They&#8217;re specifically well-prepared for the questions they&#8217;re most likely to face. At most companies, a single loop involves one or two system design questions. If you know your target company&#8217;s interview patterns, you know which two archetypes to prioritize.</p><p>Research your target company before you start prep. Look at Glassdoor, Blind, and LinkedIn connections who&#8217;ve interviewed there recently. Identify the two most commonly asked archetypes. Those are your week 1 and week 2.</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><p><strong>Week 1 (Days 1&#8211;7): Deep drill, archetype #1</strong></p><p>Pick the most likely archetype for your target company. Read two walkthroughs from that archetype fully. Don&#8217;t drill yet &#8212; read to understand the pattern.</p><p>Then do three timed cold drills from that archetype on days 3, 5, and 7:</p><ul><li><p>Set a 50-minute timer</p></li><li><p>Design on paper with no notes, no searching</p></li><li><p>When the timer ends, open the walkthrough and compare section by section</p></li><li><p>Write down the top 3 specific gaps between your answer and the walkthrough</p></li></ul><p>By day 7, you should produce a structurally correct answer &#8212; not perfect, but with the right components in the right places and the key failure modes named.</p><p><strong>Week 2 (Days 8&#8211;14): Deep drill, archetype #2</strong></p><p>Same structure. Different archetype &#8212; your second most likely one.</p><p>After two weeks, you have deep coverage of the two archetypes most likely to come up. That alone puts you in better position than most candidates who drilled 15 questions shallowly.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9fp5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd8a98f8-87c5-4711-b5be-e6a23cf7ba38_2000x1125.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9fp5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd8a98f8-87c5-4711-b5be-e6a23cf7ba38_2000x1125.png 424w, https://substackcdn.com/image/fetch/$s_!9fp5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd8a98f8-87c5-4711-b5be-e6a23cf7ba38_2000x1125.png 848w, https://substackcdn.com/image/fetch/$s_!9fp5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd8a98f8-87c5-4711-b5be-e6a23cf7ba38_2000x1125.png 1272w, https://substackcdn.com/image/fetch/$s_!9fp5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd8a98f8-87c5-4711-b5be-e6a23cf7ba38_2000x1125.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9fp5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd8a98f8-87c5-4711-b5be-e6a23cf7ba38_2000x1125.png" width="1456" height="819" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fd8a98f8-87c5-4711-b5be-e6a23cf7ba38_2000x1125.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:819,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:271647,&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/198937553?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd8a98f8-87c5-4711-b5be-e6a23cf7ba38_2000x1125.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_!9fp5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd8a98f8-87c5-4711-b5be-e6a23cf7ba38_2000x1125.png 424w, https://substackcdn.com/image/fetch/$s_!9fp5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd8a98f8-87c5-4711-b5be-e6a23cf7ba38_2000x1125.png 848w, https://substackcdn.com/image/fetch/$s_!9fp5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd8a98f8-87c5-4711-b5be-e6a23cf7ba38_2000x1125.png 1272w, https://substackcdn.com/image/fetch/$s_!9fp5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd8a98f8-87c5-4711-b5be-e6a23cf7ba38_2000x1125.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Week 3 (Days 15&#8211;21): Coverage and breadth</strong></p><p>Spend week 3 doing shorter 30-minute drills across 4&#8211;5 archetypes you haven&#8217;t deeply covered. The goal is exposure, not mastery. Knowing the basic shape of an answer for a question you&#8217;re 20% likely to face is much better than having no answer.</p><p>The 30-minute format requires discipline: force yourself to reach the architecture step within 15 minutes. Don&#8217;t let estimation and API design consume your entire drill &#8212; practice moving through the framework efficiently.</p><p>Also in week 3: re-read the estimation numbers cheatsheet and the trade-offs cheatsheet. These apply to every question. Refreshing them mid-prep rather than at the very end gives them time to consolidate.</p><p><strong>Week 4 (Days 22&#8211;28): Two mocks with real feedback</strong></p><p>Stop reading. Stop drilling solo. Do two mock interviews with people who will give you specific, scored feedback.</p><p>The first mock: peer at your target level. Ask them to score you on the 8 dimensions of the take-home rubric. Ask them specifically whether your scoping, communication, and failure mode coverage were strong.</p><p>The second mock: someone above your target level. Their feedback will be harder to hear and more useful. What L6 candidates do that you&#8217;re not doing yet &#8212; that&#8217;s the gap you have four days to close before the interview.</p><p>After each mock: identify the single most impactful change. Spend two days on that one thing. One change made well is more valuable than ten changes made half-heartedly.</p><p><strong>Days 29&#8211;30: Consolidation only</strong></p><p>Day 29: one short drill (30 minutes), no new material. Re-read the framework cheatsheet. That&#8217;s it.</p><p>Day 30 (the day before): re-read the drill card for the archetype most likely to come up at your target company. This takes four minutes. Then stop.</p><p>Don&#8217;t read a new walkthrough the night before. New information the night before competes with everything you&#8217;ve consolidated and doesn&#8217;t have time to integrate. Rest is a legitimate and important part of preparation. Use it.</p><p><strong>What this plan produces</strong></p><p>After thirty days:</p><ul><li><p>Two archetypes with genuine depth and pattern recognition</p></li><li><p>Coverage-level familiarity with four to five additional archetypes</p></li><li><p>Two mocks with documented gaps and one specific improvement made to each</p></li><li><p>The framework cheatsheet and estimation numbers fresh in working memory</p></li></ul><p>You&#8217;ll encounter a question you&#8217;re less prepared for. When that happens, apply the framework. The six-step framework works on questions you haven&#8217;t drilled &#8212; that&#8217;s what it&#8217;s for. The warmup from four weeks of drilling makes the framework run faster and more automatically under pressure.</p><p><strong>The thing most people get wrong</strong></p><p>The ratio of reading to drilling in most engineers&#8217; prep is about 80:20. Reading walkthroughs, reading concept explainers, reading other people&#8217;s summaries.</p><p>The ratio that produces results is closer to 40:60 &#8212; 40% reading and learning, 60% timed drills and mocks. The performance gap between knowing something and producing it under pressure in front of someone is real and only closes with practice under pressure.</p><p>If you have thirty days and you spend twenty-five of them reading, you&#8217;ve done the easy part and skipped the hard part. Do the hard part.</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><hr></div><p><strong>CTA:</strong> </p><p>Paid subscribers get one full system design walkthrough </p><p>every Tuesday &#8212; each mapped to its archetype so you build </p><p>pattern recognition, not answer memorization. </p><p>This week: Google Drive / Dropbox.</p><p><a href="https://systemdr.systemdrd.com/subscribe">https://systemdr.systemdrd.com/subscribe</a></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>Want the complete learning path?</strong></p><p>Unlock advanced modules, case studies, and guided exercises.</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[Design Netflix Streaming — The Senior+ Walkthrough]]></title><description><![CDATA[This is the question that defines the streaming media archetype.]]></description><link>https://systemdr.systemdrd.com/p/design-netflix-streaming-the-senior</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/design-netflix-streaming-the-senior</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Tue, 30 Jun 2026 03:30:15 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/324af9c3-c814-47c5-aa06-d7d6afe30dae_1132x657.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote><p><span>This is the question that defines: </span></p></blockquote><blockquote><p><span>The surface question sounds manageable. Netflix streams video to 270 million subscribers. How hard can it be to store a file and serve it? The probe underneath is what makes this question a senior filter. The interviewer is not testing whether you know what a CDN is. They are testing whether you understand why naive HTTP file serving collapses at scale, what adaptive bitrate encoding is and why it exists, how a CDN edge network makes cold-start latency irrelevant, and what happens when the most-watched show in the world premieres at 9 PM and 50 million people try to start the same episode simultaneously.</span></p></blockquote><p><span>Those four problems &#8212; not the basic architecture &#8212; are where the round is decided.</span></p><p><span>For L4 / mid-level: the content storage and delivery pipeline at a high level. For L5 / senior: adaptive bitrate encoding with multiple renditions, CDN edge caching with pre-positioning, and the cold-start problem. For L6 / staff: the encoding pipeline at scale, multi-region active-active CDN strategy, the playback session architecture, quality-of-experience monitoring, and what Netflix actually does differently from a naive CDN deployment.</span></p><p><span>The Question</span></p><blockquote><p><span>&#8220;Design Netflix. Users should be able to browse a catalog of movies and TV shows and stream them on demand with high quality and low buffering.&#8221;</span></p></blockquote><p><span>Common variants:</span></p><blockquote><p><span>- &#8220;Design YouTube&#8217;s video streaming system.&#8221;</span></p><p><span>- &#8220;Design Spotify&#8217;s audio streaming.&#8221;</span></p><p><span>- &#8220;Design Twitch&#8217;s live streaming platform.&#8221;</span></p><p><span>- &#8220;Design an adaptive bitrate streaming system.&#8221;</span></p><p><span>- &#8220;Design the video encoding pipeline for a platform like Netflix.&#8221;</span></p></blockquote><p><span>The first two are nearly identical to Netflix. Twitch adds a real-time constraint (live, not on-demand) that changes the delivery model but not the encoding fundamentals. Spotify replaces video with audio &#8212; smaller files, same adaptive delivery architecture. The encoding pipeline variant focuses specifically on Phase 2 below.</span></p><h3><span>Step 1 &#8212; Clarify Before You Draw</span></h3><p><span>Six questions. The first three are load-bearing.</span></p><p><strong><span>1. On-demand only, or also live streaming? </span></strong><span>On-demand (Netflix, Spotify) and live (Twitch, live sports) have meaningfully different architectures. On-demand content can be pre-encoded, pre-cached at CDN edges, and optimized offline. Live content has a latency requirement (viewers want near-real-time) that forces a different delivery model. Clarify and scope to on-demand unless told otherwise.</span></p><p><strong><span>2. What devices must be supported? </span></strong><span>Smart TVs, mobile (iOS/Android), web browsers, game consoles. This matters because different devices support different codecs (H.264, H.265/HEVC, AV1, VP9) and different DRM systems (Widevine, FairPlay, PlayReady). Acknowledge the codec diversity; don&#8217;t try to design the full DRM system in the interview &#8212; it&#8217;s a separate subsystem.</span></p><p><strong><span>3. What are the quality and latency SLOs? </span></strong><span>Netflix targets: playback starts within 2 seconds of pressing play. Buffering events under 0.5% of total play time. 4K HDR delivery available on supported devices. These numbers drive every architecture decision &#8212; state them explicitly before drawing anything.</span></p><p><strong><span>4. What is the catalog size? </span></strong><span>Netflix has approximately 36,000 titles globally (varies by region). Each title is stored in multiple renditions and formats. State the working assumption: 36,000 titles &#215; 20 renditions &#215; ~4 GB per rendition = ~3 PB of encoded video. This estimate calibrates the storage and CDN design.</span></p><p><strong><span>5. What scale? </span></strong><span>270 million subscribers. Peak concurrent streams: approximately 15&#8211;20% of active users simultaneously &#8212; roughly 40&#8211;50 million concurrent streams. At peak (new season premiere, weekend evening), this spikes significantly. State the peak assumption explicitly.</span></p><p><strong><span>6. Does the design include recommendations, search, and the catalog UI? </span></strong><span>These are separate systems (ML recommendation engine, search index, catalog metadata API). Acknowledge they exist; scope the interview to the streaming pipeline &#8212; content ingestion, encoding, storage, and delivery. Otherwise you&#8217;ll spend 30 minutes on recommendation and never get to the hard part.</span></p><h3><span>Step 2 &#8212; Estimate</span></h3><p><span>Working assumptions:</span></p><blockquote><p><span>- 36,000 titles &#215; 20 renditions per title = 720,000 encoded files</span></p><p><span>- Average rendition size: 4 GB (HD, 2-hour movie)</span></p><p><span>- Total encoded storage: 720,000 &#215; 4 GB &#8776; </span><strong><span>3 PB </span></strong><span>of video content</span></p><p><span>- Metadata storage (titles, posters, descriptions, subtitles): ~5 TB &#8212; trivial by comparison - Peak concurrent streams: 50 million</span></p><p><span>- Average bitrate served: 5 Mbps (mix of HD and 4K streams)</span></p><p><span>- Peak egress bandwidth: 50M streams &#215; 5 Mbps = </span><strong><span>250 Tbps</span></strong></p></blockquote><p><span>That 250 Tbps peak egress number is the most important figure in the whole estimate. Netflix is one of the largest sources of internet traffic on the planet &#8212; at peak, it accounts for roughly 15% of global downstream internet bandwidth. No single origin infrastructure serves this. CDN edge servers distributed globally are the only viable answer. State this conclusion explicitly from the estimate.</span></p><p><span>Content ingestion rate: Netflix adds roughly 500&#8211;1,000 hours of new content per month. At 20 renditions per title, that&#8217;s ~10,000&#8211;20,000 encoding jobs per month &#8212; a background batch process, not a latency-sensitive path.</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><h3><span>Step 3 &#8212; API Design</span></h3><p><span>Four APIs. The streaming API is the non-obvious one.</span></p><div class="callout-block" data-callout="true"><p><span>GET /v1/catalog</span></p><p><span>Query: page_token, limit, genre?, region</span></p><p><span>Response: { titles: [...], next_page_token }</span></p><p><span>Note: region-filtered &#8212; different catalogs per country (licensing)</span></p><p><span>GET /v1/titles/:title_id</span></p><p><span>Response: {</span></p><p><span>title_id, name, description, genres, cast,</span></p><p><span>available_resolutions: [&#8221;4K&#8221;, &#8220;1080p&#8221;, &#8220;720p&#8221;, &#8220;480p&#8221;],</span></p><p><span>subtitles: [{ language, url }],</span></p><p><span>poster_url, trailer_url</span></p><p><span>}</span></p><p><span>POST /v1/playback/start</span></p><p><span>Body: {</span></p><p><span>title_id: string,</span></p><p><span>content_id: string, (specific episode or movie version)</span></p><p><span>device_type: string,</span></p><p><span>supported_codecs: [&#8221;H264&#8221;, &#8220;H265&#8221;, &#8220;AV1&#8221;],</span></p><p><span>network_speed_mbps: float, &#8592; client measures and reports</span></p><p><span>drm_system: &#8220;widevine&#8221; | &#8220;fairplay&#8221; | &#8220;playready&#8221;,</span></p><p><span>resume_position_seconds: integer</span></p><p><span>}</span></p><p><span>Response: {</span></p><p><span>session_id: string,</span></p><p><span>manifest_url: string, &#8592; THE KEY RESPONSE FIELD</span></p><p><span>license_token: string, (for DRM decryption)</span></p><p><span>cdn_edge_url: string,</span></p><p><span>initial_quality: &#8220;1080p&#8221;,</span></p><p><span>heartbeat_interval_seconds: 30</span></p><p><span>}</span></p><p><span>POST /v1/playback/heartbeat</span></p><p><span>Body: {</span></p><p><span>session_id: string,</span></p><p><span>position_seconds: integer,</span></p><p><span>current_quality: string,</span></p><p><span>buffer_health_seconds:</span></p><p><span>float,</span></p><p><span>rebuffer_events: integer,</span></p><p><span>bandwidth_estimate_mbps: float</span></p><p><span>}</span></p><p><span>Response: { continue: true, quality_recommendation: &#8220;720p&#8221; }</span></p></div><p><strong><span>The senior move here: </span></strong><span>The </span><span data-color="rgb(24, 128, 56)" style="color: rgb(24, 128, 56);">manifest_url </span><span>in the playback start response is the key design signal. You are not returning a video file URL &#8212; you are returning a manifest file URL. This distinction is the entire adaptive bitrate streaming architecture. Explain it before moving on.</span></p><p><strong><span>The </span><span data-color="rgb(24, 128, 56)" style="color: rgb(24, 128, 56);">heartbeat </span><span>endpoint </span></strong><span>is the second senior signal. Netflix does not stream and forget. Every 30 seconds, the player reports back: current position, current quality, buffer health, rebuffer events, estimated bandwidth. This telemetry is the basis for quality-of-experience monitoring, A/B testing new streaming algorithms, and detecting degraded CDN nodes before users notice. Candidates who include the heartbeat signal they&#8217;ve thought about the operational layer, not just the happy path.</span></p><h3><span>Step 4 &#8212; Data Model</span></h3><p><span>Five stores. Video content itself is not in any of these &#8212; it lives in object storage.</span></p><p><span data-color="rgb(24, 128, 56)" style="color: rgb(24, 128, 56);">titles </span><span data-color="rgb(67, 67, 67)" style="color: rgb(67, 67, 67);">table &#8212; catalog metadata</span></p><p><span>title_id, title, description, genres[], cast[], director,</span></p><p><span>release_year, rating, available_regions[], duration_seconds,</span></p><p><span>thumbnail_url, created_at, updated_at</span></p><p><span>Sharded by </span><span data-color="rgb(24, 128, 56)" style="color: rgb(24, 128, 56);">title_id</span><span>. Regional availability (</span><span data-color="rgb(24, 128, 56)" style="color: rgb(24, 128, 56);">available_regions[]</span><span>) drives catalog filtering &#8212; a subscriber in Germany sees a different catalog than one in the US because Netflix licenses content per territory.</span></p><p><span data-color="rgb(24, 128, 56)" style="color: rgb(24, 128, 56);">content_assets </span><span data-color="rgb(67, 67, 67)" style="color: rgb(67, 67, 67);">table &#8212; encoded renditions index</span></p><p><span>content_id, title_id, rendition_type (4K/1080p/720p/480p/360p),</span></p><p><span>codec (H264/H265/AV1), bitrate_kbps, file_size_bytes,</span></p><p><span>storage_uri (S3 path), manifest_uri, duration_seconds,</span></p><p><span>encoding_status (pending/processing/ready), created_at</span></p><p style="text-align: justify;"><span>The </span><span data-color="rgb(24, 128, 56)" style="color: rgb(24, 128, 56);">manifest_uri </span><span>points to the HLS or DASH manifest file in S3 &#8212; the index of all segments for this rendition. When the player starts playback, it downloads the manifest first, then requests individual segments.</span></p><p><span data-color="rgb(24, 128, 56)" style="color: rgb(24, 128, 56);">playback_sessions </span><span data-color="rgb(67, 67, 67)" style="color: rgb(67, 67, 67);">table &#8212; active and recent sessions </span><span>session_id, user_id, content_id, device_type, started_at,</span></p><p><span>last_heartbeat_at, current_position_seconds, current_quality,</span></p><p><span>total_play_time_seconds, rebuffer_count, total_rebuffer_seconds</span></p><p><span>Not stored in your OLTP database. High-frequency writes (heartbeat every 30 seconds, 50M concurrent sessions = ~1.7M writes/sec). Use Cassandra or a time-series store. Partition by </span><span data-color="rgb(24, 128, 56)" style="color: rgb(24, 128, 56);">user_id </span><span>so &#8220;resume where I left off&#8221; is a single-partition read. Short TTL &#8212; you only need the last 30 days of session data for analytics; older data goes to cold storage.</span></p><p><span data-color="rgb(24, 128, 56)" style="color: rgb(24, 128, 56);">user_watch_history </span><span data-color="rgb(67, 67, 67)" style="color: rgb(67, 67, 67);">&#8212; resume position and completion </span><span>user_id, title_id, content_id, position_seconds, completed (boolean), watched_at, device_type</span></p><p><span>This is what powers &#8220;continue watching.&#8221; Separate from the playback session &#8212; a session is live, watch history is the permanent record. Partition by </span><span data-color="rgb(24, 128, 56)" style="color: rgb(24, 128, 56);">user_id</span><span>.</span></p><p><span data-color="rgb(67, 67, 67)" style="color: rgb(67, 67, 67);">CDN content index &#8212; not a database table</span></p><p><span>The CDN&#8217;s internal index of what content is cached at which edge location. You don&#8217;t design this &#8212; it&#8217;s the CDN&#8217;s internal state. What you do design is the </span><strong><span>pre-positioning logic</span></strong><span>: before a major content release (new season of a hit show), Netflix pre-pushes the encoded files to CDN edge servers before playback demand arrives. This is called </span><strong><span>content pre-warming </span></strong><span>and it is one of the most important operational patterns in the whole system.</span></p><div class="callout-block" data-callout="true"><p><span data-color="rgb(54, 55, 55)" style="color: rgb(54, 55, 55);">Preparing for a distributed systems interview?</span><br><span data-color="rgb(54, 55, 55)" style="color: rgb(54, 55, 55);">&#8594;</span><a href="https://systemdrd.com/ebooks/sdcourse-distributed-systems-interview">Download the free Interview Pack</a><br><span data-color="rgb(54, 55, 55)" style="color: rgb(54, 55, 55);">&#8594; </span><a href="https://systemdr.systemdrd.com/subscribe">Subscribe</a><span data-color="rgb(54, 55, 55)" style="color: rgb(54, 55, 55);"> now to access source code repository - 200 + coding lessons</span></p></div>
      <p>
          <a href="https://systemdr.systemdrd.com/p/design-netflix-streaming-the-senior">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[CAP Theorem: What It Actually Means in an Interview]]></title><description><![CDATA[CAP theorem is one of the most cited concepts in system design interviews and one of the most consistently misapplied.]]></description><link>https://systemdr.systemdrd.com/p/cap-theorem-what-it-actually-means</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/cap-theorem-what-it-actually-means</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Sun, 28 Jun 2026 03:30:29 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!BCp6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0e9faf1-9cfd-4567-bff5-384ec310be38_4675x2750.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>CAP theorem is one of the most cited concepts in system design interviews and one of the most consistently misapplied.</p><p>The standard failure mode: a candidate mentions CAP theorem as a vocabulary signal (&#8221;we need to think about the CAP trade-off here&#8221;), states the three letters (Consistency, Availability, Partition tolerance), and moves on without connecting it to a concrete decision.</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>The interviewer writes &#8220;mentioned CAP but couldn&#8217;t apply it.&#8221; The round continues.</p><p>Here&#8217;s what applying it actually looks like.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!BCp6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0e9faf1-9cfd-4567-bff5-384ec310be38_4675x2750.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!BCp6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0e9faf1-9cfd-4567-bff5-384ec310be38_4675x2750.png 424w, https://substackcdn.com/image/fetch/$s_!BCp6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0e9faf1-9cfd-4567-bff5-384ec310be38_4675x2750.png 848w, https://substackcdn.com/image/fetch/$s_!BCp6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0e9faf1-9cfd-4567-bff5-384ec310be38_4675x2750.png 1272w, https://substackcdn.com/image/fetch/$s_!BCp6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0e9faf1-9cfd-4567-bff5-384ec310be38_4675x2750.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!BCp6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0e9faf1-9cfd-4567-bff5-384ec310be38_4675x2750.png" width="1456" height="856" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f0e9faf1-9cfd-4567-bff5-384ec310be38_4675x2750.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:856,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:779742,&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/198937089?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0e9faf1-9cfd-4567-bff5-384ec310be38_4675x2750.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_!BCp6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0e9faf1-9cfd-4567-bff5-384ec310be38_4675x2750.png 424w, https://substackcdn.com/image/fetch/$s_!BCp6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0e9faf1-9cfd-4567-bff5-384ec310be38_4675x2750.png 848w, https://substackcdn.com/image/fetch/$s_!BCp6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0e9faf1-9cfd-4567-bff5-384ec310be38_4675x2750.png 1272w, https://substackcdn.com/image/fetch/$s_!BCp6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0e9faf1-9cfd-4567-bff5-384ec310be38_4675x2750.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>What CAP actually says</strong></p><p>CAP theorem says: in the presence of a network partition &#8212; when some nodes in your distributed system can&#8217;t communicate with others &#8212; you must choose between consistency and availability. You cannot have both.</p><p><em>Consistency</em> here means: every read returns the most recent write, or an error. Every node agrees on the current state.</p><p><em>Availability</em> means: every request gets a response. It may not be the most recent data, but the system doesn&#8217;t error or time out.</p><p><em>Partition tolerance</em> isn&#8217;t a choice &#8212; it&#8217;s a given. If you&#8217;re building a distributed system that runs over a real network, partitions happen. Network cables fail. Datacenters lose connectivity. You cannot opt out of partition tolerance. The real choice is always: when a partition happens, do you stay consistent or available?</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.com/subscribe&quot;,&quot;text&quot;:&quot;Subscribe for Payments 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 Payments Walkthrough</span></a></p><p><strong>Where it actually matters</strong></p><p>The question is rarely &#8220;should I build a CP or AP system?&#8221; That&#8217;s too abstract to be useful. The useful version is: for <em>this specific read</em>, how stale can the data be before it causes a real problem?</p><p>Some reads tolerate stale data completely. Your Twitter follower count being one minute stale costs nothing. Your Netflix streaming recommendation being 24 hours stale costs nothing. These are candidates for eventual consistency &#8212; replicate async, serve locally, accept a brief window of inconsistency.</p><p>Some reads cannot tolerate stale data. Your bank account balance must be accurate before a payment is authorized. Your ticket reservation must be current before a seat is sold. These require strong consistency &#8212; at the cost of higher latency and potential availability loss during a partition.</p><p>The L5 answer isn&#8217;t &#8220;I&#8217;ll use eventual consistency.&#8221; It&#8217;s: &#8220;For the timeline read, I&#8217;ll accept eventual consistency &#8212; a post appearing 30 seconds late costs nothing. For the payment authorization, I need strong consistency &#8212; an incorrect balance check is a real financial loss. These two paths use different consistency models within the same system.&#8221;</p><p><strong>PACELC: the extension worth knowing</strong></p><p>CAP only talks about partition scenarios. PACELC extends the model to the normal case: even without a partition, there&#8217;s a trade-off between latency and consistency. If you want every read to reflect the latest write, you need to coordinate across replicas &#8212; which adds latency. If you serve from the nearest replica without coordination, you have lower latency but possible stale reads.</p><p>Knowing PACELC by name is a mild L6 signal. More importantly, understanding that the consistency/latency trade-off exists even on sunny days is what matters.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ufc7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9801ff2-eb55-43be-a9d1-86c9c5ad7a82_4950x2860.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ufc7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9801ff2-eb55-43be-a9d1-86c9c5ad7a82_4950x2860.png 424w, https://substackcdn.com/image/fetch/$s_!Ufc7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9801ff2-eb55-43be-a9d1-86c9c5ad7a82_4950x2860.png 848w, https://substackcdn.com/image/fetch/$s_!Ufc7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9801ff2-eb55-43be-a9d1-86c9c5ad7a82_4950x2860.png 1272w, https://substackcdn.com/image/fetch/$s_!Ufc7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9801ff2-eb55-43be-a9d1-86c9c5ad7a82_4950x2860.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ufc7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9801ff2-eb55-43be-a9d1-86c9c5ad7a82_4950x2860.png" width="1456" height="841" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e9801ff2-eb55-43be-a9d1-86c9c5ad7a82_4950x2860.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;:958688,&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/198937089?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9801ff2-eb55-43be-a9d1-86c9c5ad7a82_4950x2860.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_!Ufc7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9801ff2-eb55-43be-a9d1-86c9c5ad7a82_4950x2860.png 424w, https://substackcdn.com/image/fetch/$s_!Ufc7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9801ff2-eb55-43be-a9d1-86c9c5ad7a82_4950x2860.png 848w, https://substackcdn.com/image/fetch/$s_!Ufc7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9801ff2-eb55-43be-a9d1-86c9c5ad7a82_4950x2860.png 1272w, https://substackcdn.com/image/fetch/$s_!Ufc7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9801ff2-eb55-43be-a9d1-86c9c5ad7a82_4950x2860.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>The three decisions CAP drives in practice</strong></p><p>When you reach the data model step in a design interview, CAP should inform exactly three things:</p><p><em>Replication strategy.</em> Synchronous replication (every write waits for all replicas to confirm) gives strong consistency at the cost of write latency. Asynchronous replication (write confirms when the leader writes, replicas catch up later) gives lower write latency but a brief consistency window.</p><p><em>Read routing.</em> If you route reads to the leader only, you always get the latest data. If you route reads to any replica, you get lower latency but potentially stale data. Pick based on what each read is for.</p><p><em>Conflict resolution.</em> When two nodes accept writes for the same key during a partition, you have a conflict. Last-writer-wins, vector clocks, CRDTs, operational transforms &#8212; each is a different answer to the same CAP-induced conflict problem.</p><p>The engineers who use CAP well in interviews don&#8217;t mention it as a signal. They use it as a decision tool. &#8220;For the payment authorization read, I need consistency over availability &#8212; I&#8217;ll route to the leader and accept higher latency.&#8221; That sentence is CAP applied correctly. It doesn&#8217;t require saying &#8220;CAP&#8221; at all.</p><div><hr></div><p><strong>CTA:</strong> The Stripe Payments walkthrough (paid post #2) covers the consistency decisions in a payment system end-to-end &#8212; exactly where strong consistency is required, exactly where eventual is acceptable, and why.</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><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>Access all 52 Quesstions <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[Design WhatsApp — The Senior+ Walkthrough]]></title><description><![CDATA[This is the question that defines the real-time messaging archetype.]]></description><link>https://systemdr.systemdrd.com/p/design-whatsapp-the-senior-walkthrough</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/design-whatsapp-the-senior-walkthrough</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Tue, 23 Jun 2026 03:31:02 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!WJKt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8dea1b8-ed5c-460e-8728-796ec0b725f8_2048x1240.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote><p>This is the question that defines the real-time messaging archetype. Ten questions in the question bank are variants of it &#8212; Slack, Discord, Zoom, Twitter Spaces, iMessage, Facebook Messenger, Google Chat. They share a spine: a long-lived connection problem, a delivery semantics problem, and a presence problem. Get fluent with all three and you can answer any messaging interview you&#8217;re handed.</p></blockquote><blockquote><p>The surface question looks simple: two people want to send each other messages. The probe underneath is anything but. Interviewers use this question because it exposes how candidates think about distributed systems under failure &#8212; specifically what happens when the recipient is offline, when the network drops mid-message, when the same message arrives twice, and when a user has five devices. Those four failure modes, and your response to them, are where the round is decided.</p></blockquote><blockquote><p>For L4 / mid-level: the basic chat flow and message storage. For L5 / senior: delivery semantics under unreliable networks (at-most-once, at-least-once, exactly-once), presence at scale, and offline message handling. For L6 / staff: the multi-device consistency model, group message fan-out at WhatsApp&#8217;s scale (2 billion users), end-to-end encryption architecture, and what happens when a message is delivered to 256 group members across 12 time zones while half of them are offline.</p></blockquote><div><hr></div><h2>The Question</h2><blockquote><p>&#8220;Design WhatsApp. Users should be able to send messages to each other in real time. Messages should be delivered even when the recipient is temporarily offline.&#8221;</p></blockquote><p>Common variants:</p><ul><li><p>&#8220;Design Facebook Messenger.&#8221;</p></li><li><p>&#8220;Design iMessage / Apple Messages.&#8221;</p></li><li><p>&#8220;Design Slack&#8217;s messaging core.&#8221;</p></li><li><p>&#8220;Design a real-time chat system.&#8221;</p></li><li><p>&#8220;Design the messaging layer for [our product].&#8221;</p></li></ul><p>All five are the same architecture. Slack adds channels and threads; the delivery model is identical. iMessage adds end-to-end encryption; the transport is identical. Discord adds voice and server-based channels; the one-to-one messaging core is identical.</p><div><hr></div><h2>Step 1 &#8212; Clarify Before You Draw</h2><p>Six questions. Two of them are load-bearing for the entire design.</p><p><strong>1. One-to-one only, or also group chats?</strong> One-to-one is the simpler problem. Group chats add fan-out &#8212; sending one message to N recipients &#8212; which at WhatsApp&#8217;s scale means up to 256 recipients per group. State which you&#8217;re designing for. For L5+: design for both, but start with one-to-one and explicitly extend.</p><p><strong>2. What are the delivery guarantees?</strong> This is the load-bearing question. Three options:</p><ul><li><p><em>At-most-once:</em> messages might be lost but never duplicated. Fine for ephemeral signals (typing indicators). Terrible for chat.</p></li><li><p><em>At-least-once:</em> messages are definitely delivered but might be delivered more than once. The receiver handles deduplication. Acceptable for most chat systems.</p></li><li><p><em>Exactly-once:</em> messages are delivered exactly once, regardless of retries. Theoretically ideal. In practice, you can approximate it with idempotency keys and deduplication at the receiver &#8212; but you cannot achieve it perfectly across an unreliable network. Saying &#8220;exactly-once is impossible in a distributed system&#8221; out loud is a senior signal.</p></li></ul><p>WhatsApp and most production systems implement at-least-once delivery with client-side deduplication. State this explicitly.</p><p><strong>3. What devices does each user have?</strong> Multiple devices per user (phone, tablet, web, desktop) massively complicates the model. A message sent to a user needs to land on all their active devices. On which device does the &#8220;read receipt&#8221; trigger? Clarify this early.</p><p><strong>4. Offline handling &#8212; how long do you store messages for an offline recipient?</strong> If a recipient is offline for 30 days, do their messages accumulate on your servers? Most production systems store for 30 days and drop after that (with notification to sender). Clarify the retention window.</p><p><strong>5. End-to-end encryption?</strong> E2EE (like WhatsApp&#8217;s Signal Protocol implementation) means the server cannot read message content &#8212; it only stores encrypted ciphertext and routing metadata. This changes the data model significantly. State whether you&#8217;re designing with E2EE or not. For L5: acknowledge it exists and where it fits. For L6+: explain the key exchange flow.</p><p><strong>6. What scale?</strong> 2 billion monthly active users is WhatsApp&#8217;s actual scale. For the interview, pick a working number: 500M DAU, 100 billion messages per day (WhatsApp&#8217;s reported figure as of its scale). These numbers drive your storage and throughput estimates.</p><div><hr></div><h2>Step 2 &#8212; Estimate</h2><p>Working assumptions:</p><ul><li><p>500M daily active users</p></li><li><p>100 billion messages per day = ~1.16 million messages per second average, ~5M/sec peak</p></li><li><p>Average message size: 100 bytes (text only), 500 bytes with metadata</p></li><li><p>30-day message retention for offline recipients</p></li><li><p>1 billion messages stored at any moment (roughly 1% of daily volume is &#8220;pending delivery&#8221;)</p></li><li><p>Media (images, video, voice): handle separately via object storage (S3 / CDN pre-signed URLs); only metadata and a pointer lives in the chat system</p></li></ul><p>Storage for messages: 100B messages/day &#215; 500 bytes &#215; 30 days retention &#8776; 1.5 PB. This is your &#8220;hot&#8221; storage &#8212; messages waiting to be delivered or recently delivered. After 30 days, messages drop off the hot store. Delivered messages can be stored client-side and expunged from the server (this is exactly what WhatsApp does &#8212; server deletes after delivery confirmation).</p><p>Connection state: 500M users &#215; ~30% concurrently connected = ~150M concurrent WebSocket connections. At 64KB per connection socket buffer that&#8217;s roughly 9.6 TB of connection memory across your fleet. This is one of the hardest scaling problems in messaging &#8212; the number of open connections.</p><p>Write throughput: 1.16M messages/sec average into a message store. This rules out single-node anything. You need a distributed message queue and a sharded persistence layer.</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><h2>Step 3 &#8212; API Design</h2><p>Four endpoints. The real-time delivery is not REST &#8212; it&#8217;s a persistent connection.</p><p>WebSocket: wss://chat.whatsapp.com/connect</p><p>Auth:    Bearer token in Upgrade request headers</p><p>Purpose: The long-lived connection for receiving messages and sending keep-alives. All message delivery happens here.</p><p>On connect: server sends any pending (undelivered) messages accumulated while the client was offline.</p><div class="callout-block" data-callout="true"><p>POST /v1/messages/send</p><p>  Idempotency-Key: &lt;client-generated UUID&gt;     &#8592; THE PROBE</p><p>  Body: {</p><p>    to_user_id: string,</p><p>    message_id: string,        (client-generated, for dedup)</p><p>    content_encrypted: bytes,  (ciphertext if E2EE)</p><p>    content_type: &#8220;text&#8221; | &#8220;image&#8221; | &#8220;audio&#8221; | &#8220;video&#8221;,</p><p>    media_url: string,         (pre-uploaded, optional)</p><p>    client_timestamp: epoch_ms</p><p>  }</p><p>  Response: {</p><p>    message_id: string,</p><p>    server_timestamp: epoch_ms,</p><p>    status: &#8220;queued&#8221; | &#8220;delivered&#8221;</p><p>  }</p><p>POST /v1/messages/ack</p><p>  Body: { message_id: string, ack_type: &#8220;delivered&#8221; | &#8220;read&#8221; }</p><p>  Purpose: Explicit delivery and read acknowledgment from client.</p><p>           Server relays read receipts back to sender.</p><p>GET /v1/users/:user_id/presence</p><p>  Response: { status: &#8220;online&#8221; | &#8220;offline&#8221; | &#8220;last_seen_at&#8221;: timestamp }</p><p>  Note: WhatsApp makes presence opt-out &#8212; users can hide last seen.</p><p>        This is a privacy setting, not a system constraint.</p></div><p><strong>The senior move on the API step:</strong> Name the Idempotency-Key and message_id in the same breath. The message_id is client-generated before the send &#8212; if the client retries because it didn&#8217;t receive an ack, the server detects the duplicate via message_id and does not re-queue. The Idempotency-Key is the HTTP-level dedup. Both are necessary: the HTTP key handles transport-level retries, the message_id handles application-level deduplication across devices and reconnections.</p><p>Saying that distinction out loud &#8212; <em>two levels of deduplication for two different failure modes</em> &#8212; is the L6 signal on this question.</p><div class="callout-block" data-callout="true"><p><a href="https://systemdr.systemdrd.com/subscribe">Subscribe</a> now to <br>&#8594;unlock complete system design walkthroughs<br>&#8594; Get access to downloadable Drill Cards and full walkthrough</p></div>
      <p>
          <a href="https://systemdr.systemdrd.com/p/design-whatsapp-the-senior-walkthrough">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[The Scoping Discipline — Why Engineers Design Too Much]]></title><description><![CDATA[Learn System Design with System building, Subscribe Hands On coding course - LogStream]]></description><link>https://systemdr.systemdrd.com/p/the-scoping-discipline</link><guid isPermaLink="false">https://systemdr.systemdrd.com/p/the-scoping-discipline</guid><dc:creator><![CDATA[System Design Roadmap]]></dc:creator><pubDate>Sun, 21 Jun 2026 03:30:34 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!ife-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe7371b8-858e-4ccf-ba1a-8cfdfe2246dc_4950x2640.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="callout-block" data-callout="true"><p>Learn <strong>System Design with System building, Subscribe Hands On coding course - <a href="https://sdcourse.substack.com/p/start-here-how-to-use-sdcourse">LogStream</a></strong></p></div><p>There&#8217;s a version of the system design interview where the candidate designs Twitter. The entire Twitter. Timeline, search, notifications, recommendations, ads, analytics, direct messages.</p><p>At the 40-minute mark they&#8217;re still drawing boxes. They haven&#8217;t gone deep on anything. The interviewer writes &#8220;breadth over depth, no clear prioritization&#8221; on the scorecard.</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>This is the most common failure mode among technically strong candidates, and it has nothing to do with technical knowledge. It&#8217;s a scoping problem.</p><p>Here&#8217;s the discipline that fixes 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_!ife-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe7371b8-858e-4ccf-ba1a-8cfdfe2246dc_4950x2640.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ife-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe7371b8-858e-4ccf-ba1a-8cfdfe2246dc_4950x2640.png 424w, https://substackcdn.com/image/fetch/$s_!ife-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe7371b8-858e-4ccf-ba1a-8cfdfe2246dc_4950x2640.png 848w, https://substackcdn.com/image/fetch/$s_!ife-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe7371b8-858e-4ccf-ba1a-8cfdfe2246dc_4950x2640.png 1272w, https://substackcdn.com/image/fetch/$s_!ife-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe7371b8-858e-4ccf-ba1a-8cfdfe2246dc_4950x2640.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ife-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe7371b8-858e-4ccf-ba1a-8cfdfe2246dc_4950x2640.png" width="1456" height="777" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fe7371b8-858e-4ccf-ba1a-8cfdfe2246dc_4950x2640.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:777,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:708052,&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/198936747?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe7371b8-858e-4ccf-ba1a-8cfdfe2246dc_4950x2640.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_!ife-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe7371b8-858e-4ccf-ba1a-8cfdfe2246dc_4950x2640.png 424w, https://substackcdn.com/image/fetch/$s_!ife-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe7371b8-858e-4ccf-ba1a-8cfdfe2246dc_4950x2640.png 848w, https://substackcdn.com/image/fetch/$s_!ife-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe7371b8-858e-4ccf-ba1a-8cfdfe2246dc_4950x2640.png 1272w, https://substackcdn.com/image/fetch/$s_!ife-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe7371b8-858e-4ccf-ba1a-8cfdfe2246dc_4950x2640.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>The negotiation in the first five minutes</strong></p><p>Most candidates use the first five minutes to ask clarifying questions. How many users? What&#8217;s the read:write ratio? Does this need global availability?</p><p>These are fine questions. They&#8217;re also generic &#8212; they could be asked for any question. They don&#8217;t signal to the interviewer that you understand how to manage scope.</p><p>The candidates who score well on problem scoping don&#8217;t just ask questions. They propose scope.</p><p>&#8220;There are several interesting subsystems here: the timeline, search, notifications, the recommendation algorithm, and the ad serving layer. I&#8217;m going to focus on the timeline and the fan-out architecture. I&#8217;ll acknowledge the others exist and sketch where they&#8217;d connect, but I won&#8217;t design them in detail. Does that direction work for you?&#8221;</p><p>This is different from asking questions. You&#8217;re proposing what you&#8217;re going to design and explicitly not design, and you&#8217;re inviting the interviewer to redirect if they want something different.</p><p>Most interviewers will say yes. Some will redirect you: &#8220;Actually, I&#8217;m more interested in the fan-out problem for group chats specifically.&#8221; This is useful information you would not have gotten without proposing scope first.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://systemdr.systemdrd.com/subscribe&quot;,&quot;text&quot;:&quot;Subscribe for WhatsApp 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 WhatsApp Walkthrough</span></a></p><p><strong>Why the pressure to cover everything exists</strong></p><p>The instinct to design everything is understandable. The interview is evaluating your technical breadth, right? If you only design one component, won&#8217;t the interviewer think you don&#8217;t know the rest?</p><p>This misunderstands what the interview is evaluating.</p><p>Interviewers at L5+ levels are not checking whether you&#8217;ve memorized the architecture for every subsystem of Twitter. They know you&#8217;re familiar with notifications and search &#8212; you work as a software engineer. What they can&#8217;t infer from your resume is whether you can identify the hardest distributed systems problem in a question, scope down to it, and go deep enough to demonstrate real understanding.</p><p>Designing eight systems shallowly proves you&#8217;re familiar with eight systems. Designing one system deeply proves you can think through the hard parts of a complex problem. The second is what they&#8217;re scoring.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!SRqC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F984fa789-42fd-4484-a4da-f8cb0ff050a2_5060x2640.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!SRqC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F984fa789-42fd-4484-a4da-f8cb0ff050a2_5060x2640.png 424w, https://substackcdn.com/image/fetch/$s_!SRqC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F984fa789-42fd-4484-a4da-f8cb0ff050a2_5060x2640.png 848w, https://substackcdn.com/image/fetch/$s_!SRqC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F984fa789-42fd-4484-a4da-f8cb0ff050a2_5060x2640.png 1272w, https://substackcdn.com/image/fetch/$s_!SRqC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F984fa789-42fd-4484-a4da-f8cb0ff050a2_5060x2640.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!SRqC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F984fa789-42fd-4484-a4da-f8cb0ff050a2_5060x2640.png" width="1456" height="760" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/984fa789-42fd-4484-a4da-f8cb0ff050a2_5060x2640.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:760,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:836881,&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/198936747?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F984fa789-42fd-4484-a4da-f8cb0ff050a2_5060x2640.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_!SRqC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F984fa789-42fd-4484-a4da-f8cb0ff050a2_5060x2640.png 424w, https://substackcdn.com/image/fetch/$s_!SRqC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F984fa789-42fd-4484-a4da-f8cb0ff050a2_5060x2640.png 848w, https://substackcdn.com/image/fetch/$s_!SRqC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F984fa789-42fd-4484-a4da-f8cb0ff050a2_5060x2640.png 1272w, https://substackcdn.com/image/fetch/$s_!SRqC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F984fa789-42fd-4484-a4da-f8cb0ff050a2_5060x2640.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>How to choose what to scope in</strong></p><p>The right component to go deep on is the component with the most interesting distributed systems problem. Not the component you know best. Not the component that feels safest. The component where the answer is genuinely non-obvious.</p><p>For Twitter: the fan-out problem is more interesting than the user profile service. The timeline cache architecture is more interesting than the follow/unfollow API. Go where the hard problem lives.</p><p>A useful test: which component, if I described it at a surface level, would the interviewer immediately probe deeper on? That&#8217;s the component to start with.</p><p><strong>What to do with the components you&#8217;re not designing</strong></p><p>You don&#8217;t ignore them. You acknowledge them.</p><p>&#8220;Notifications would follow a standard fan-out-on-write pattern with push to APNs/FCM for mobile and WebSocket for web, similar to what we discussed for the timeline. I&#8217;m not going to design it in detail, but the interesting problem there is the delivery guarantee under failure &#8212; we&#8217;d need at-least-once delivery with client-side dedup.&#8221;</p><p>One sentence that shows you understand the problem, the standard solution, and the interesting edge case &#8212; without spending five minutes on a full design. This signals breadth without consuming depth time.</p><p><strong>The specific framing that works</strong></p><p>After the estimation section, before drawing anything, say this out loud:</p><p>&#8220;Before I draw the architecture, I want to lock scope. I&#8217;m going to go deep on [component X] because that&#8217;s where the interesting distributed systems problem is. I&#8217;ll acknowledge [components Y and Z] exist and show where they connect, but I won&#8217;t design them fully unless you&#8217;d like me to. Does that work?&#8221;</p><p>The explicit scope lock serves two purposes. It sets expectations so the interviewer isn&#8217;t waiting for you to cover components you&#8217;ve already decided to skip. And it gives the interviewer one last opportunity to redirect before you&#8217;ve committed 30 minutes to the wrong area.</p><p>After this moment, the scope is locked. Don&#8217;t drift. If you finish the deep dive early, go deeper on the component you chose &#8212; don&#8217;t add new components to fill time.</p><p><strong>The uncomfortable truth about breadth</strong></p><p>Demonstrating breadth is valuable. Demonstrating it through shallow coverage of many components is not the right way.</p><p>The right way: show breadth through the quality of your acknowledgments. When you mention a component you&#8217;re not designing and you correctly name the problem it has and the standard approach for solving it, you&#8217;ve shown breadth in one sentence. Compare that to spending five minutes on a shallow design of the same component &#8212; same signal, five minutes cheaper.</p><p>Scope discipline isn&#8217;t about knowing less. It&#8217;s about deploying what you know efficiently enough to demonstrate depth where it matters.</p><div><hr></div><p><strong>CTA:</strong> Tuesday&#8217;s paid post is the full WhatsApp walkthrough &#8212; including how to scope it correctly when the question says &#8220;design a messaging system&#8221; and you have 50 minutes. </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><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>Access all 52 Quesstions <a href="https://systemdrd.com/ebooks/52-faang-questions-drillcards-cheatsheets/">here</a></strong></p></div><p><strong>Curious how this works in real systems?</strong> </p><p>The paid lessons cover scalability, optimization, and real-world engineering patterns.</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></channel></rss>