How to prepare for System Design Interview 系統設計面試準備

https://towardsdatascience.com/the-complete-guide-to-the-system-design-interview-ba118f48bdfc

什麼系統設計題目,比如說要你設計一個Uber系統,或是要你設計一個Instagram,或是要你設計一個Twitter,gift card系統等等。

聽起來很宏觀,不知道怎麼下手,但是在30~40分鐘裡面,能設計出來的東西不可能很大,所以常常有很多規格上的限制,這就是需要面試者跟面試官溝通的地方。

大致面試流程:

  1. 先問使用情境,把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?
  2. 多少客戶,多少流量,會產生多大的資料,是持續增長的資料還是一直維持在那的資料,算出QPS
    • How many users are there?
    • How much data do we expect to handle?
    • How many requests per second do we expect?
  3. 選定要用什麼機器後,可以用QPS推出大概要多少機器。
  4. 選定Design Goal: CAP theorem, C or A, write heavy or read heavy。
    • What is the expected read-to-write ratio?
  5. Abstract Design,畫出大架構
    • 大致的API有哪些
    • 以gift card 系統為例大概會有三種API
      1. 一開始讓user 寫入序號,
      2. 要使用這個禮物卡時,要讀這個序號,對應到多少錢。
      3. 最後用完這個禮物卡,要把這個序號標記用過了。
  6. Deep Dive, 例如有些跟地圖相關的設計,牽扯到比較複雜的 quadtree algorithm或是其他的演算法,這一部分通常可以提到這個知識即可,畢竟在30~40分鐘裡面通常無法講得很深,所以這一部分在短時間的面試通常可以跳過。
  7. 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。

總結:基本上就是透過這個題目,把會的知識都講出來,讓面試官知道你會什麼,但前提是大方向要跟面試官溝通清楚,確定自己的設計是在對的軌道上。

資料參考:

  1. 抱佛腳資料
  2. 有時間的課程參考(照優先順序排序)
  3. 長期培養System Design概念的參考

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

發表留言