← 返回部落格列表 Meta 系統設計面試拆解|News Feed / Live Comments / Notification 三大經典題型與高分模板
Meta

Meta 系統設計面試拆解|News Feed / Live Comments / Notification 三大經典題型與高分模板

2026-05-24

Meta(前 Facebook)的 System Design 面試在大廠裡偏「產品型」——很少出 generic 題("design a search engine"),更多圍繞自家核心產品(News Feed、Stories、Live Comments、Notification、Messenger)。本文聚焦三類最常出現的題型,給出 Meta 八步法下的標準答題路徑 + 容易被打成 lean no hire 的硬傷點。

Meta 八步法(速記)

  1. 澄清需求(DAU / QPS / 讀寫比)
  2. API 設計
  3. 資料模型
  4. High-Level 架構
  5. 儲存選型(MySQL / Cassandra / Memcached / TAO)
  6. 關鍵路徑 walk-through
  7. 取捨與瓶頸
  8. 監控 + 容災

下面把三道題套進這個框架。


題型一:Design News Feed

澄清需求

API

POST /feed/post     {user_id, content, media[]}
GET  /feed?user_id=&cursor=

資料模型

實體 欄位(關鍵) 儲存
Post post_id, author_id, content, ts, media_url TAO + Blob
Follow follower_id, followee_id, ts TAO
Feed user_id, post_id, score, ts Memcached + offline store

High-Level 架構

client → API GW → Feed Service → [Cache: Memcached]
                                ↓
                       Feed Builder (offline)
                                ↑
                       Post Service → TAO + Blob
                       Follow Service → TAO

關鍵取捨:Fan-out on Write vs Read

模式 適合誰 缺點
Fan-out on Write(push) 普通用戶 高 fanout 用戶寫一次要 fanout 10M 次
Fan-out on Read(pull) 高 fanout 用戶(celebrity) 讀時延高
Hybrid Meta 的實際方案 複雜度上升,但讀寫都可接受

Hybrid 規則:follower > 閾值(如 1M)的用戶走 pull,否則 push。

必須能講清的細節

容易踩雷


題型二:Design Live Comments

Facebook Live / Instagram Live 下面的即時評論流。

澄清需求

推送選型

方案 優點 缺點
Polling 簡單 延遲 + 頻寬浪費
Long Polling 節省頻寬 伺服器連線數高
WebSocket 真正雙向、低延遲 連線管理 + 重連複雜
Server-Sent Events 單向,簡單 不支援二進位

Meta 實際方案:WebSocket,配合 MQTT-like 協定。

High-Level 架構

client ⇄ Edge WS Server (region) ⇄ Pub/Sub (Kafka-like)
                                          ↓
                            Comment Service → Hot Storage (Memcached/Redis)
                                          ↓
                            Sampling / ML → Cold Storage

關鍵設計點

容易踩雷


題型三:Design Notification System

Like / Comment / Mention / Friend Request 等 in-app + push notification 統一系統。

澄清需求

High-Level 架構

Event Source (post like/comment) → Notification Producer → Kafka
                                                            ↓
                                       Notification Service (workers)
                                                            ↓
                            ┌───────────────────┬────────────────────┐
                       APNs/FCM             Email Service        In-app store

關鍵設計點

維度 設計
去重 Window-based: 相同 (target_user, event_type, source_id) 5 分鐘內合併
聚合 "X, Y and 8 others liked your post"
用戶偏好 進 Notification Service 前查 preference cache
限流 按 target_user_id 限速,防止濫發
重試 Exponential backoff,超過閾值進 DLQ

容易踩雷


高分答題模板:每個題型 3 件事

  1. 畫對架構圖(5 個 box 內,不要堆 30 個元件)
  2. 講清一個 critical path(end-to-end 一筆走完)
  3. 明確寫出取捨("X is faster but uses more memory" 這類)

我們見過的 SD 面試高分案例

oavoservice 學員裡拿到 Meta SD strong hire 的,普遍特徵是45 分鐘內主動覆蓋到 4–6 個取捨 + 至少 1 個 critical path 的深挖。我們 VO輔助 流程會針對每道題做 mock + 錄影複盤 + 標記 hire / no hire 信號點

具體方案與報價,加微信 Coding0201 溝通。


FAQ

Meta SD 一定考自家產品嗎?

約 80% 是。剩下 20% 是 chat、url-shortener 等通用題。但即使通用題,面試官也喜歡拿 Meta 實際架構對比。

不熟悉 Memcached 怎麼辦?

至少能講清Memcached vs Redis 的取捨:Memcached 多執行緒、純 LRU、無持久化;Redis 單執行緒(核心)、複雜資料結構、持久化選項多。

應該自己畫圖還是讓面試官畫?

你畫。Meta SD 面試官通常給一個白板工具(Excalidraw / 自建),你必須主動用。

Mid-level 和 Senior 的 SD 區別?

Mid(E4)能答到 high-level + 1 個取捨就過線,Senior(E5+)必須深入 storage selection + capacity estimation + failure mode。


正在準備 Meta / Google / Amazon 等大廠 System Design 面試?

oavoservice 長期追蹤頭部公司 SD 真題與評分標準。mentor 來自一線 Staff / Senior SWE,可提供 Meta 自家產品題專項、八步法 mock、storage 選型訓練、capacity estimation 加強 等 VO輔助 服務。

👉 立即加微信:Coding0201取得 Meta System Design 完整備考方案


聯絡方式

Email: [email protected]
Telegram: @OAVOProxy