Merge branch 'master' into boddu
|
@ -6,6 +6,6 @@ Before submitting a pull request, verify it meets all requirements in the [Contr
|
|||
|
||||
See the [Contributing Guidelines](https://github.com/donnemartin/system-design-primer/blob/master/CONTRIBUTING.md). Verify you've:
|
||||
|
||||
* Tagged the [language maintainer](TRANSLATIONS.md)
|
||||
* Tagged the [language maintainer](https://github.com/donnemartin/system-design-primer/blob/master/TRANSLATIONS.md)
|
||||
* Prefixed the title with a language code
|
||||
* Example: "ja: Fix ..."
|
||||
|
|
80
README-ja.md
|
@ -3,7 +3,7 @@
|
|||
# システム設計入門
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/jj3A5N8.png"/>
|
||||
<img src="images/jj3A5N8.png">
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
|||
## 暗記カード
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/zdCAkB3.png"/>
|
||||
<img src="images/zdCAkB3.png">
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
|
@ -61,7 +61,7 @@
|
|||
コード技術面接用の問題を探している場合は[**こちら**](https://github.com/donnemartin/interactive-coding-challenges)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/b4YtAEN.png"/>
|
||||
<img src="images/b4YtAEN.png">
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
|
@ -91,7 +91,7 @@
|
|||
> それぞれのセクションはより学びを深めるような他の文献へのリンクが貼られています。
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/jrUBAF7.png"/>
|
||||
<img src="images/jrUBAF7.png">
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
|
@ -180,7 +180,7 @@
|
|||
|
||||
> 学習スパンに応じてみるべきトピックス (short, medium, long)
|
||||
|
||||
![Imgur](http://i.imgur.com/OfVllex.png)
|
||||
![Imgur](images/OfVllex.png)
|
||||
|
||||
**Q: 面接のためには、ここにあるものすべてをやらないといけないのでしょうか?**
|
||||
|
||||
|
@ -302,49 +302,49 @@
|
|||
|
||||
[問題と解答を見る](solutions/system_design/pastebin/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/4edXG0T.png)
|
||||
![Imgur](images/4edXG0T.png)
|
||||
|
||||
### Twitterタイムライン&検索 (もしくはFacebookフィード&検索)を設計する
|
||||
|
||||
[問題と解答を見る](solutions/system_design/twitter/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/jrUBAF7.png)
|
||||
![Imgur](images/jrUBAF7.png)
|
||||
|
||||
### ウェブクローラーの設計
|
||||
|
||||
[問題と解答を見る](solutions/system_design/web_crawler/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/bWxPtQA.png)
|
||||
![Imgur](images/bWxPtQA.png)
|
||||
|
||||
### Mint.comの設計
|
||||
|
||||
[問題と解答を見る](solutions/system_design/mint/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/V5q57vU.png)
|
||||
![Imgur](images/V5q57vU.png)
|
||||
|
||||
### SNSサービスのデータ構造を設計する
|
||||
|
||||
[問題と解答を見る](solutions/system_design/social_graph/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/cdCv5g7.png)
|
||||
![Imgur](images/cdCv5g7.png)
|
||||
|
||||
### 検索エンジンのキー/バリュー構造を設計する
|
||||
|
||||
[問題と解答を見る](solutions/system_design/query_cache/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/4j99mhe.png)
|
||||
![Imgur](images/4j99mhe.png)
|
||||
|
||||
### Amazonのカテゴリ毎の売り上げランキングを設計する
|
||||
|
||||
[問題と解答を見る](solutions/system_design/sales_rank/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/MzExP06.png)
|
||||
![Imgur](images/MzExP06.png)
|
||||
|
||||
### AWS上で100万人規模のユーザーを捌くサービスを設計する
|
||||
|
||||
[問題と解答を見る](solutions/system_design/scaling_aws/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/jj3A5N8.png)
|
||||
![Imgur](images/jj3A5N8.png)
|
||||
|
||||
## オブジェクト指向設計問題と解答
|
||||
|
||||
|
@ -436,7 +436,7 @@
|
|||
### CAP 理論
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/bgLMI2u.png"/>
|
||||
<img src="images/bgLMI2u.png">
|
||||
<br/>
|
||||
<i><a href=http://robertgreiner.com/2014/08/cap-theorem-revisited>Source: CAP theorem revisited</a></i>
|
||||
</p>
|
||||
|
@ -530,7 +530,7 @@
|
|||
## ドメインネームシステム
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/IOyLj4i.jpg"/>
|
||||
<img src="images/IOyLj4i.jpg">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/srikrupa5/dns-security-presentation-issa>Source: DNS security presentation</a></i>
|
||||
</p>
|
||||
|
@ -568,7 +568,7 @@ DNSは少数のオーソライズされたサーバーが上位に位置する
|
|||
## コンテンツデリバリーネットワーク(Content delivery network)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/h9TAuGI.jpg"/>
|
||||
<img src="images/h9TAuGI.jpg">
|
||||
<br/>
|
||||
<i><a href=https://www.creative-artworks.eu/why-use-a-content-delivery-network-cdn/>Source: Why use a CDN</a></i>
|
||||
</p>
|
||||
|
@ -609,7 +609,7 @@ CDNを用いてコンテンツを配信することで以下の二つの理由
|
|||
## ロードバランサー
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/h81n9iK.png"/>
|
||||
<img src="images/h81n9iK.png">
|
||||
<br/>
|
||||
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>Source: Scalable system design patterns</a></i>
|
||||
</p>
|
||||
|
@ -679,7 +679,7 @@ Layer 7 ロードバランサーは [アプリケーションレイヤー](#通
|
|||
## リバースプロキシ(webサーバー)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/n41Azff.png"/>
|
||||
<img src="images/n41Azff.png">
|
||||
<br/>
|
||||
<i><a href=https://upload.wikimedia.org/wikipedia/commons/6/67/Reverse_proxy_h2g2bob.svg>Source: Wikipedia</a></i>
|
||||
<br/>
|
||||
|
@ -722,7 +722,7 @@ Layer 7 ロードバランサーは [アプリケーションレイヤー](#通
|
|||
## アプリケーション層
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/yB5SYwm.png"/>
|
||||
<img src="images/yB5SYwm.png">
|
||||
<br/>
|
||||
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>Source: Intro to architecting systems for scale</a></i>
|
||||
</p>
|
||||
|
@ -759,7 +759,7 @@ Layer 7 ロードバランサーは [アプリケーションレイヤー](#通
|
|||
## データベース
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/Xkm5CXz.png"/>
|
||||
<img src="images/Xkm5CXz.png">
|
||||
<br/>
|
||||
<i><a href=https://www.youtube.com/watch?v=w95murBkYmU>Source: Scaling up to your first 10 million users</a></i>
|
||||
</p>
|
||||
|
@ -782,7 +782,7 @@ SQLなどのリレーショナルデータベースはテーブルに整理さ
|
|||
マスターデータベースが読み取りと書き込みを処理し、書き込みを一つ以上のスレーブデータベースに複製します。スレーブデータベースは読み取りのみを処理します。スレーブデータベースは木構造のように追加のスレーブにデータを複製することもできます。マスターデータベースがオフラインになった場合には、いずれかのスレーブがマスターに昇格するか、新しいマスターデータベースが追加されるまでは読み取り専用モードで稼働します。
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/C9ioGtn.png"/>
|
||||
<img src="images/C9ioGtn.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||
</p>
|
||||
|
@ -797,7 +797,7 @@ SQLなどのリレーショナルデータベースはテーブルに整理さ
|
|||
いずれのマスターも読み取り書き込みの両方に対応する。書き込みに関してはそれぞれ協調する。いずれかのマスターが落ちても、システム全体としては読み書き両方に対応したまま運用できる。
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/krAHLGg.png"/>
|
||||
<img src="images/krAHLGg.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||
</p>
|
||||
|
@ -825,7 +825,7 @@ SQLなどのリレーショナルデータベースはテーブルに整理さ
|
|||
#### Federation
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/U3qV33e.png"/>
|
||||
<img src="images/U3qV33e.png">
|
||||
<br/>
|
||||
<i><a href=https://www.youtube.com/watch?v=w95murBkYmU>Source: Scaling up to your first 10 million users</a></i>
|
||||
</p>
|
||||
|
@ -846,7 +846,7 @@ SQLなどのリレーショナルデータベースはテーブルに整理さ
|
|||
#### シャーディング
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/wU8x5Id.png"/>
|
||||
<img src="images/wU8x5Id.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||
</p>
|
||||
|
@ -990,7 +990,7 @@ NoSQL は **key-value store**、 **document-store**、 **wide column store**、
|
|||
#### ワイドカラムストア
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/n16iOGk.png"/>
|
||||
<img src="images/n16iOGk.png">
|
||||
<br/>
|
||||
<i><a href=http://blog.grio.com/2015/11/sql-nosql-a-brief-history.html>Source: SQL & NoSQL, a brief history</a></i>
|
||||
</p>
|
||||
|
@ -1013,7 +1013,7 @@ Googleは[Bigtable](http://www.read.seas.harvard.edu/~kohler/class/cs239-w08/cha
|
|||
#### グラフデータベース
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/fNcl65g.png"/>
|
||||
<img src="images/fNcl65g.png">
|
||||
<br/>
|
||||
<i><a href=https://en.wikipedia.org/wiki/File:GraphDatabase_PropertyGraph.png>Source: Graph database</a></i>
|
||||
</p>
|
||||
|
@ -1041,7 +1041,7 @@ Googleは[Bigtable](http://www.read.seas.harvard.edu/~kohler/class/cs239-w08/cha
|
|||
### SQLか?NoSQLか?
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/wXGqG5f.png"/>
|
||||
<img src="images/wXGqG5f.png">
|
||||
<br/>
|
||||
<i><a href=https://www.infoq.com/articles/Transition-RDBMS-NoSQL/>Source: Transitioning from RDBMS to NoSQL</a></i>
|
||||
</p>
|
||||
|
@ -1083,7 +1083,7 @@ NoSQLに適するサンプルデータ:
|
|||
## キャッシュ
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/Q6z24La.png"/>
|
||||
<img src="images/Q6z24La.png">
|
||||
<br/>
|
||||
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>Source: Scalable system design patterns</a></i>
|
||||
</p>
|
||||
|
@ -1154,7 +1154,7 @@ Redisはさらに以下のような機能を備えています:
|
|||
#### キャッシュアサイド
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/ONjORqk.png"/>
|
||||
<img src="images/ONjORqk.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast>Source: From cache to in-memory data grid</a></i>
|
||||
</p>
|
||||
|
@ -1190,7 +1190,7 @@ def get_user(self, user_id):
|
|||
#### ライトスルー
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/0vBc0hN.png"/>
|
||||
<img src="images/0vBc0hN.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||
</p>
|
||||
|
@ -1225,7 +1225,7 @@ def set_user(user_id, values):
|
|||
#### ライトビハインド (ライトバック)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/rgSrvjG.png"/>
|
||||
<img src="images/rgSrvjG.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||
</p>
|
||||
|
@ -1243,7 +1243,7 @@ def set_user(user_id, values):
|
|||
#### リフレッシュアヘッド
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/kxtjqgE.png"/>
|
||||
<img src="images/kxtjqgE.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast>Source: From cache to in-memory data grid</a></i>
|
||||
</p>
|
||||
|
@ -1275,7 +1275,7 @@ def set_user(user_id, values):
|
|||
## 非同期処理
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/54GYsSx.png"/>
|
||||
<img src="images/54GYsSx.png">
|
||||
<br/>
|
||||
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>Source: Intro to architecting systems for scale</a></i>
|
||||
</p>
|
||||
|
@ -1321,7 +1321,7 @@ def set_user(user_id, values):
|
|||
## 通信
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/5KeocQs.jpg"/>
|
||||
<img src="images/5KeocQs.jpg">
|
||||
<br/>
|
||||
<i><a href=http://www.escotal.com/osilayer.html>Source: OSI 7 layer model</a></i>
|
||||
</p>
|
||||
|
@ -1353,7 +1353,7 @@ HTTPは**TCP** や **UDP** などの低級プロトコルに依存している
|
|||
### 伝送制御プロトコル (TCP)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/JdAsdvG.jpg"/>
|
||||
<img src="images/JdAsdvG.jpg">
|
||||
<br/>
|
||||
<i><a href=http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/>Source: How to make a multiplayer game</a></i>
|
||||
</p>
|
||||
|
@ -1377,7 +1377,7 @@ TCPは高い依存性を要し、時間制約が厳しくないものに適し
|
|||
### ユーザデータグラムプロトコル (UDP)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/yzDrJtA.jpg"/>
|
||||
<img src="images/yzDrJtA.jpg">
|
||||
<br/>
|
||||
<i><a href=http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/>Source: How to make a multiplayer game</a></i>
|
||||
</p>
|
||||
|
@ -1406,7 +1406,7 @@ TCPよりもUDPを使うのは:
|
|||
### 遠隔手続呼出 (RPC)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/iF4Mkb5.png"/>
|
||||
<img src="images/iF4Mkb5.png">
|
||||
<br/>
|
||||
<i><a href=http://www.puncsky.com/blog/2016-02-13-crack-the-system-design-interview>Source: Crack the system design interview</a></i>
|
||||
</p>
|
||||
|
@ -1620,7 +1620,7 @@ Notes
|
|||
| ランダムID発行システムの設計 | [blog.twitter.com](https://blog.twitter.com/2010/announcing-snowflake)<br/>[github.com](https://github.com/twitter/snowflake/) |
|
||||
| 一定のインターバル時間での上位k件を返す | [ucsb.edu](https://icmi.cs.ucsb.edu/research/tech_reports/reports/2005-23.pdf)<br/>[wpi.edu](http://davis.wpi.edu/xmdv/docs/EDBT11-diyang.pdf) |
|
||||
| 複数のデータセンターからデータを配信するサービスの設計 | [highscalability.com](http://highscalability.com/blog/2009/8/24/how-google-serves-data-from-multiple-datacenters.html) |
|
||||
| オンラインの複数プレイヤーカードゲームの設計 | [indieflashblog.com](http://www.indieflashblog.com/how-to-create-an-asynchronous-multiplayer-game.html)<br/>[buildnewgames.com](http://buildnewgames.com/real-time-multiplayer/) |
|
||||
| オンラインの複数プレイヤーカードゲームの設計 | [indieflashblog.com](https://web.archive.org/web/20180929181117/http://www.indieflashblog.com/how-to-create-an-asynchronous-multiplayer-game.html)<br/>[buildnewgames.com](http://buildnewgames.com/real-time-multiplayer/) |
|
||||
| ガーベッジコレクションシステムの設計 | [stuffwithstuff.com](http://journal.stuffwithstuff.com/2013/12/08/babys-first-garbage-collector/)<br/>[washington.edu](http://courses.cs.washington.edu/courses/csep521/07wi/prj/rick.pdf) |
|
||||
| システム設計例題を追加する | [Contribute](#contributing) |
|
||||
|
||||
|
@ -1629,7 +1629,7 @@ Notes
|
|||
> 世の中のシステムがどのように設計されているかについての記事
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/TcUo2fw.png"/>
|
||||
<img src="images/TcUo2fw.png">
|
||||
<br/>
|
||||
<i><a href=https://www.infoq.com/presentations/Twitter-Timeline-Scalability>Source: Twitter timelines at scale</a></i>
|
||||
</p>
|
||||
|
@ -1712,7 +1712,7 @@ Notes
|
|||
* [Facebook Engineering](https://www.facebook.com/Engineering)
|
||||
* [Flickr Code](http://code.flickr.net/)
|
||||
* [Foursquare Engineering Blog](http://engineering.foursquare.com/)
|
||||
* [GitHub Engineering Blog](http://githubengineering.com/)
|
||||
* [GitHub Engineering Blog](https://github.blog/category/engineering)
|
||||
* [Google Research Blog](http://googleresearch.blogspot.com/)
|
||||
* [Groupon Engineering Blog](https://engineering.groupon.com/)
|
||||
* [Heroku Engineering Blog](https://engineering.heroku.com/)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
# 系统设计入门
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/jj3A5N8.png"/>
|
||||
<img src="images/jj3A5N8.png">
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
|||
## 抽认卡
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/zdCAkB3.png"/>
|
||||
<img src="images/zdCAkB3.png">
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
|
@ -66,7 +66,7 @@
|
|||
你正在寻找资源以准备[**编程面试**](https://github.com/donnemartin/interactive-coding-challenges)吗?
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/b4YtAEN.png"/>
|
||||
<img src="images/b4YtAEN.png">
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
|
@ -97,7 +97,7 @@
|
|||
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/jrUBAF7.png"/>
|
||||
<img src="images/jrUBAF7.png">
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
|
@ -186,7 +186,7 @@
|
|||
|
||||
> 基于你面试的时间线(短、中、长)去复习那些推荐的主题。
|
||||
|
||||
![Imgur](http://i.imgur.com/OfVllex.png)
|
||||
![Imgur](images/OfVllex.png)
|
||||
|
||||
**问:对于面试来说,我需要知道这里的所有知识点吗?**
|
||||
|
||||
|
@ -307,49 +307,49 @@
|
|||
|
||||
[查看实践与解答](solutions/system_design/pastebin/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/4edXG0T.png)
|
||||
![Imgur](images/4edXG0T.png)
|
||||
|
||||
### 设计 Twitter 时间线和搜索 (或者 Facebook feed 和搜索)
|
||||
|
||||
[查看实践与解答](solutions/system_design/twitter/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/jrUBAF7.png)
|
||||
![Imgur](images/jrUBAF7.png)
|
||||
|
||||
### 设计一个网页爬虫
|
||||
|
||||
[查看实践与解答](solutions/system_design/web_crawler/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/bWxPtQA.png)
|
||||
![Imgur](images/bWxPtQA.png)
|
||||
|
||||
### 设计 Mint.com
|
||||
|
||||
[查看实践与解答](solutions/system_design/mint/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/V5q57vU.png)
|
||||
![Imgur](images/V5q57vU.png)
|
||||
|
||||
### 为一个社交网络设计数据结构
|
||||
|
||||
[查看实践与解答](solutions/system_design/social_graph/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/cdCv5g7.png)
|
||||
![Imgur](images/cdCv5g7.png)
|
||||
|
||||
### 为搜索引擎设计一个 key-value 储存
|
||||
|
||||
[查看实践与解答](solutions/system_design/query_cache/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/4j99mhe.png)
|
||||
![Imgur](images/4j99mhe.png)
|
||||
|
||||
### 设计按类别分类的 Amazon 销售排名
|
||||
|
||||
[查看实践与解答](solutions/system_design/sales_rank/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/MzExP06.png)
|
||||
![Imgur](images/MzExP06.png)
|
||||
|
||||
### 在 AWS 上设计一个百万用户级别的系统
|
||||
|
||||
[查看实践与解答](solutions/system_design/scaling_aws/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/jj3A5N8.png)
|
||||
![Imgur](images/jj3A5N8.png)
|
||||
|
||||
## 面向对象设计的面试问题及解答
|
||||
|
||||
|
@ -441,7 +441,7 @@
|
|||
### CAP 理论
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/bgLMI2u.png"/>
|
||||
<img src="images/bgLMI2u.png">
|
||||
<br/>
|
||||
<strong><a href="http://robertgreiner.com/2014/08/cap-theorem-revisited">来源:再看 CAP 理论</a></strong>
|
||||
</p>
|
||||
|
@ -536,7 +536,7 @@ DNS 和 email 等系统使用的是此种方式。最终一致性在高可用性
|
|||
## 域名系统
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/IOyLj4i.jpg"/>
|
||||
<img src="images/IOyLj4i.jpg">
|
||||
<br/>
|
||||
<strong><a href="http://www.slideshare.net/srikrupa5/dns-security-presentation-issa">来源:DNS 安全介绍</a></strong>
|
||||
</p>
|
||||
|
@ -574,7 +574,7 @@ DNS 和 email 等系统使用的是此种方式。最终一致性在高可用性
|
|||
## 内容分发网络(CDN)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/h9TAuGI.jpg"/>
|
||||
<img src="images/h9TAuGI.jpg">
|
||||
<br/>
|
||||
<strong><a href="https://www.creative-artworks.eu/why-use-a-content-delivery-network-cdn/">来源:为什么使用 CDN</a></strong>
|
||||
</p>
|
||||
|
@ -613,7 +613,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
|
|||
## 负载均衡器
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/h81n9iK.png"/>
|
||||
<img src="images/h81n9iK.png">
|
||||
<br/>
|
||||
<strong><a href="http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html">来源:可扩展的系统设计模式</a></strong>
|
||||
</p>
|
||||
|
@ -682,7 +682,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
|
|||
## 反向代理(web 服务器)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/n41Azff.png"/>
|
||||
<img src="images/n41Azff.png">
|
||||
<br/>
|
||||
<strong><a href="https://upload.wikimedia.org/wikipedia/commons/6/67/Reverse_proxy_h2g2bob.svg">资料来源:维基百科</a></strong>
|
||||
<br/>
|
||||
|
@ -726,7 +726,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
|
|||
## 应用层
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/yB5SYwm.png"/>
|
||||
<img src="images/yB5SYwm.png">
|
||||
<br/>
|
||||
<strong><a href="http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer">资料来源:可缩放系统构架介绍</a></strong>
|
||||
</p>
|
||||
|
@ -764,7 +764,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
|
|||
## 数据库
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/Xkm5CXz.png"/>
|
||||
<img src="images/Xkm5CXz.png">
|
||||
<br/>
|
||||
<strong><a href="https://www.youtube.com/watch?v=w95murBkYmU">资料来源:扩展你的用户数到第一个一千万</a></strong>
|
||||
</p>
|
||||
|
@ -785,7 +785,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
|
|||
关系型数据库扩展包括许多技术:**主从复制**、**主主复制**、**联合**、**分片**、**非规范化**和 **SQL调优**。
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/C9ioGtn.png"/>
|
||||
<img src="images/C9ioGtn.png">
|
||||
<br/>
|
||||
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
|
||||
</p>
|
||||
|
@ -800,7 +800,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
|
|||
- 参考[不利之处:复制](#不利之处复制)中,主从复制和主主复制**共同**的问题。
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/krAHLGg.png"/>
|
||||
<img src="images/krAHLGg.png">
|
||||
<br/>
|
||||
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
|
||||
</p>
|
||||
|
@ -835,7 +835,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
|
|||
#### 联合
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/U3qV33e.png"/>
|
||||
<img src="images/U3qV33e.png">
|
||||
<br/>
|
||||
<strong><a href="https://www.youtube.com/watch?v=w95murBkYmU">资料来源:扩展你的用户数到第一个一千万</a></strong>
|
||||
</p>
|
||||
|
@ -857,7 +857,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
|
|||
#### 分片
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/wU8x5Id.png"/>
|
||||
<img src="images/wU8x5Id.png">
|
||||
<br/>
|
||||
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
|
||||
</p>
|
||||
|
@ -1001,7 +1001,7 @@ MongoDB 和 CouchDB 等一些文档类型存储还提供了类似 SQL 语言的
|
|||
#### 列型存储
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/n16iOGk.png"/>
|
||||
<img src="images/n16iOGk.png">
|
||||
<br/>
|
||||
<strong><a href="http://blog.grio.com/2015/11/sql-nosql-a-brief-history.html">资料来源: SQL 和 NoSQL,一个简短的历史</a></strong>
|
||||
</p>
|
||||
|
@ -1024,7 +1024,7 @@ Google 发布了第一个列型存储数据库 [Bigtable](http://www.read.seas.h
|
|||
#### 图数据库
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/fNcl65g.png"/>
|
||||
<img src="images/fNcl65g.png">
|
||||
<br/>
|
||||
<strong><a href="https://en.wikipedia.org/wiki/File:GraphDatabase_PropertyGraph.png"/>资料来源:图数据库</a></strong>
|
||||
</p>
|
||||
|
@ -1051,7 +1051,7 @@ Google 发布了第一个列型存储数据库 [Bigtable](http://www.read.seas.h
|
|||
### SQL 还是 NoSQL
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/wXGqG5f.png"/>
|
||||
<img src="images/wXGqG5f.png">
|
||||
<br/>
|
||||
<strong><a href="https://www.infoq.com/articles/Transition-RDBMS-NoSQL/">资料来源:从 RDBMS 转换到 NoSQL</a></strong>
|
||||
</p>
|
||||
|
@ -1092,7 +1092,7 @@ Google 发布了第一个列型存储数据库 [Bigtable](http://www.read.seas.h
|
|||
## 缓存
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/Q6z24La.png"/>
|
||||
<img src="images/Q6z24La.png">
|
||||
<br/>
|
||||
<strong><a href="http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html">资料来源:可扩展的系统设计模式</a></strong>
|
||||
</p>
|
||||
|
@ -1163,7 +1163,7 @@ Redis 有下列附加功能:
|
|||
#### 缓存模式
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/ONjORqk.png"/>
|
||||
<img src="images/ONjORqk.png">
|
||||
<br/>
|
||||
<strong><a href="http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast">资料来源:从缓存到内存数据网格</a></strong>
|
||||
</p>
|
||||
|
@ -1199,7 +1199,7 @@ def get_user(self, user_id):
|
|||
#### 直写模式
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/0vBc0hN.png"/>
|
||||
<img src="images/0vBc0hN.png">
|
||||
<br/>
|
||||
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
|
||||
</p>
|
||||
|
@ -1234,7 +1234,7 @@ def set_user(user_id, values):
|
|||
#### 回写模式
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/rgSrvjG.png"/>
|
||||
<img src="images/rgSrvjG.png">
|
||||
<br/>
|
||||
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
|
||||
</p>
|
||||
|
@ -1252,7 +1252,7 @@ def set_user(user_id, values):
|
|||
#### 刷新
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/kxtjqgE.png"/>
|
||||
<img src="images/kxtjqgE.png">
|
||||
<br/>
|
||||
<strong><a href=http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast>资料来源:从缓存到内存数据网格</a></strong>
|
||||
</p>
|
||||
|
@ -1284,7 +1284,7 @@ def set_user(user_id, values):
|
|||
## 异步
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/54GYsSx.png"/>
|
||||
<img src="images/54GYsSx.png">
|
||||
<br/>
|
||||
<strong><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>资料来源:可缩放系统构架介绍</a></strong>
|
||||
</p>
|
||||
|
@ -1330,7 +1330,7 @@ def set_user(user_id, values):
|
|||
## 通讯
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/5KeocQs.jpg"/>
|
||||
<img src="images/5KeocQs.jpg">
|
||||
<br/>
|
||||
<strong><a href=http://www.escotal.com/osilayer.html>资料来源:OSI 7层模型</a></strong>
|
||||
</p>
|
||||
|
@ -1365,7 +1365,7 @@ HTTP 是依赖于较低级协议(如 **TCP** 和 **UDP**)的应用层协议
|
|||
### 传输控制协议(TCP)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/JdAsdvG.jpg"/>
|
||||
<img src="images/JdAsdvG.jpg">
|
||||
<br/>
|
||||
<strong><a href="http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/">资料来源:如何制作多人游戏</a></strong>
|
||||
</p>
|
||||
|
@ -1389,7 +1389,7 @@ TCP 对于需要高可靠性但时间紧迫的应用程序很有用。比如包
|
|||
### 用户数据报协议(UDP)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/yzDrJtA.jpg"/>
|
||||
<img src="images/yzDrJtA.jpg">
|
||||
<br/>
|
||||
<strong><a href="http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1">资料来源:如何制作多人游戏</a></strong>
|
||||
</p>
|
||||
|
@ -1418,7 +1418,7 @@ UDP 可靠性更低但适合用在网络电话、视频聊天,流媒体和实
|
|||
### 远程过程调用协议(RPC)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/iF4Mkb5.png"/>
|
||||
<img src="images/iF4Mkb5.png">
|
||||
<br/>
|
||||
<strong><a href="http://www.puncsky.com/blog/2016/02/14/crack-the-system-design-interview">Source: Crack the system design interview</a></strong>
|
||||
</p>
|
||||
|
@ -1631,7 +1631,7 @@ Notes
|
|||
| 设计一个随机 ID 生成系统 | [blog.twitter.com](https://blog.twitter.com/2010/announcing-snowflake)<br/>[github.com](https://github.com/twitter/snowflake/) |
|
||||
| 返回一定时间段内次数前 k 高的请求 | [ucsb.edu](https://icmi.cs.ucsb.edu/research/tech_reports/reports/2005-23.pdf)<br/>[wpi.edu](http://davis.wpi.edu/xmdv/docs/EDBT11-diyang.pdf) |
|
||||
| 设计一个数据源于多个数据中心的服务系统 | [highscalability.com](http://highscalability.com/blog/2009/8/24/how-google-serves-data-from-multiple-datacenters.html) |
|
||||
| 设计一个多人网络卡牌游戏 | [indieflashblog.com](http://www.indieflashblog.com/how-to-create-an-asynchronous-multiplayer-game.html)<br/>[buildnewgames.com](http://buildnewgames.com/real-time-multiplayer/) |
|
||||
| 设计一个多人网络卡牌游戏 | [indieflashblog.com](https://web.archive.org/web/20180929181117/http://www.indieflashblog.com/how-to-create-an-asynchronous-multiplayer-game.html)<br/>[buildnewgames.com](http://buildnewgames.com/real-time-multiplayer/) |
|
||||
| 设计一个垃圾回收系统 | [stuffwithstuff.com](http://journal.stuffwithstuff.com/2013/12/08/babys-first-garbage-collector/)<br/>[washington.edu](http://courses.cs.washington.edu/courses/csep521/07wi/prj/rick.pdf) |
|
||||
| 添加更多的系统设计问题 | [贡献](#贡献) |
|
||||
|
||||
|
@ -1640,7 +1640,7 @@ Notes
|
|||
> 关于现实中真实的系统是怎么设计的文章。
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/TcUo2fw.png"/>
|
||||
<img src="images/TcUo2fw.png">
|
||||
<br/>
|
||||
<strong><a href="https://www.infoq.com/presentations/Twitter-Timeline-Scalability">Source: Twitter timelines at scale</a></strong>
|
||||
</p>
|
||||
|
@ -1723,7 +1723,7 @@ Notes
|
|||
* [Facebook Engineering](https://www.facebook.com/Engineering)
|
||||
* [Flickr Code](http://code.flickr.net/)
|
||||
* [Foursquare Engineering Blog](http://engineering.foursquare.com/)
|
||||
* [GitHub Engineering Blog](http://githubengineering.com/)
|
||||
* [GitHub Engineering Blog](https://github.blog/category/engineering)
|
||||
* [Google Research Blog](http://googleresearch.blogspot.com/)
|
||||
* [Groupon Engineering Blog](https://engineering.groupon.com/)
|
||||
* [Heroku Engineering Blog](https://engineering.heroku.com/)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# 系統設計入門
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/jj3A5N8.png"/>
|
||||
<img src="images/jj3A5N8.png">
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
|||
## 學習單字卡
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/zdCAkB3.png"/>
|
||||
<img src="images/zdCAkB3.png">
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
|
@ -61,7 +61,7 @@
|
|||
你正在尋找資源來面對[**程式語言面試**](https://github.com/donnemartin/interactive-coding-challenges)嗎?
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/b4YtAEN.png"/>
|
||||
<img src="images/b4YtAEN.png">
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
|
@ -91,7 +91,7 @@
|
|||
> 每一章節都包含更深入資源的連結。
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/jrUBAF7.png"/>
|
||||
<img src="images/jrUBAF7.png">
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
|
@ -180,7 +180,7 @@
|
|||
|
||||
> 基於你面試的時間 (短、中、長) 來複習這些建議的主題。
|
||||
|
||||
![Imgur](http://i.imgur.com/OfVllex.png)
|
||||
![Imgur](images/OfVllex.png)
|
||||
|
||||
**Q: 對於面試者來說,我需要知道這裡所有的知識嗎?**
|
||||
|
||||
|
@ -302,49 +302,49 @@
|
|||
|
||||
[閱讀練習與解答](solutions/system_design/pastebin/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/4edXG0T.png)
|
||||
![Imgur](images/4edXG0T.png)
|
||||
|
||||
### 設計一個像是 Twitter 的 timeline (或 Facebook feed)設計一個 Twitter 搜尋功能 (or Facebook 搜尋功能)
|
||||
|
||||
[閱讀練習與解答](solutions/system_design/twitter/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/jrUBAF7.png)
|
||||
![Imgur](images/jrUBAF7.png)
|
||||
|
||||
### 設計一個爬蟲系統
|
||||
|
||||
[閱讀練習與解答](solutions/system_design/web_crawler/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/bWxPtQA.png)
|
||||
![Imgur](images/bWxPtQA.png)
|
||||
|
||||
### 設計 Mint.com 網站
|
||||
|
||||
[閱讀練習與解答](solutions/system_design/mint/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/V5q57vU.png)
|
||||
![Imgur](images/V5q57vU.png)
|
||||
|
||||
### 設計一個社交網站的資料結構
|
||||
|
||||
[閱讀練習與解答](solutions/system_design/social_graph/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/cdCv5g7.png)
|
||||
![Imgur](images/cdCv5g7.png)
|
||||
|
||||
### 設計一個搜尋引擎使用的鍵值儲存資料結構
|
||||
|
||||
[閱讀練習與解答](solutions/system_design/query_cache/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/4j99mhe.png)
|
||||
![Imgur](images/4j99mhe.png)
|
||||
|
||||
### 設計一個根據產品分類的亞馬遜銷售排名
|
||||
|
||||
[閱讀練習與解答](solutions/system_design/sales_rank/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/MzExP06.png)
|
||||
![Imgur](images/MzExP06.png)
|
||||
|
||||
### 在 AWS 上設計一個百萬用戶等級的系統
|
||||
|
||||
[閱讀練習與解答](solutions/system_design/scaling_aws/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/jj3A5N8.png)
|
||||
![Imgur](images/jj3A5N8.png)
|
||||
|
||||
## 物件導向設計面試問題與解答
|
||||
|
||||
|
@ -435,7 +435,7 @@
|
|||
### CAP 理論
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/bgLMI2u.png"/>
|
||||
<img src="images/bgLMI2u.png">
|
||||
<br/>
|
||||
<i><a href=http://robertgreiner.com/2014/08/cap-theorem-revisited>來源:再看 CAP 理論</a></i>
|
||||
</p>
|
||||
|
@ -529,7 +529,7 @@ DNS 或是電子郵件系統使用的就是這種方式,最終一致性在高
|
|||
## 域名系統
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/IOyLj4i.jpg"/>
|
||||
<img src="images/IOyLj4i.jpg">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/srikrupa5/dns-security-presentation-issa>資料來源:DNS 安全介紹</a></i>
|
||||
</p>
|
||||
|
@ -567,7 +567,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
|
|||
## 內容傳遞網路(CDN)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/h9TAuGI.jpg"/>
|
||||
<img src="images/h9TAuGI.jpg">
|
||||
<br/>
|
||||
<i><a href=https://www.creative-artworks.eu/why-use-a-content-delivery-network-cdn/>來源:為什麼要使用 CDN</a></i>
|
||||
</p>
|
||||
|
@ -608,7 +608,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
|
|||
## 負載平衡器
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/h81n9iK.png"/>
|
||||
<img src="images/h81n9iK.png">
|
||||
<br/>
|
||||
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>來源:可擴展的系統設計模式</a></i>
|
||||
</p>
|
||||
|
@ -678,7 +678,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
|
|||
## 反向代理(網頁伺服器)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/n41Azff.png"/>
|
||||
<img src="images/n41Azff.png">
|
||||
<br/>
|
||||
<i><a href=https://upload.wikimedia.org/wikipedia/commons/6/67/Reverse_proxy_h2g2bob.svg>來源:維基百科</a></i>
|
||||
<br/>
|
||||
|
@ -721,7 +721,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
|
|||
## 應用層
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/yB5SYwm.png"/>
|
||||
<img src="images/yB5SYwm.png">
|
||||
<br/>
|
||||
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>資料來源:可縮放式系統架構介紹</a></i>
|
||||
</p>
|
||||
|
@ -758,7 +758,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
|
|||
## 資料庫
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/Xkm5CXz.png"/>
|
||||
<img src="images/Xkm5CXz.png">
|
||||
<br/>
|
||||
<i><a href=https://www.youtube.com/watch?v=vg5onp8TU6Q>來源:擴展你的使用者數量到第一個一千萬量級</a></i>
|
||||
</p>
|
||||
|
@ -781,7 +781,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
|
|||
主資料庫負責讀和寫,並且將寫入的資料複寫至一或多個從屬資料庫中,從屬資料庫只負責讀取。而從屬資料庫可以再將寫入複製到更多以樹狀結構的其他資料庫中。如果主資料庫離線了,系統可以以只讀模式運行,直到某個從屬資料庫被提升為主資料庫,或有新的主資料庫出現。
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/C9ioGtn.png"/>
|
||||
<img src="images/C9ioGtn.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>來源: 可擴展性、可用性、穩定性及其模式</a></i>
|
||||
</p>
|
||||
|
@ -796,7 +796,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
|
|||
兩個主要的資料庫都負責讀取和寫入,並且兩者互相協調。如果其中一個主要資料庫離線,系統可以繼續運作。
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/krAHLGg.png"/>
|
||||
<img src="images/krAHLGg.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>來源: 可擴展性、可用性、穩定性及其模式</a></i>
|
||||
</p>
|
||||
|
@ -824,7 +824,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
|
|||
#### 聯邦式資料庫
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/U3qV33e.png"/>
|
||||
<img src="images/U3qV33e.png">
|
||||
<br/>
|
||||
<i><a href=https://www.youtube.com/watch?v=vg5onp8TU6Q>來源:擴展你的使用者數量到第一個一千萬量級</a></i>
|
||||
</p>
|
||||
|
@ -845,7 +845,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
|
|||
#### 分片
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/wU8x5Id.png"/>
|
||||
<img src="images/wU8x5Id.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>來源: 可擴展性、可用性、穩定性及其模式</a></i>
|
||||
</p>
|
||||
|
@ -991,7 +991,7 @@ NoSQL 指的是 **鍵-值對的資料庫**、**文件類型資料庫**、**列
|
|||
#### 列儲存型資料庫
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/n16iOGk.png"/>
|
||||
<img src="images/n16iOGk.png">
|
||||
<br/>
|
||||
<i><a href=http://blog.grio.com/2015/11/sql-nosql-a-brief-history.html>來源:SQL 和 NoSQL,簡短的歷史介紹</a></i>
|
||||
</p>
|
||||
|
@ -1014,7 +1014,7 @@ Google 發表了第一個列儲存型資料庫 [Bigtable](http://www.read.seas.h
|
|||
#### 圖形資料庫
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/fNcl65g.png"/>
|
||||
<img src="images/fNcl65g.png">
|
||||
<br/>
|
||||
<i><a href=https://en.wikipedia.org/wiki/File:GraphDatabase_PropertyGraph.png>來源: 圖形化資料庫</a></i>
|
||||
</p>
|
||||
|
@ -1042,7 +1042,7 @@ Google 發表了第一個列儲存型資料庫 [Bigtable](http://www.read.seas.h
|
|||
### SQL 或 NoSQL
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/wXGqG5f.png"/>
|
||||
<img src="images/wXGqG5f.png">
|
||||
<br/>
|
||||
<i><a href=https://www.infoq.com/articles/Transition-RDBMS-NoSQL/>來源:從 RDBMS 轉換到 NoSQL</a></i>
|
||||
</p>
|
||||
|
@ -1084,7 +1084,7 @@ Google 發表了第一個列儲存型資料庫 [Bigtable](http://www.read.seas.h
|
|||
## 快取
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/Q6z24La.png"/>
|
||||
<img src="images/Q6z24La.png">
|
||||
<br/>
|
||||
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>來源:可擴展的系統設計模式</a></i>
|
||||
</p>
|
||||
|
@ -1155,7 +1155,7 @@ Redis 還有以下額外的功能:
|
|||
#### 快取模式
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/ONjORqk.png"/>
|
||||
<img src="images/ONjORqk.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast>資料來源:從快取到記憶體資料網格</a></i>
|
||||
</p>
|
||||
|
@ -1191,7 +1191,7 @@ def get_user(self, user_id):
|
|||
#### 寫入模式
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/0vBc0hN.png"/>
|
||||
<img src="images/0vBc0hN.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>資料來源:可獲展性、可用性、穩定性與模式</a></i>
|
||||
</p>
|
||||
|
@ -1226,7 +1226,7 @@ def set_user(user_id, values):
|
|||
#### 事後寫入(回寫)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/rgSrvjG.png"/>
|
||||
<img src="images/rgSrvjG.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>資料來源:可獲展性、可用性、穩定性與模式</a></i>
|
||||
</p>
|
||||
|
@ -1244,7 +1244,7 @@ def set_user(user_id, values):
|
|||
#### 更新式快取
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/kxtjqgE.png"/>
|
||||
<img src="images/kxtjqgE.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast>來源:從快取到記憶體資料網格技術</a></i>
|
||||
</p>
|
||||
|
@ -1276,7 +1276,7 @@ def set_user(user_id, values):
|
|||
## 非同步機制
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/54GYsSx.png"/>
|
||||
<img src="images/54GYsSx.png">
|
||||
<br/>
|
||||
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>資料來源:可縮放性系統架構介紹</a></i>
|
||||
</p>
|
||||
|
@ -1322,7 +1322,7 @@ def set_user(user_id, values):
|
|||
## 通訊
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/5KeocQs.jpg"/>
|
||||
<img src="images/5KeocQs.jpg">
|
||||
<br/>
|
||||
<i><a href=http://www.escotal.com/osilayer.html>來源:OSI 七層模型</a></i>
|
||||
</p>
|
||||
|
@ -1354,7 +1354,7 @@ HTTP 是依賴於較底層的協議(例如:**TCP** 和 **UDP**) 的應用層
|
|||
### 傳輸控制通訊協定(TCP)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/JdAsdvG.jpg"/>
|
||||
<img src="images/JdAsdvG.jpg">
|
||||
<br/>
|
||||
<i><a href=http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/>來源:如何開發多人遊戲</a></i>
|
||||
</p>
|
||||
|
@ -1378,7 +1378,7 @@ TCP 對於需要高可靠、低時間急迫性的應用來說很有用,比如
|
|||
### 使用者資料流通訊協定 (UDP)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/yzDrJtA.jpg"/>
|
||||
<img src="images/yzDrJtA.jpg">
|
||||
<br/>
|
||||
<i><a href=http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/>資料來源:如何製作多人遊戲</a></i>
|
||||
</p>
|
||||
|
@ -1407,7 +1407,7 @@ UDP 的可靠性較低,但適合用在像是網路電話、視訊聊天、串
|
|||
### 遠端程式呼叫 (RPC)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/iF4Mkb5.png"/>
|
||||
<img src="images/iF4Mkb5.png">
|
||||
<br/>
|
||||
<i><a href=http://www.puncsky.com/blog/2016-02-13-crack-the-system-design-interview>資料來源:破解系統設計面試</a></i>
|
||||
</p>
|
||||
|
@ -1621,7 +1621,7 @@ Notes
|
|||
| 設計一個隨機 ID 生成系統 | [blog.twitter.com](https://blog.twitter.com/2010/announcing-snowflake)<br/>[github.com](https://github.com/twitter/snowflake/) |
|
||||
| 給定一段時間,回傳次數排名前 K 的請求 | [ucsb.edu](https://icmi.cs.ucsb.edu/research/tech_reports/reports/2005-23.pdf)<br/>[wpi.edu](http://davis.wpi.edu/xmdv/docs/EDBT11-diyang.pdf) |
|
||||
| 設計一個資料來源在多個資料中心的系統 | [highscalability.com](http://highscalability.com/blog/2009/8/24/how-google-serves-data-from-multiple-datacenters.html) |
|
||||
| 設計一個線上多人卡牌遊戲 | [indieflashblog.com](http://www.indieflashblog.com/how-to-create-an-asynchronous-multiplayer-game.html)<br/>[buildnewgames.com](http://buildnewgames.com/real-time-multiplayer/) |
|
||||
| 設計一個線上多人卡牌遊戲 | [indieflashblog.com](https://web.archive.org/web/20180929181117/http://www.indieflashblog.com/how-to-create-an-asynchronous-multiplayer-game.html)<br/>[buildnewgames.com](http://buildnewgames.com/real-time-multiplayer/) |
|
||||
| 設計一個垃圾回收系統 | [stuffwithstuff.com](http://journal.stuffwithstuff.com/2013/12/08/babys-first-garbage-collector/)<br/>[washington.edu](http://courses.cs.washington.edu/courses/csep521/07wi/prj/rick.pdf) |
|
||||
| 貢獻更多系統設計問題 | [Contribute](#如何貢獻) |
|
||||
|
||||
|
@ -1630,7 +1630,7 @@ Notes
|
|||
> 底下是關於真實世界的系統架構是如何設計的文章
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/TcUo2fw.png"/>
|
||||
<img src="images/TcUo2fw.png">
|
||||
<br/>
|
||||
<i><a href=https://www.infoq.com/presentations/Twitter-Timeline-Scalability>資料來源:可擴展式的 Twitter 時間軸設計</a></i>
|
||||
</p>
|
||||
|
@ -1713,7 +1713,7 @@ Notes
|
|||
* [Facebook Engineering](https://www.facebook.com/Engineering)
|
||||
* [Flickr Code](http://code.flickr.net/)
|
||||
* [Foursquare Engineering Blog](http://engineering.foursquare.com/)
|
||||
* [GitHub Engineering Blog](http://githubengineering.com/)
|
||||
* [GitHub Engineering Blog](https://github.blog/category/engineering)
|
||||
* [Google Research Blog](http://googleresearch.blogspot.com/)
|
||||
* [Groupon Engineering Blog](https://engineering.groupon.com/)
|
||||
* [Heroku Engineering Blog](https://engineering.heroku.com/)
|
||||
|
|
100
README.md
|
@ -5,7 +5,7 @@ _[English](README.md) ∙ [日本語](README-ja.md) ∙ [简体中文](README-zh
|
|||
# The System Design Primer
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/jj3A5N8.png"/>
|
||||
<img src="images/jj3A5N8.png">
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
|
@ -46,7 +46,7 @@ Additional topics for interview prep:
|
|||
## Anki flashcards
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/zdCAkB3.png"/>
|
||||
<img src="images/zdCAkB3.png">
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
|
@ -63,7 +63,7 @@ Great for use while on-the-go.
|
|||
Looking for resources to help you prep for the [**Coding Interview**](https://github.com/donnemartin/interactive-coding-challenges)?
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/b4YtAEN.png"/>
|
||||
<img src="images/b4YtAEN.png">
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
|
@ -93,7 +93,7 @@ Review the [Contributing Guidelines](CONTRIBUTING.md).
|
|||
> Each section contains links to more in-depth resources.
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/jrUBAF7.png"/>
|
||||
<img src="images/jrUBAF7.png">
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
|
@ -183,7 +183,7 @@ Review the [Contributing Guidelines](CONTRIBUTING.md).
|
|||
|
||||
> Suggested topics to review based on your interview timeline (short, medium, long).
|
||||
|
||||
![Imgur](http://i.imgur.com/OfVllex.png)
|
||||
![Imgur](images/OfVllex.png)
|
||||
|
||||
**Q: For interviews, do I need to know everything here?**
|
||||
|
||||
|
@ -306,49 +306,49 @@ Check out the following links to get a better idea of what to expect:
|
|||
|
||||
[View exercise and solution](solutions/system_design/pastebin/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/4edXG0T.png)
|
||||
![Imgur](images/4edXG0T.png)
|
||||
|
||||
### Design the Twitter timeline and search (or Facebook feed and search)
|
||||
|
||||
[View exercise and solution](solutions/system_design/twitter/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/jrUBAF7.png)
|
||||
![Imgur](images/jrUBAF7.png)
|
||||
|
||||
### Design a web crawler
|
||||
|
||||
[View exercise and solution](solutions/system_design/web_crawler/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/bWxPtQA.png)
|
||||
![Imgur](images/bWxPtQA.png)
|
||||
|
||||
### Design Mint.com
|
||||
|
||||
[View exercise and solution](solutions/system_design/mint/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/V5q57vU.png)
|
||||
![Imgur](images/V5q57vU.png)
|
||||
|
||||
### Design the data structures for a social network
|
||||
|
||||
[View exercise and solution](solutions/system_design/social_graph/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/cdCv5g7.png)
|
||||
![Imgur](images/cdCv5g7.png)
|
||||
|
||||
### Design a key-value store for a search engine
|
||||
|
||||
[View exercise and solution](solutions/system_design/query_cache/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/4j99mhe.png)
|
||||
![Imgur](images/4j99mhe.png)
|
||||
|
||||
### Design Amazon's sales ranking by category feature
|
||||
|
||||
[View exercise and solution](solutions/system_design/sales_rank/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/MzExP06.png)
|
||||
![Imgur](images/MzExP06.png)
|
||||
|
||||
### Design a system that scales to millions of users on AWS
|
||||
|
||||
[View exercise and solution](solutions/system_design/scaling_aws/README.md)
|
||||
|
||||
![Imgur](http://i.imgur.com/jj3A5N8.png)
|
||||
![Imgur](images/jj3A5N8.png)
|
||||
|
||||
## Object-oriented design interview questions with solutions
|
||||
|
||||
|
@ -440,7 +440,7 @@ Generally, you should aim for **maximal throughput** with **acceptable latency**
|
|||
### CAP theorem
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/bgLMI2u.png"/>
|
||||
<img src="images/bgLMI2u.png">
|
||||
<br/>
|
||||
<i><a href=http://robertgreiner.com/2014/08/cap-theorem-revisited>Source: CAP theorem revisited</a></i>
|
||||
</p>
|
||||
|
@ -465,6 +465,7 @@ AP is a good choice if the business needs allow for [eventual consistency](#even
|
|||
|
||||
### Source(s) and further reading
|
||||
|
||||
|
||||
- [CAP theorem revisited](http://robertgreiner.com/2014/08/cap-theorem-revisited/)
|
||||
- [A plain english introduction to CAP theorem](http://ksat.me/a-plain-english-introduction-to-cap-theorem)
|
||||
- [CAP FAQ](https://github.com/henryr/cap-faq)
|
||||
|
@ -580,7 +581,7 @@ If both `Foo` and `Bar` each had 99.9% availability, their total availability in
|
|||
## Domain name system
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/IOyLj4i.jpg"/>
|
||||
<img src="images/IOyLj4i.jpg">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/srikrupa5/dns-security-presentation-issa>Source: DNS security presentation</a></i>
|
||||
</p>
|
||||
|
@ -596,6 +597,7 @@ DNS is hierarchical, with a few authoritative servers at the top level. Your rou
|
|||
|
||||
Services such as [CloudFlare](https://www.cloudflare.com/dns/) and [Route 53](https://aws.amazon.com/route53/) provide managed DNS services. Some DNS services can route traffic through various methods:
|
||||
|
||||
|
||||
- [Weighted round robin](https://www.g33kinfo.com/info/round-robin-vs-weighted-round-robin-lb)
|
||||
- Prevent traffic from going to servers under maintenance
|
||||
- Balance between varying cluster sizes
|
||||
|
@ -603,6 +605,7 @@ Services such as [CloudFlare](https://www.cloudflare.com/dns/) and [Route 53](ht
|
|||
- Latency-based
|
||||
- Geolocation-based
|
||||
|
||||
|
||||
### Disadvantage(s): DNS
|
||||
|
||||
- Accessing a DNS server introduces a slight delay, although mitigated by caching described above.
|
||||
|
@ -618,7 +621,7 @@ Services such as [CloudFlare](https://www.cloudflare.com/dns/) and [Route 53](ht
|
|||
## Content delivery network
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/h9TAuGI.jpg"/>
|
||||
<img src="images/h9TAuGI.jpg">
|
||||
<br/>
|
||||
<i><a href=https://www.creative-artworks.eu/why-use-a-content-delivery-network-cdn/>Source: Why use a CDN</a></i>
|
||||
</p>
|
||||
|
@ -627,9 +630,11 @@ A content delivery network (CDN) is a globally distributed network of proxy serv
|
|||
|
||||
Serving content from CDNs can significantly improve performance in two ways:
|
||||
|
||||
|
||||
- Users receive content at data centers close to them
|
||||
- Your servers do not have to serve requests that the CDN fulfills
|
||||
|
||||
|
||||
### Push CDNs
|
||||
|
||||
Push CDNs receive new content whenever changes occur on your server. You take full responsibility for providing content, uploading directly to the CDN and rewriting URLs to point to the CDN. You can configure when content expires and when it is updated. Content is uploaded only when it is new or changed, minimizing traffic, but maximizing storage.
|
||||
|
@ -659,7 +664,7 @@ Sites with heavy traffic work well with pull CDNs, as traffic is spread out more
|
|||
## Load balancer
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/h81n9iK.png"/>
|
||||
<img src="images/h81n9iK.png">
|
||||
<br/>
|
||||
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>Source: Scalable system design patterns</a></i>
|
||||
</p>
|
||||
|
@ -729,7 +734,7 @@ Load balancers can also help with horizontal scaling, improving performance and
|
|||
## Reverse proxy (web server)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/n41Azff.png"/>
|
||||
<img src="images/n41Azff.png">
|
||||
<br/>
|
||||
<i><a href=https://upload.wikimedia.org/wikipedia/commons/6/67/Reverse_proxy_h2g2bob.svg>Source: Wikipedia</a></i>
|
||||
<br/>
|
||||
|
@ -772,7 +777,7 @@ Additional benefits include:
|
|||
## Application layer
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/yB5SYwm.png"/>
|
||||
<img src="images/yB5SYwm.png">
|
||||
<br/>
|
||||
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>Source: Intro to architecting systems for scale</a></i>
|
||||
</p>
|
||||
|
@ -807,7 +812,7 @@ Systems such as [Consul](https://www.consul.io/docs/index.html), [Etcd](https://
|
|||
## Database
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/Xkm5CXz.png"/>
|
||||
<img src="images/Xkm5CXz.png">
|
||||
<br/>
|
||||
<i><a href=https://www.youtube.com/watch?v=kKjm4ehYiMs>Source: Scaling up to your first 10 million users</a></i>
|
||||
</p>
|
||||
|
@ -830,7 +835,7 @@ There are many techniques to scale a relational database: **master-slave replica
|
|||
The master serves reads and writes, replicating writes to one or more slaves, which serve only reads. Slaves can also replicate to additional slaves in a tree-like fashion. If the master goes offline, the system can continue to operate in read-only mode until a slave is promoted to a master or a new master is provisioned.
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/C9ioGtn.png"/>
|
||||
<img src="images/C9ioGtn.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||
</p>
|
||||
|
@ -845,7 +850,7 @@ The master serves reads and writes, replicating writes to one or more slaves, wh
|
|||
Both masters serve reads and writes and coordinate with each other on writes. If either master goes down, the system can continue to operate with both reads and writes.
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/krAHLGg.png"/>
|
||||
<img src="images/krAHLGg.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||
</p>
|
||||
|
@ -873,7 +878,7 @@ Both masters serve reads and writes and coordinate with each other on writes. If
|
|||
#### Federation
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/U3qV33e.png"/>
|
||||
<img src="images/U3qV33e.png">
|
||||
<br/>
|
||||
<i><a href=https://www.youtube.com/watch?v=kKjm4ehYiMs>Source: Scaling up to your first 10 million users</a></i>
|
||||
</p>
|
||||
|
@ -894,7 +899,7 @@ Federation (or functional partitioning) splits up databases by function. For exa
|
|||
#### Sharding
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/wU8x5Id.png"/>
|
||||
<img src="images/wU8x5Id.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||
</p>
|
||||
|
@ -1038,7 +1043,7 @@ Document stores provide high flexibility and are often used for working with occ
|
|||
#### Wide column store
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/n16iOGk.png"/>
|
||||
<img src="images/n16iOGk.png">
|
||||
<br/>
|
||||
<i><a href=http://blog.grio.com/2015/11/sql-nosql-a-brief-history.html>Source: SQL & NoSQL, a brief history</a></i>
|
||||
</p>
|
||||
|
@ -1047,21 +1052,25 @@ Document stores provide high flexibility and are often used for working with occ
|
|||
|
||||
A wide column store's basic unit of data is a column (name/value pair). A column can be grouped in column families (analogous to a SQL table). Super column families further group column families. You can access each column independently with a row key, and columns with the same row key form a row. Each value contains a timestamp for versioning and for conflict resolution.
|
||||
|
||||
|
||||
Google introduced [Bigtable](http://www.read.seas.harvard.edu/~kohler/class/cs239-w08/chang06bigtable.pdf) as the first wide column store, which influenced the open-source [HBase](https://www.mapr.com/blog/in-depth-look-hbase-architecture) often-used in the Hadoop ecosystem, and [Cassandra](http://docs.datastax.com/en/cassandra/3.0/cassandra/architecture/archIntro.html) from Facebook. Stores such as BigTable, HBase, and Cassandra maintain keys in lexicographic order, allowing efficient retrieval of selective key ranges.
|
||||
|
||||
|
||||
Wide column stores offer high availability and high scalability. They are often used for very large data sets.
|
||||
|
||||
##### Source(s) and further reading: wide column store
|
||||
|
||||
|
||||
- [SQL & NoSQL, a brief history](http://blog.grio.com/2015/11/sql-nosql-a-brief-history.html)
|
||||
- [Bigtable architecture](http://www.read.seas.harvard.edu/~kohler/class/cs239-w08/chang06bigtable.pdf)
|
||||
- [HBase architecture](https://www.mapr.com/blog/in-depth-look-hbase-architecture)
|
||||
- [Cassandra architecture](http://docs.datastax.com/en/cassandra/3.0/cassandra/architecture/archIntro.html)
|
||||
|
||||
|
||||
#### Graph database
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/fNcl65g.png"/>
|
||||
<img src="images/fNcl65g.png">
|
||||
<br/>
|
||||
<i><a href=https://en.wikipedia.org/wiki/File:GraphDatabase_PropertyGraph.png>Source: Graph database</a></i>
|
||||
</p>
|
||||
|
@ -1089,7 +1098,7 @@ Graphs databases offer high performance for data models with complex relationshi
|
|||
### SQL or NoSQL
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/wXGqG5f.png"/>
|
||||
<img src="images/wXGqG5f.png">
|
||||
<br/>
|
||||
<i><a href=https://www.infoq.com/articles/Transition-RDBMS-NoSQL/>Source: Transitioning from RDBMS to NoSQL</a></i>
|
||||
</p>
|
||||
|
@ -1131,7 +1140,7 @@ Sample data well-suited for NoSQL:
|
|||
## Cache
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/Q6z24La.png"/>
|
||||
<img src="images/Q6z24La.png">
|
||||
<br/>
|
||||
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>Source: Scalable system design patterns</a></i>
|
||||
</p>
|
||||
|
@ -1158,8 +1167,10 @@ Your database usually includes some level of caching in a default configuration,
|
|||
|
||||
### Application caching
|
||||
|
||||
|
||||
In-memory caches such as Memcached and Redis are key-value stores between your application and your data storage. Since the data is held in RAM, it is much faster than typical databases where data is stored on disk. RAM is more limited than disk, so [cache invalidation](https://en.wikipedia.org/wiki/Cache_algorithms) algorithms such as [least recently used (LRU)](https://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used) can help invalidate 'cold' entries and keep 'hot' data in RAM.
|
||||
|
||||
|
||||
Redis has the following additional features:
|
||||
|
||||
- Persistence option
|
||||
|
@ -1202,7 +1213,7 @@ Since you can only store a limited amount of data in cache, you'll need to deter
|
|||
#### Cache-aside
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/ONjORqk.png"/>
|
||||
<img src="images/ONjORqk.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast>Source: From cache to in-memory data grid</a></i>
|
||||
</p>
|
||||
|
@ -1238,7 +1249,7 @@ Subsequent reads of data added to cache are fast. Cache-aside is also referred t
|
|||
#### Write-through
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/0vBc0hN.png"/>
|
||||
<img src="images/0vBc0hN.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||
</p>
|
||||
|
@ -1273,7 +1284,7 @@ Write-through is a slow overall operation due to the write operation, but subseq
|
|||
#### Write-behind (write-back)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/rgSrvjG.png"/>
|
||||
<img src="images/rgSrvjG.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||
</p>
|
||||
|
@ -1291,7 +1302,7 @@ In write-behind, the application does the following:
|
|||
#### Refresh-ahead
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/kxtjqgE.png"/>
|
||||
<img src="images/kxtjqgE.png">
|
||||
<br/>
|
||||
<i><a href=http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast>Source: From cache to in-memory data grid</a></i>
|
||||
</p>
|
||||
|
@ -1323,7 +1334,7 @@ Refresh-ahead can result in reduced latency vs read-through if the cache can acc
|
|||
## Asynchronism
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/54GYsSx.png"/>
|
||||
<img src="images/54GYsSx.png">
|
||||
<br/>
|
||||
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>Source: Intro to architecting systems for scale</a></i>
|
||||
</p>
|
||||
|
@ -1349,7 +1360,7 @@ The user is not blocked and the job is processed in the background. During this
|
|||
|
||||
Tasks queues receive tasks and their related data, runs them, then delivers their results. They can support scheduling and can be used to run computationally-intensive jobs in the background.
|
||||
|
||||
**Celery** has support for scheduling and primarily has python support.
|
||||
**[Celery](https://docs.celeryproject.org/en/stable/)** has support for scheduling and primarily has python support.
|
||||
|
||||
### Back pressure
|
||||
|
||||
|
@ -1369,7 +1380,7 @@ If queues start to grow significantly, the queue size can become larger than mem
|
|||
## Communication
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/5KeocQs.jpg"/>
|
||||
<img src="images/5KeocQs.jpg">
|
||||
<br/>
|
||||
<i><a href=http://www.escotal.com/osilayer.html>Source: OSI 7 layer model</a></i>
|
||||
</p>
|
||||
|
@ -1401,7 +1412,7 @@ HTTP is an application layer protocol relying on lower-level protocols such as *
|
|||
### Transmission control protocol (TCP)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/JdAsdvG.jpg"/>
|
||||
<img src="images/JdAsdvG.jpg">
|
||||
<br/>
|
||||
<i><a href=http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/>Source: How to make a multiplayer game</a></i>
|
||||
</p>
|
||||
|
@ -1425,7 +1436,7 @@ Use TCP over UDP when:
|
|||
### User datagram protocol (UDP)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/yzDrJtA.jpg"/>
|
||||
<img src="images/yzDrJtA.jpg">
|
||||
<br/>
|
||||
<i><a href=http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/>Source: How to make a multiplayer game</a></i>
|
||||
</p>
|
||||
|
@ -1454,7 +1465,7 @@ Use UDP over TCP when:
|
|||
### Remote procedure call (RPC)
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/iF4Mkb5.png"/>
|
||||
<img src="images/iF4Mkb5.png">
|
||||
<br/>
|
||||
<i><a href=http://www.puncsky.com/blog/2016-02-13-crack-the-system-design-interview>Source: Crack the system design interview</a></i>
|
||||
</p>
|
||||
|
@ -1612,9 +1623,9 @@ Read 4 KB randomly from SSD* 150,000 ns 150 us ~1GB/se
|
|||
Read 1 MB sequentially from memory 250,000 ns 250 us
|
||||
Round trip within same datacenter 500,000 ns 500 us
|
||||
Read 1 MB sequentially from SSD* 1,000,000 ns 1,000 us 1 ms ~1GB/sec SSD, 4X memory
|
||||
Disk seek 10,000,000 ns 10,000 us 10 ms 20x datacenter roundtrip
|
||||
HDD seek 10,000,000 ns 10,000 us 10 ms 20x datacenter roundtrip
|
||||
Read 1 MB sequentially from 1 Gbps 10,000,000 ns 10,000 us 10 ms 40x memory, 10X SSD
|
||||
Read 1 MB sequentially from disk 30,000,000 ns 30,000 us 30 ms 120x memory, 30X SSD
|
||||
Read 1 MB sequentially from HDD 30,000,000 ns 30,000 us 30 ms 120x memory, 30X SSD
|
||||
Send packet CA->Netherlands->CA 150,000,000 ns 150,000 us 150 ms
|
||||
|
||||
Notes
|
||||
|
@ -1626,6 +1637,7 @@ Notes
|
|||
|
||||
Handy metrics based on numbers above:
|
||||
|
||||
|
||||
- Read sequentially from disk at 30 MB/s
|
||||
- Read sequentially from 1 Gbps Ethernet at 100 MB/s
|
||||
- Read sequentially from SSD at 1 GB/s
|
||||
|
@ -1648,6 +1660,7 @@ Handy metrics based on numbers above:
|
|||
|
||||
> Common system design interview questions, with links to resources on how to solve each.
|
||||
|
||||
|
||||
| Question | Reference(s) |
|
||||
| ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Design a file sync service like Dropbox | [youtube.com](https://www.youtube.com/watch?v=PE4gwstWhmc) |
|
||||
|
@ -1674,12 +1687,13 @@ Handy metrics based on numbers above:
|
|||
| Design an API rate limiter | [https://stripe.com/blog/](https://stripe.com/blog/rate-limiters) |
|
||||
| Add a system design question | [Contribute](#contributing) |
|
||||
|
||||
|
||||
### Real world architectures
|
||||
|
||||
> Articles on how real world systems are designed.
|
||||
|
||||
<p align="center">
|
||||
<img src="http://i.imgur.com/TcUo2fw.png"/>
|
||||
<img src="images/TcUo2fw.png">
|
||||
<br/>
|
||||
<i><a href=https://www.infoq.com/presentations/Twitter-Timeline-Scalability>Source: Twitter timelines at scale</a></i>
|
||||
</p>
|
||||
|
@ -1716,6 +1730,7 @@ Handy metrics based on numbers above:
|
|||
|
||||
### Company architectures
|
||||
|
||||
|
||||
| Company | Reference(s) |
|
||||
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Amazon | [Amazon architecture](http://highscalability.com/amazon-architecture) |
|
||||
|
@ -1742,12 +1757,14 @@ Handy metrics based on numbers above:
|
|||
| WhatsApp | [The WhatsApp architecture Facebook bought for $19 billion](http://highscalability.com/blog/2014/2/26/the-whatsapp-architecture-facebook-bought-for-19-billion.html) |
|
||||
| YouTube | [YouTube scalability](https://www.youtube.com/watch?v=w5WVu624fY8)<br/>[YouTube architecture](http://highscalability.com/youtube-architecture) |
|
||||
|
||||
|
||||
### Company engineering blogs
|
||||
|
||||
> Architectures for companies you are interviewing with.
|
||||
>
|
||||
> Questions you encounter might be from the same domain.
|
||||
|
||||
|
||||
- [Airbnb Engineering](http://nerds.airbnb.com/)
|
||||
- [Atlassian Developers](https://developer.atlassian.com/blog/)
|
||||
- [AWS Blog](https://aws.amazon.com/blogs/aws/)
|
||||
|
@ -1789,6 +1806,7 @@ Handy metrics based on numbers above:
|
|||
- [Yelp Engineering Blog](http://engineeringblog.yelp.com/)
|
||||
- [Zynga Engineering Blog](https://www.zynga.com/blogs/engineering)
|
||||
|
||||
|
||||
#### Source(s) and further reading
|
||||
|
||||
Looking to add a blog? To avoid duplicating work, consider adding your company blog to the following repo:
|
||||
|
|
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 168 KiB |
After Width: | Height: | Size: 243 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 212 KiB |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 167 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 482 KiB |
After Width: | Height: | Size: 249 KiB |
After Width: | Height: | Size: 290 KiB |
After Width: | Height: | Size: 1.8 MiB |
After Width: | Height: | Size: 543 KiB |
After Width: | Height: | Size: 194 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 127 KiB |
After Width: | Height: | Size: 160 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 315 KiB |
After Width: | Height: | Size: 334 KiB |
After Width: | Height: | Size: 180 KiB |
After Width: | Height: | Size: 111 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 139 KiB |
After Width: | Height: | Size: 145 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 147 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 1.3 MiB |
|
@ -122,7 +122,7 @@
|
|||
"\n",
|
||||
" def score(self):\n",
|
||||
" total_value = 0\n",
|
||||
" for card in card:\n",
|
||||
" for card in self.cards:\n",
|
||||
" total_value += card.value\n",
|
||||
" return total_value\n",
|
||||
"\n",
|
||||
|
|