{"id":"how-to-approach-a-system-design-interview-question","title":"How to approach a system design interview question","sections":[{"id":"overview","title":"Overview","html":"<blockquote>\n<p>How to tackle a system design interview question.</p>\n</blockquote>\n<p>The system design interview is an <strong>open-ended conversation</strong>.  You are expected to lead it.</p>\n<p>You can use the following steps to guide the discussion.  To help solidify this process, work through the <a href=\"/#system-design\">System design interview questions with solutions</a> section using the following steps.</p>","headings":[]},{"id":"step-1-outline-use-cases-constraints-and-assumptions","title":"Step 1: Outline use cases, constraints, and assumptions","html":"<h3 id=\"step-1-outline-use-cases-constraints-and-assumptions\">Step 1: Outline use cases, constraints, and assumptions</h3>\n<p>Gather requirements and scope the problem.  Ask questions to clarify use cases and constraints.  Discuss assumptions.</p>\n<ul>\n<li>Who is going to use it?</li>\n<li>How are they going to use it?</li>\n<li>How many users are there?</li>\n<li>What does the system do?</li>\n<li>What are the inputs and outputs of the system?</li>\n<li>How much data do we expect to handle?</li>\n<li>How many requests per second do we expect?</li>\n<li>What is the expected read to write ratio?</li>\n</ul>","headings":[{"id":"step-1-outline-use-cases-constraints-and-assumptions","title":"Step 1: Outline use cases, constraints, and assumptions","depth":3}]},{"id":"step-2-create-a-high-level-design","title":"Step 2: Create a high level design","html":"<h3 id=\"step-2-create-a-high-level-design\">Step 2: Create a high level design</h3>\n<p>Outline a high level design with all important components.</p>\n<ul>\n<li>Sketch the main components and connections</li>\n<li>Justify your ideas</li>\n</ul>","headings":[{"id":"step-2-create-a-high-level-design","title":"Step 2: Create a high level design","depth":3}]},{"id":"step-3-design-core-components","title":"Step 3: Design core components","html":"<h3 id=\"step-3-design-core-components\">Step 3: Design core components</h3>\n<p>Dive into details for each core component.  For example, if you were asked to <a href=\"/learn/design-pastebin\">design a url shortening service</a>, discuss:</p>\n<ul>\n<li>Generating and storing a hash of the full url\n<ul>\n<li><a href=\"/learn/design-pastebin\">MD5</a> and <a href=\"/learn/design-pastebin\">Base62</a></li>\n<li>Hash collisions</li>\n<li>SQL or NoSQL</li>\n<li>Database schema</li>\n</ul>\n</li>\n<li>Translating a hashed url to the full url\n<ul>\n<li>Database lookup</li>\n</ul>\n</li>\n<li>API and object-oriented design</li>\n</ul>","headings":[{"id":"step-3-design-core-components","title":"Step 3: Design core components","depth":3}]},{"id":"step-4-scale-the-design","title":"Step 4: Scale the design","html":"<h3 id=\"step-4-scale-the-design\">Step 4: Scale the design</h3>\n<p>Identify and address bottlenecks, given the constraints.  For example, do you need the following to address scalability issues?</p>\n<ul>\n<li>Load balancer</li>\n<li>Horizontal scaling</li>\n<li>Caching</li>\n<li>Database sharding</li>\n</ul>\n<p>Discuss potential solutions and trade-offs.  Everything is a trade-off.  Address bottlenecks using <a href=\"/\">principles of scalable system design</a>.</p>","headings":[{"id":"step-4-scale-the-design","title":"Step 4: Scale the design","depth":3}]},{"id":"back-of-the-envelope-calculations","title":"Back-of-the-envelope calculations","html":"<h3 id=\"back-of-the-envelope-calculations\">Back-of-the-envelope calculations</h3>\n<p>You might be asked to do some estimates by hand.  Refer to the <a href=\"/learn/appendix\">Appendix</a> for the following resources:</p>\n<ul>\n<li><a href=\"http://highscalability.com/blog/2011/1/26/google-pro-tip-use-back-of-the-envelope-calculations-to-choo.html\" target=\"_blank\" rel=\"noopener noreferrer\">Use back of the envelope calculations</a></li>\n<li><a href=\"/learn/appendix#powers-of-two-table\">Powers of two table</a></li>\n<li><a href=\"/learn/appendix#latency-numbers-every-programmer-should-know\">Latency numbers every programmer should know</a></li>\n</ul>\n<h3 id=\"sources-and-further-reading\">Source(s) and further reading</h3>\n<p>Check out the following links to get a better idea of what to expect:</p>\n<ul>\n<li><a href=\"https://web.archive.org/web/20210505130322/https://www.palantir.com/2011/10/how-to-rock-a-systems-design-interview/\" target=\"_blank\" rel=\"noopener noreferrer\">How to ace a systems design interview</a></li>\n<li><a href=\"http://www.hiredintech.com/system-design\" target=\"_blank\" rel=\"noopener noreferrer\">The system design interview</a></li>\n<li><a href=\"https://www.youtube.com/watch?v=ZgdS0EUmn70\" target=\"_blank\" rel=\"noopener noreferrer\">Intro to Architecture and Systems Design Interviews</a></li>\n<li><a href=\"https://leetcode.com/discuss/career/229177/My-System-Design-Template\" target=\"_blank\" rel=\"noopener noreferrer\">System design template</a></li>\n</ul>","headings":[{"id":"back-of-the-envelope-calculations","title":"Back-of-the-envelope calculations","depth":3},{"id":"sources-and-further-reading","title":"Source(s) and further reading","depth":3}]}],"sourceFiles":[]}