Facebook在用戶增長到5億時的擴容策略

{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"這是一篇譯文,雖然寫這篇文章時, Facebook 用戶才增長到 5 億,但是文章依然值得參考,畢竟即使在如今,用戶能到 5 億的應用依然鳳毛麟角。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"原文地址:"},{"type":"link","attrs":{"href":"http://highscalability.com/blog/2010/8/2/7-scaling-strategies-facebook-used-to-grow-to-500-million-us.html","title":""},"content":[{"type":"text","text":"http://highscalability.com/blog/2010/8/2/7-scaling-strategies-facebook-used-to-grow-to-500-million-us.html"}]}]},{"type":"horizontalrule"},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在 2010 年,Facebook 達到了一個里程碑,用戶數超過了 5 億。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"blockquote","content":[{"type":"paragraph","content":[{"type":"text","text":"PS: 這個時候微信估計纔剛剛立項"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在這樣的里程碑上,Facebok 分享了構建這樣一個可擴展系統的 7 條策略。可能 5 億用戶這個數字很難讓人直觀的感受到這個系統的複雜性,那麼可以來看看下面這些指標:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","content":[{"type":"paragraph","content":[{"type":"text","text":"一個工程師需要負責 100 萬用戶"}]}]},{"type":"listitem","content":[{"type":"paragraph","content":[{"type":"text","text":"5 億活躍用戶"}]}]},{"type":"listitem","content":[{"type":"paragraph","content":[{"type":"text","text":"每天 1 千億的點擊量"}]}]},{"type":"listitem","content":[{"type":"paragraph","content":[{"type":"text","text":"50 億照片"}]}]},{"type":"listitem","content":[{"type":"paragraph","content":[{"type":"text","text":"2 萬億對象緩存,每秒需要處理幾百萬用戶請求"}]}]},{"type":"listitem","content":[{"type":"paragraph","content":[{"type":"text","text":"每天 130 TB 的日誌"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Facebook 是如何處理這個情況的:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":1,"normalizeStart":1},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","text":"人最重要"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"系統是通過人來構建和運行的,最好的擴容工具是工程和運維團隊,"},{"type":"text","marks":[{"type":"strong"}],"text":"他們可以處理一切事情"},{"type":"text","text":"。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":2,"normalizeStart":2},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","text":"水平擴容"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"處理指數級增長的流量需要在許多機器上任意分配負載。對帳戶和用戶信息等表使用不同的數據庫只能使容量增加一倍。這種方法會影響效率,但是效率是與可伸縮性無關的,效率本身不會對可伸縮性產生實質性的影響。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":3,"normalizeStart":3},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","text":"快速行動"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在擴容的每一個層面上都會有意外。對於這些意外的情況,需要一個可以處理任何問題的高度水平的、靈活的、足夠熟練的跨項目團隊。靈活性比任何單獨的技術決策都重要。Facebook 通過快速行動也能快速試錯,然後找出最好的方法。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":4,"normalizeStart":4},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","text":"增量變更"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"做出小的改變並且量化結果是快速行動的關鍵。大的事情需要分解成不同的部分,變更不能成批的出現。這些小變更可以通過少量機器向少量的用戶推送。新的系統可以和舊系統並存,通過對新系統結果的量化,慢慢將流量向新系統遷移。整個系統的穩定性會通過增量變更來提高,因爲你可以快速的知道一個特定的策略是否有效果。使用較小的增量變化,更容易找到出錯的地方。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":5,"normalizeStart":5},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","text":"量化一切"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"線上環境時收集有用數據的好地方。量化系統和應用程序級別的數據就可以瞭解發生了什麼。檢查第95或第99百分位的情況,因爲平均值隱藏了重要的問題。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"blockquote","content":[{"type":"paragraph","content":[{"type":"text","text":"PS: 要檢查那些出現的次數不是很多的問題,因爲在這個背後可能隱藏着更大的問題"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":6,"normalizeStart":6},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":6,"align":null,"origin":null},"content":[{"type":"text","text":"小而獨立的團隊"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"小團隊可以高效、快速、謹慎地完成工作。舉例來說,在最大的照片網站上("},{"type":"text","marks":[{"type":"strong"}],"text":"指 Facebook"},{"type":"text","text":"),只有三個人在負責照片方面的工作。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":7,"normalizeStart":7},"content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":7,"align":null,"origin":null},"content":[{"type":"text","text":"職責控制"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"控制職責。如果一個團隊爲某事負責,他們必須能夠控制它。舉例來說,Facebook 每天都會向生產環境中發佈代碼。那麼編寫代碼的人就需要負責修復任何出錯的地方。如果寫代碼和發佈代碼的職責是分離的,那麼寫代碼的人就無法感受到壞代碼會對系統造成什麼樣的影響。羅伯特(Facebook 的工程主管)說的很好:我們所知道的爲 5 億人做一個好軟件的最好方法是讓工程師理解他們所做事情的重要性,從而讓他們在可以控制的範圍內做出好的決定。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"這些原則並不是什麼新點子,但是這些原則可以很輕易的組合在一起,然後形成一個自我強化的良性循環。如果沒有小團隊和清晰的職責,就無法快速行動。如果你不把這些變更提交到生產環境然後量化結果,你就無法知道這些變更是好是壞。除非工程師知道自己有責任去修改生產環境的代碼,否則就很難向生產環境發佈代碼。如果你無法實現橫向擴展,快速行動,然後量化結果,你就無法處理好系統的擴容。當然,做好這一切都需要優秀的人。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"這些原則可以支持再增長 5 億用戶嗎?根據第一條原則,我認爲答案時肯定的。世界正在快速變化,在未來將會有不可預見的挑戰,但是優秀的人會根據環境來學習和進化。目前來說,Facebook 面臨的挑戰是如何持續的去實踐這些原則,並且要避免組織的規模和複雜度達到臨界點後出現組織腐敗,然後影響其他組織。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"blockquote","content":[{"type":"paragraph","content":[{"type":"text","text":"PS: 歸根結底,人才是一個公司中最重要的部分,公司對人才的要求是不能放鬆的。"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}},{"type":"strong"}],"text":"譯 / Rayjun"}]}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章