
什麼系統設計題目,比如說要你設計一個Uber系統,或是要你設計一個Instagram,或是要你設計一個Twitter,gift card系統等等。
聽起來很宏觀,不知道怎麼下手,但是在30~40分鐘裡面,能設計出來的東西不可能很大,所以常常有很多規格上的限制,這就是需要面試者跟面試官溝通的地方。
大致面試流程:
- 先問使用情境,把user如何使用這個系統先理清楚
- Who is going to use it?
- How are they going to use it?
- What does the system do?
- What are the inputs and outputs of the system?
- 多少客戶,多少流量,會產生多大的資料,是持續增長的資料還是一直維持在那的資料,算出QPS
- How many users are there?
- How much data do we expect to handle?
- How many requests per second do we expect?
- 選定要用什麼機器後,可以用QPS推出大概要多少機器。
- 選定Design Goal: CAP theorem, C or A, write heavy or read heavy。
- Abstract Design,畫出大架構
- 大致的API有哪些
- 以gift card 系統為例大概會有三種API
- 一開始讓user 寫入序號,
- 要使用這個禮物卡時,要讀這個序號,對應到多少錢。
- 最後用完這個禮物卡,要把這個序號標記用過了。
- Deep Dive, 例如有些跟地圖相關的設計,牽扯到比較複雜的 quadtree algorithm或是其他的演算法,這一部分通常可以提到這個知識即可,畢竟在30~40分鐘裡面通常無法講得很深,所以這一部分在短時間的面試通常可以跳過。
- How to scale up, fault tolerance
在第五部講大架構跟三種API的時候,會從web端,講到database端,就可以順便帶到已經有的一些database scale up知識,像是database sharding, consistent hash, cache(write through, write back, write behind)。
到web server層 scale up的知識,像是如何sticky session,load balancer如何決定用哪個web server。
總結:基本上就是透過這個題目,把會的知識都講出來,讓面試官知道你會什麼,但前提是大方向要跟面試官溝通清楚,確定自己的設計是在對的軌道上。
資料參考:
- 抱佛腳資料
- 手把手教你面試System design
- CS75 vide: https://www.youtube.com/watch?v=-W9F__D3oY4
- Notes: http://ninefu.github.io/blog/Harvard_CS75_Notes/
- 最好自己大架構都畫過,知道每個component在幹嘛,可以用什麼enhance,用哪些enhance,其優缺點是什麼
- Distributed System CAP Theorem
http://ksat.me/a-plain-english-introduction-to-cap-theorem - Web Architecture 101
https://engineering.videoblocks.com/web-architecture-101-a3224e126947 - Scalable Web Architecture and Distributed Systems
http://www.aosabook.org/en/distsys.html
- 有時間的課程參考(照優先順序排序)
- 長期培養System Design概念的參考


2 Replies to “How to prepare for System Design Interview 系統設計面試準備”