Add Ebook generation script (#207)
This commit is contained in:
parent
0022c9708e
commit
55d09f611d
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
|
*.epub
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
|
||||||
|
60
README-ja.md
60
README-ja.md
@ -3,7 +3,7 @@
|
|||||||
# システム設計入門
|
# システム設計入門
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/jj3A5N8.png">
|
<img src="http://i.imgur.com/jj3A5N8.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -44,7 +44,7 @@
|
|||||||
## 暗記カード
|
## 暗記カード
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/zdCAkB3.png">
|
<img src="http://i.imgur.com/zdCAkB3.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -61,7 +61,7 @@
|
|||||||
コード技術面接用の問題を探している場合は[**こちら**](https://github.com/donnemartin/interactive-coding-challenges)
|
コード技術面接用の問題を探している場合は[**こちら**](https://github.com/donnemartin/interactive-coding-challenges)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/b4YtAEN.png">
|
<img src="http://i.imgur.com/b4YtAEN.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -91,7 +91,7 @@
|
|||||||
> それぞれのセクションはより学びを深めるような他の文献へのリンクが貼られています。
|
> それぞれのセクションはより学びを深めるような他の文献へのリンクが貼られています。
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/jrUBAF7.png">
|
<img src="http://i.imgur.com/jrUBAF7.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -436,7 +436,7 @@
|
|||||||
### CAP 理論
|
### CAP 理論
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/bgLMI2u.png">
|
<img src="http://i.imgur.com/bgLMI2u.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://robertgreiner.com/2014/08/cap-theorem-revisited>Source: CAP theorem revisited</a></i>
|
<i><a href=http://robertgreiner.com/2014/08/cap-theorem-revisited>Source: CAP theorem revisited</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -530,7 +530,7 @@
|
|||||||
## ドメインネームシステム
|
## ドメインネームシステム
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/IOyLj4i.jpg">
|
<img src="http://i.imgur.com/IOyLj4i.jpg"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/srikrupa5/dns-security-presentation-issa>Source: DNS security presentation</a></i>
|
<i><a href=http://www.slideshare.net/srikrupa5/dns-security-presentation-issa>Source: DNS security presentation</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -568,7 +568,7 @@ DNSは少数のオーソライズされたサーバーが上位に位置する
|
|||||||
## コンテンツデリバリーネットワーク(Content delivery network)
|
## コンテンツデリバリーネットワーク(Content delivery network)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/h9TAuGI.jpg">
|
<img src="http://i.imgur.com/h9TAuGI.jpg"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://www.creative-artworks.eu/why-use-a-content-delivery-network-cdn/>Source: Why use a CDN</a></i>
|
<i><a href=https://www.creative-artworks.eu/why-use-a-content-delivery-network-cdn/>Source: Why use a CDN</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -609,7 +609,7 @@ CDNを用いてコンテンツを配信することで以下の二つの理由
|
|||||||
## ロードバランサー
|
## ロードバランサー
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/h81n9iK.png">
|
<img src="http://i.imgur.com/h81n9iK.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>Source: Scalable system design patterns</a></i>
|
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>Source: Scalable system design patterns</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -679,7 +679,7 @@ Layer 7 ロードバランサーは [アプリケーションレイヤー](#通
|
|||||||
## リバースプロキシ(webサーバー)
|
## リバースプロキシ(webサーバー)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/n41Azff.png">
|
<img src="http://i.imgur.com/n41Azff.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://upload.wikimedia.org/wikipedia/commons/6/67/Reverse_proxy_h2g2bob.svg>Source: Wikipedia</a></i>
|
<i><a href=https://upload.wikimedia.org/wikipedia/commons/6/67/Reverse_proxy_h2g2bob.svg>Source: Wikipedia</a></i>
|
||||||
<br/>
|
<br/>
|
||||||
@ -722,7 +722,7 @@ Layer 7 ロードバランサーは [アプリケーションレイヤー](#通
|
|||||||
## アプリケーション層
|
## アプリケーション層
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/yB5SYwm.png">
|
<img src="http://i.imgur.com/yB5SYwm.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>Source: Intro to architecting systems for scale</a></i>
|
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>Source: Intro to architecting systems for scale</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -759,7 +759,7 @@ Layer 7 ロードバランサーは [アプリケーションレイヤー](#通
|
|||||||
## データベース
|
## データベース
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/Xkm5CXz.png">
|
<img src="http://i.imgur.com/Xkm5CXz.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://www.youtube.com/watch?v=w95murBkYmU>Source: Scaling up to your first 10 million users</a></i>
|
<i><a href=https://www.youtube.com/watch?v=w95murBkYmU>Source: Scaling up to your first 10 million users</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -782,7 +782,7 @@ SQLなどのリレーショナルデータベースはテーブルに整理さ
|
|||||||
マスターデータベースが読み取りと書き込みを処理し、書き込みを一つ以上のスレーブデータベースに複製します。スレーブデータベースは読み取りのみを処理します。スレーブデータベースは木構造のように追加のスレーブにデータを複製することもできます。マスターデータベースがオフラインになった場合には、いずれかのスレーブがマスターに昇格するか、新しいマスターデータベースが追加されるまでは読み取り専用モードで稼働します。
|
マスターデータベースが読み取りと書き込みを処理し、書き込みを一つ以上のスレーブデータベースに複製します。スレーブデータベースは読み取りのみを処理します。スレーブデータベースは木構造のように追加のスレーブにデータを複製することもできます。マスターデータベースがオフラインになった場合には、いずれかのスレーブがマスターに昇格するか、新しいマスターデータベースが追加されるまでは読み取り専用モードで稼働します。
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/C9ioGtn.png">
|
<img src="http://i.imgur.com/C9ioGtn.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -797,7 +797,7 @@ SQLなどのリレーショナルデータベースはテーブルに整理さ
|
|||||||
いずれのマスターも読み取り書き込みの両方に対応する。書き込みに関してはそれぞれ協調する。いずれかのマスターが落ちても、システム全体としては読み書き両方に対応したまま運用できる。
|
いずれのマスターも読み取り書き込みの両方に対応する。書き込みに関してはそれぞれ協調する。いずれかのマスターが落ちても、システム全体としては読み書き両方に対応したまま運用できる。
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/krAHLGg.png">
|
<img src="http://i.imgur.com/krAHLGg.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -825,7 +825,7 @@ SQLなどのリレーショナルデータベースはテーブルに整理さ
|
|||||||
#### Federation
|
#### Federation
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/U3qV33e.png">
|
<img src="http://i.imgur.com/U3qV33e.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://www.youtube.com/watch?v=w95murBkYmU>Source: Scaling up to your first 10 million users</a></i>
|
<i><a href=https://www.youtube.com/watch?v=w95murBkYmU>Source: Scaling up to your first 10 million users</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -846,7 +846,7 @@ SQLなどのリレーショナルデータベースはテーブルに整理さ
|
|||||||
#### シャーディング
|
#### シャーディング
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/wU8x5Id.png">
|
<img src="http://i.imgur.com/wU8x5Id.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -990,7 +990,7 @@ NoSQL は **key-value store**、 **document-store**、 **wide column store**、
|
|||||||
#### ワイドカラムストア
|
#### ワイドカラムストア
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/n16iOGk.png">
|
<img src="http://i.imgur.com/n16iOGk.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://blog.grio.com/2015/11/sql-nosql-a-brief-history.html>Source: SQL & NoSQL, a brief history</a></i>
|
<i><a href=http://blog.grio.com/2015/11/sql-nosql-a-brief-history.html>Source: SQL & NoSQL, a brief history</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1013,7 +1013,7 @@ Googleは[Bigtable](http://www.read.seas.harvard.edu/~kohler/class/cs239-w08/cha
|
|||||||
#### グラフデータベース
|
#### グラフデータベース
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/fNcl65g.png">
|
<img src="http://i.imgur.com/fNcl65g.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://en.wikipedia.org/wiki/File:GraphDatabase_PropertyGraph.png>Source: Graph database</a></i>
|
<i><a href=https://en.wikipedia.org/wiki/File:GraphDatabase_PropertyGraph.png>Source: Graph database</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1041,7 +1041,7 @@ Googleは[Bigtable](http://www.read.seas.harvard.edu/~kohler/class/cs239-w08/cha
|
|||||||
### SQLか?NoSQLか?
|
### SQLか?NoSQLか?
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/wXGqG5f.png">
|
<img src="http://i.imgur.com/wXGqG5f.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://www.infoq.com/articles/Transition-RDBMS-NoSQL/>Source: Transitioning from RDBMS to NoSQL</a></i>
|
<i><a href=https://www.infoq.com/articles/Transition-RDBMS-NoSQL/>Source: Transitioning from RDBMS to NoSQL</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1083,7 +1083,7 @@ NoSQLに適するサンプルデータ:
|
|||||||
## キャッシュ
|
## キャッシュ
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/Q6z24La.png">
|
<img src="http://i.imgur.com/Q6z24La.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>Source: Scalable system design patterns</a></i>
|
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>Source: Scalable system design patterns</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1154,7 +1154,7 @@ Redisはさらに以下のような機能を備えています:
|
|||||||
#### キャッシュアサイド
|
#### キャッシュアサイド
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/ONjORqk.png">
|
<img src="http://i.imgur.com/ONjORqk.png"/>
|
||||||
<br/>
|
<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>
|
<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>
|
</p>
|
||||||
@ -1190,7 +1190,7 @@ def get_user(self, user_id):
|
|||||||
#### ライトスルー
|
#### ライトスルー
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/0vBc0hN.png">
|
<img src="http://i.imgur.com/0vBc0hN.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1225,7 +1225,7 @@ def set_user(user_id, values):
|
|||||||
#### ライトビハインド (ライトバック)
|
#### ライトビハインド (ライトバック)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/rgSrvjG.png">
|
<img src="http://i.imgur.com/rgSrvjG.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1243,7 +1243,7 @@ def set_user(user_id, values):
|
|||||||
#### リフレッシュアヘッド
|
#### リフレッシュアヘッド
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/kxtjqgE.png">
|
<img src="http://i.imgur.com/kxtjqgE.png"/>
|
||||||
<br/>
|
<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>
|
<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>
|
</p>
|
||||||
@ -1275,7 +1275,7 @@ def set_user(user_id, values):
|
|||||||
## 非同期処理
|
## 非同期処理
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/54GYsSx.png">
|
<img src="http://i.imgur.com/54GYsSx.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>Source: Intro to architecting systems for scale</a></i>
|
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>Source: Intro to architecting systems for scale</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1321,7 +1321,7 @@ def set_user(user_id, values):
|
|||||||
## 通信
|
## 通信
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/5KeocQs.jpg">
|
<img src="http://i.imgur.com/5KeocQs.jpg"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.escotal.com/osilayer.html>Source: OSI 7 layer model</a></i>
|
<i><a href=http://www.escotal.com/osilayer.html>Source: OSI 7 layer model</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1353,7 +1353,7 @@ HTTPは**TCP** や **UDP** などの低級プロトコルに依存している
|
|||||||
### 伝送制御プロトコル (TCP)
|
### 伝送制御プロトコル (TCP)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/JdAsdvG.jpg">
|
<img src="http://i.imgur.com/JdAsdvG.jpg"/>
|
||||||
<br/>
|
<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>
|
<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>
|
</p>
|
||||||
@ -1377,7 +1377,7 @@ TCPは高い依存性を要し、時間制約が厳しくないものに適し
|
|||||||
### ユーザデータグラムプロトコル (UDP)
|
### ユーザデータグラムプロトコル (UDP)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/yzDrJtA.jpg">
|
<img src="http://i.imgur.com/yzDrJtA.jpg"/>
|
||||||
<br/>
|
<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>
|
<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>
|
</p>
|
||||||
@ -1406,7 +1406,7 @@ TCPよりもUDPを使うのは:
|
|||||||
### 遠隔手続呼出 (RPC)
|
### 遠隔手続呼出 (RPC)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/iF4Mkb5.png">
|
<img src="http://i.imgur.com/iF4Mkb5.png"/>
|
||||||
<br/>
|
<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>
|
<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>
|
</p>
|
||||||
@ -1602,7 +1602,7 @@ Notes
|
|||||||
| 質問 | 解答 |
|
| 質問 | 解答 |
|
||||||
|---|---|
|
|---|---|
|
||||||
| Dropboxのようなファイル同期サービスを設計する | [youtube.com](https://www.youtube.com/watch?v=PE4gwstWhmc) |
|
| Dropboxのようなファイル同期サービスを設計する | [youtube.com](https://www.youtube.com/watch?v=PE4gwstWhmc) |
|
||||||
| Googleのような検索エンジンの設計 | [queue.acm.org](http://queue.acm.org/detail.cfm?id=988407)<br/>[stackexchange.com](http://programmers.stackexchange.com/questions/38324/interview-question-how-would-you-implement-google-search)<br/>[ardendertat.com](http://www.ardendertat.com/2012/01/11/implementing-search-engines/)<br>[stanford.edu](http://infolab.stanford.edu/~backrub/google.html) |
|
| Googleのような検索エンジンの設計 | [queue.acm.org](http://queue.acm.org/detail.cfm?id=988407)<br/>[stackexchange.com](http://programmers.stackexchange.com/questions/38324/interview-question-how-would-you-implement-google-search)<br/>[ardendertat.com](http://www.ardendertat.com/2012/01/11/implementing-search-engines/)<br/>[stanford.edu](http://infolab.stanford.edu/~backrub/google.html) |
|
||||||
| Googleのようなスケーラブルなwebクローラーの設計 | [quora.com](https://www.quora.com/How-can-I-build-a-web-crawler-from-scratch) |
|
| Googleのようなスケーラブルなwebクローラーの設計 | [quora.com](https://www.quora.com/How-can-I-build-a-web-crawler-from-scratch) |
|
||||||
| Google docsの設計 | [code.google.com](https://code.google.com/p/google-mobwrite/)<br/>[neil.fraser.name](https://neil.fraser.name/writing/sync/) |
|
| Google docsの設計 | [code.google.com](https://code.google.com/p/google-mobwrite/)<br/>[neil.fraser.name](https://neil.fraser.name/writing/sync/) |
|
||||||
| Redisのようなキーバリューストアの設計 | [slideshare.net](http://www.slideshare.net/dvirsky/introduction-to-redis) |
|
| Redisのようなキーバリューストアの設計 | [slideshare.net](http://www.slideshare.net/dvirsky/introduction-to-redis) |
|
||||||
@ -1629,7 +1629,7 @@ Notes
|
|||||||
> 世の中のシステムがどのように設計されているかについての記事
|
> 世の中のシステムがどのように設計されているかについての記事
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/TcUo2fw.png">
|
<img src="http://i.imgur.com/TcUo2fw.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://www.infoq.com/presentations/Twitter-Timeline-Scalability>Source: Twitter timelines at scale</a></i>
|
<i><a href=https://www.infoq.com/presentations/Twitter-Timeline-Scalability>Source: Twitter timelines at scale</a></i>
|
||||||
</p>
|
</p>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
# 系统设计入门
|
# 系统设计入门
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/jj3A5N8.png">
|
<img src="http://i.imgur.com/jj3A5N8.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -55,7 +55,7 @@
|
|||||||
## 抽认卡
|
## 抽认卡
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/zdCAkB3.png">
|
<img src="http://i.imgur.com/zdCAkB3.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -72,7 +72,7 @@
|
|||||||
你正在寻找资源以准备[**编程面试**](https://github.com/donnemartin/interactive-coding-challenges)吗?
|
你正在寻找资源以准备[**编程面试**](https://github.com/donnemartin/interactive-coding-challenges)吗?
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/b4YtAEN.png">
|
<img src="http://i.imgur.com/b4YtAEN.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -102,7 +102,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/jrUBAF7.png">
|
<img src="http://i.imgur.com/jrUBAF7.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -446,7 +446,7 @@
|
|||||||
### CAP 理论
|
### CAP 理论
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/bgLMI2u.png">
|
<img src="http://i.imgur.com/bgLMI2u.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="http://robertgreiner.com/2014/08/cap-theorem-revisited">来源:再看 CAP 理论</a></strong>
|
<strong><a href="http://robertgreiner.com/2014/08/cap-theorem-revisited">来源:再看 CAP 理论</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -541,7 +541,7 @@ DNS 和 email 等系统使用的是此种方式。最终一致性在高可用性
|
|||||||
## 域名系统
|
## 域名系统
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/IOyLj4i.jpg">
|
<img src="http://i.imgur.com/IOyLj4i.jpg"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="http://www.slideshare.net/srikrupa5/dns-security-presentation-issa">来源:DNS 安全介绍</a></strong>
|
<strong><a href="http://www.slideshare.net/srikrupa5/dns-security-presentation-issa">来源:DNS 安全介绍</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -579,7 +579,7 @@ DNS 和 email 等系统使用的是此种方式。最终一致性在高可用性
|
|||||||
## 内容分发网络(CDN)
|
## 内容分发网络(CDN)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/h9TAuGI.jpg">
|
<img src="http://i.imgur.com/h9TAuGI.jpg"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="https://www.creative-artworks.eu/why-use-a-content-delivery-network-cdn/">来源:为什么使用 CDN</a></strong>
|
<strong><a href="https://www.creative-artworks.eu/why-use-a-content-delivery-network-cdn/">来源:为什么使用 CDN</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -618,7 +618,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
|
|||||||
## 负载均衡器
|
## 负载均衡器
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/h81n9iK.png">
|
<img src="http://i.imgur.com/h81n9iK.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html">来源:可扩展的系统设计模式</a></strong>
|
<strong><a href="http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html">来源:可扩展的系统设计模式</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -687,7 +687,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
|
|||||||
## 反向代理(web 服务器)
|
## 反向代理(web 服务器)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/n41Azff.png">
|
<img src="http://i.imgur.com/n41Azff.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="https://upload.wikimedia.org/wikipedia/commons/6/67/Reverse_proxy_h2g2bob.svg">资料来源:维基百科</a></strong>
|
<strong><a href="https://upload.wikimedia.org/wikipedia/commons/6/67/Reverse_proxy_h2g2bob.svg">资料来源:维基百科</a></strong>
|
||||||
<br/>
|
<br/>
|
||||||
@ -731,7 +731,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
|
|||||||
## 应用层
|
## 应用层
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/yB5SYwm.png">
|
<img src="http://i.imgur.com/yB5SYwm.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer">资料来源:可缩放系统构架介绍</a></strong>
|
<strong><a href="http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer">资料来源:可缩放系统构架介绍</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -769,7 +769,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
|
|||||||
## 数据库
|
## 数据库
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/Xkm5CXz.png">
|
<img src="http://i.imgur.com/Xkm5CXz.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="https://www.youtube.com/watch?v=w95murBkYmU">资料来源:扩展你的用户数到第一个一千万</a></strong>
|
<strong><a href="https://www.youtube.com/watch?v=w95murBkYmU">资料来源:扩展你的用户数到第一个一千万</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -790,7 +790,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
|
|||||||
关系型数据库扩展包括许多技术:**主从复制**、**主主复制**、**联合**、**分片**、**非规范化**和 **SQL调优**。
|
关系型数据库扩展包括许多技术:**主从复制**、**主主复制**、**联合**、**分片**、**非规范化**和 **SQL调优**。
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/C9ioGtn.png">
|
<img src="http://i.imgur.com/C9ioGtn.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
|
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -805,7 +805,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
|
|||||||
- 参考[不利之处:复制](#不利之处复制)中,主从复制和主主复制**共同**的问题。
|
- 参考[不利之处:复制](#不利之处复制)中,主从复制和主主复制**共同**的问题。
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/krAHLGg.png">
|
<img src="http://i.imgur.com/krAHLGg.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
|
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -840,7 +840,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
|
|||||||
#### 联合
|
#### 联合
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/U3qV33e.png">
|
<img src="http://i.imgur.com/U3qV33e.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="https://www.youtube.com/watch?v=w95murBkYmU">资料来源:扩展你的用户数到第一个一千万</a></strong>
|
<strong><a href="https://www.youtube.com/watch?v=w95murBkYmU">资料来源:扩展你的用户数到第一个一千万</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -862,7 +862,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
|
|||||||
#### 分片
|
#### 分片
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/wU8x5Id.png">
|
<img src="http://i.imgur.com/wU8x5Id.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
|
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -1006,7 +1006,7 @@ MongoDB 和 CouchDB 等一些文档类型存储还提供了类似 SQL 语言的
|
|||||||
#### 列型存储
|
#### 列型存储
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/n16iOGk.png">
|
<img src="http://i.imgur.com/n16iOGk.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="http://blog.grio.com/2015/11/sql-nosql-a-brief-history.html">资料来源: SQL 和 NoSQL,一个简短的历史</a></strong>
|
<strong><a href="http://blog.grio.com/2015/11/sql-nosql-a-brief-history.html">资料来源: SQL 和 NoSQL,一个简短的历史</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -1029,9 +1029,9 @@ Google 发布了第一个列型存储数据库 [Bigtable](http://www.read.seas.h
|
|||||||
#### 图数据库
|
#### 图数据库
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/fNcl65g.png">
|
<img src="http://i.imgur.com/fNcl65g.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="https://en.wikipedia.org/wiki/File:GraphDatabase_PropertyGraph.png">资料来源:图数据库</a></strong>
|
<strong><a href="https://en.wikipedia.org/wiki/File:GraphDatabase_PropertyGraph.png"/>资料来源:图数据库</a></strong>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
> 抽象模型: 图
|
> 抽象模型: 图
|
||||||
@ -1056,7 +1056,7 @@ Google 发布了第一个列型存储数据库 [Bigtable](http://www.read.seas.h
|
|||||||
### SQL 还是 NoSQL
|
### SQL 还是 NoSQL
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/wXGqG5f.png">
|
<img src="http://i.imgur.com/wXGqG5f.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="https://www.infoq.com/articles/Transition-RDBMS-NoSQL/">资料来源:从 RDBMS 转换到 NoSQL</a></strong>
|
<strong><a href="https://www.infoq.com/articles/Transition-RDBMS-NoSQL/">资料来源:从 RDBMS 转换到 NoSQL</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -1097,7 +1097,7 @@ Google 发布了第一个列型存储数据库 [Bigtable](http://www.read.seas.h
|
|||||||
## 缓存
|
## 缓存
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/Q6z24La.png">
|
<img src="http://i.imgur.com/Q6z24La.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html">资料来源:可扩展的系统设计模式</a></strong>
|
<strong><a href="http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html">资料来源:可扩展的系统设计模式</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -1168,7 +1168,7 @@ Redis 有下列附加功能:
|
|||||||
#### 缓存模式
|
#### 缓存模式
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/ONjORqk.png">
|
<img src="http://i.imgur.com/ONjORqk.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast">资料来源:从缓存到内存数据网格</a></strong>
|
<strong><a href="http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast">资料来源:从缓存到内存数据网格</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -1204,7 +1204,7 @@ def get_user(self, user_id):
|
|||||||
#### 直写模式
|
#### 直写模式
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/0vBc0hN.png">
|
<img src="http://i.imgur.com/0vBc0hN.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
|
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -1239,7 +1239,7 @@ def set_user(user_id, values):
|
|||||||
#### 回写模式
|
#### 回写模式
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/rgSrvjG.png">
|
<img src="http://i.imgur.com/rgSrvjG.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
|
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -1257,7 +1257,7 @@ def set_user(user_id, values):
|
|||||||
#### 刷新
|
#### 刷新
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/kxtjqgE.png">
|
<img src="http://i.imgur.com/kxtjqgE.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href=http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast>资料来源:从缓存到内存数据网格</a></strong>
|
<strong><a href=http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast>资料来源:从缓存到内存数据网格</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -1289,7 +1289,7 @@ def set_user(user_id, values):
|
|||||||
## 异步
|
## 异步
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/54GYsSx.png">
|
<img src="http://i.imgur.com/54GYsSx.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>资料来源:可缩放系统构架介绍</a></strong>
|
<strong><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>资料来源:可缩放系统构架介绍</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -1335,7 +1335,7 @@ def set_user(user_id, values):
|
|||||||
## 通讯
|
## 通讯
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/5KeocQs.jpg">
|
<img src="http://i.imgur.com/5KeocQs.jpg"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href=http://www.escotal.com/osilayer.html>资料来源:OSI 7层模型</a></strong>
|
<strong><a href=http://www.escotal.com/osilayer.html>资料来源:OSI 7层模型</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -1370,7 +1370,7 @@ HTTP 是依赖于较低级协议(如 **TCP** 和 **UDP**)的应用层协议
|
|||||||
### 传输控制协议(TCP)
|
### 传输控制协议(TCP)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/JdAsdvG.jpg">
|
<img src="http://i.imgur.com/JdAsdvG.jpg"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/">资料来源:如何制作多人游戏</a></strong>
|
<strong><a href="http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/">资料来源:如何制作多人游戏</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -1394,7 +1394,7 @@ TCP 对于需要高可靠性但时间紧迫的应用程序很有用。比如包
|
|||||||
### 用户数据报协议(UDP)
|
### 用户数据报协议(UDP)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/yzDrJtA.jpg">
|
<img src="http://i.imgur.com/yzDrJtA.jpg"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1">资料来源:如何制作多人游戏</a></strong>
|
<strong><a href="http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1">资料来源:如何制作多人游戏</a></strong>
|
||||||
</p>
|
</p>
|
||||||
@ -1423,7 +1423,7 @@ UDP 可靠性更低但适合用在网络电话、视频聊天,流媒体和实
|
|||||||
### 远程过程调用协议(RPC)
|
### 远程过程调用协议(RPC)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/iF4Mkb5.png">
|
<img src="http://i.imgur.com/iF4Mkb5.png"/>
|
||||||
<br/>
|
<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>
|
<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>
|
</p>
|
||||||
@ -1618,7 +1618,7 @@ Notes
|
|||||||
| 问题 | 引用 |
|
| 问题 | 引用 |
|
||||||
| ----------------------- | ---------------------------------------- |
|
| ----------------------- | ---------------------------------------- |
|
||||||
| 设计类似于 Dropbox 的文件同步服务 | [youtube.com](https://www.youtube.com/watch?v=PE4gwstWhmc) |
|
| 设计类似于 Dropbox 的文件同步服务 | [youtube.com](https://www.youtube.com/watch?v=PE4gwstWhmc) |
|
||||||
| 设计类似于 Google 的搜索引擎 | [queue.acm.org](http://queue.acm.org/detail.cfm?id=988407)<br/>[stackexchange.com](http://programmers.stackexchange.com/questions/38324/interview-question-how-would-you-implement-google-search)<br/>[ardendertat.com](http://www.ardendertat.com/2012/01/11/implementing-search-engines/)<br>[stanford.edu](http://infolab.stanford.edu/~backrub/google.html) |
|
| 设计类似于 Google 的搜索引擎 | [queue.acm.org](http://queue.acm.org/detail.cfm?id=988407)<br/>[stackexchange.com](http://programmers.stackexchange.com/questions/38324/interview-question-how-would-you-implement-google-search)<br/>[ardendertat.com](http://www.ardendertat.com/2012/01/11/implementing-search-engines/)<br/>[stanford.edu](http://infolab.stanford.edu/~backrub/google.html) |
|
||||||
| 设计类似于 Google 的可扩展网络爬虫 | [quora.com](https://www.quora.com/How-can-I-build-a-web-crawler-from-scratch) |
|
| 设计类似于 Google 的可扩展网络爬虫 | [quora.com](https://www.quora.com/How-can-I-build-a-web-crawler-from-scratch) |
|
||||||
| 设计 Google 文档 | [code.google.com](https://code.google.com/p/google-mobwrite/)<br/>[neil.fraser.name](https://neil.fraser.name/writing/sync/) |
|
| 设计 Google 文档 | [code.google.com](https://code.google.com/p/google-mobwrite/)<br/>[neil.fraser.name](https://neil.fraser.name/writing/sync/) |
|
||||||
| 设计类似 Redis 的键值存储 | [slideshare.net](http://www.slideshare.net/dvirsky/introduction-to-redis) |
|
| 设计类似 Redis 的键值存储 | [slideshare.net](http://www.slideshare.net/dvirsky/introduction-to-redis) |
|
||||||
@ -1645,7 +1645,7 @@ Notes
|
|||||||
> 关于现实中真实的系统是怎么设计的文章。
|
> 关于现实中真实的系统是怎么设计的文章。
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/TcUo2fw.png">
|
<img src="http://i.imgur.com/TcUo2fw.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<strong><a href="https://www.infoq.com/presentations/Twitter-Timeline-Scalability">Source: Twitter timelines at scale</a></strong>
|
<strong><a href="https://www.infoq.com/presentations/Twitter-Timeline-Scalability">Source: Twitter timelines at scale</a></strong>
|
||||||
</p>
|
</p>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# 系統設計入門
|
# 系統設計入門
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/jj3A5N8.png">
|
<img src="http://i.imgur.com/jj3A5N8.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -44,7 +44,7 @@
|
|||||||
## 學習單字卡
|
## 學習單字卡
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/zdCAkB3.png">
|
<img src="http://i.imgur.com/zdCAkB3.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -61,7 +61,7 @@
|
|||||||
你正在尋找資源來面對[**程式語言面試**](https://github.com/donnemartin/interactive-coding-challenges)嗎?
|
你正在尋找資源來面對[**程式語言面試**](https://github.com/donnemartin/interactive-coding-challenges)嗎?
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/b4YtAEN.png">
|
<img src="http://i.imgur.com/b4YtAEN.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -91,7 +91,7 @@
|
|||||||
> 每一章節都包含更深入資源的連結。
|
> 每一章節都包含更深入資源的連結。
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/jrUBAF7.png">
|
<img src="http://i.imgur.com/jrUBAF7.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -435,7 +435,7 @@
|
|||||||
### CAP 理論
|
### CAP 理論
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/bgLMI2u.png">
|
<img src="http://i.imgur.com/bgLMI2u.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://robertgreiner.com/2014/08/cap-theorem-revisited>來源:再看 CAP 理論</a></i>
|
<i><a href=http://robertgreiner.com/2014/08/cap-theorem-revisited>來源:再看 CAP 理論</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -529,7 +529,7 @@ DNS 或是電子郵件系統使用的就是這種方式,最終一致性在高
|
|||||||
## 域名系統
|
## 域名系統
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/IOyLj4i.jpg">
|
<img src="http://i.imgur.com/IOyLj4i.jpg"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/srikrupa5/dns-security-presentation-issa>資料來源:DNS 安全介紹</a></i>
|
<i><a href=http://www.slideshare.net/srikrupa5/dns-security-presentation-issa>資料來源:DNS 安全介紹</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -567,7 +567,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
|
|||||||
## 內容傳遞網路(CDN)
|
## 內容傳遞網路(CDN)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/h9TAuGI.jpg">
|
<img src="http://i.imgur.com/h9TAuGI.jpg"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://www.creative-artworks.eu/why-use-a-content-delivery-network-cdn/>來源:為什麼要使用 CDN</a></i>
|
<i><a href=https://www.creative-artworks.eu/why-use-a-content-delivery-network-cdn/>來源:為什麼要使用 CDN</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -608,7 +608,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
|
|||||||
## 負載平衡器
|
## 負載平衡器
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/h81n9iK.png">
|
<img src="http://i.imgur.com/h81n9iK.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>來源:可擴展的系統設計模式</a></i>
|
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>來源:可擴展的系統設計模式</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -678,7 +678,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
|
|||||||
## 反向代理(網頁伺服器)
|
## 反向代理(網頁伺服器)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/n41Azff.png">
|
<img src="http://i.imgur.com/n41Azff.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://upload.wikimedia.org/wikipedia/commons/6/67/Reverse_proxy_h2g2bob.svg>來源:維基百科</a></i>
|
<i><a href=https://upload.wikimedia.org/wikipedia/commons/6/67/Reverse_proxy_h2g2bob.svg>來源:維基百科</a></i>
|
||||||
<br/>
|
<br/>
|
||||||
@ -721,7 +721,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
|
|||||||
## 應用層
|
## 應用層
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/yB5SYwm.png">
|
<img src="http://i.imgur.com/yB5SYwm.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>資料來源:可縮放式系統架構介紹</a></i>
|
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>資料來源:可縮放式系統架構介紹</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -758,7 +758,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
|
|||||||
## 資料庫
|
## 資料庫
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/Xkm5CXz.png">
|
<img src="http://i.imgur.com/Xkm5CXz.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://www.youtube.com/watch?v=vg5onp8TU6Q>來源:擴展你的使用者數量到第一個一千萬量級</a></i>
|
<i><a href=https://www.youtube.com/watch?v=vg5onp8TU6Q>來源:擴展你的使用者數量到第一個一千萬量級</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -781,7 +781,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
|
|||||||
主資料庫負責讀和寫,並且將寫入的資料複寫至一或多個從屬資料庫中,從屬資料庫只負責讀取。而從屬資料庫可以再將寫入複製到更多以樹狀結構的其他資料庫中。如果主資料庫離線了,系統可以以只讀模式運行,直到某個從屬資料庫被提升為主資料庫,或有新的主資料庫出現。
|
主資料庫負責讀和寫,並且將寫入的資料複寫至一或多個從屬資料庫中,從屬資料庫只負責讀取。而從屬資料庫可以再將寫入複製到更多以樹狀結構的其他資料庫中。如果主資料庫離線了,系統可以以只讀模式運行,直到某個從屬資料庫被提升為主資料庫,或有新的主資料庫出現。
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/C9ioGtn.png">
|
<img src="http://i.imgur.com/C9ioGtn.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>來源: 可擴展性、可用性、穩定性及其模式</a></i>
|
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>來源: 可擴展性、可用性、穩定性及其模式</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -796,7 +796,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
|
|||||||
兩個主要的資料庫都負責讀取和寫入,並且兩者互相協調。如果其中一個主要資料庫離線,系統可以繼續運作。
|
兩個主要的資料庫都負責讀取和寫入,並且兩者互相協調。如果其中一個主要資料庫離線,系統可以繼續運作。
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/krAHLGg.png">
|
<img src="http://i.imgur.com/krAHLGg.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>來源: 可擴展性、可用性、穩定性及其模式</a></i>
|
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>來源: 可擴展性、可用性、穩定性及其模式</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -824,7 +824,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
|
|||||||
#### 聯邦式資料庫
|
#### 聯邦式資料庫
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/U3qV33e.png">
|
<img src="http://i.imgur.com/U3qV33e.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://www.youtube.com/watch?v=vg5onp8TU6Q>來源:擴展你的使用者數量到第一個一千萬量級</a></i>
|
<i><a href=https://www.youtube.com/watch?v=vg5onp8TU6Q>來源:擴展你的使用者數量到第一個一千萬量級</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -845,7 +845,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
|
|||||||
#### 分片
|
#### 分片
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/wU8x5Id.png">
|
<img src="http://i.imgur.com/wU8x5Id.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>來源: 可擴展性、可用性、穩定性及其模式</a></i>
|
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>來源: 可擴展性、可用性、穩定性及其模式</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -991,7 +991,7 @@ NoSQL 指的是 **鍵-值對的資料庫**、**文件類型資料庫**、**列
|
|||||||
#### 列儲存型資料庫
|
#### 列儲存型資料庫
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/n16iOGk.png">
|
<img src="http://i.imgur.com/n16iOGk.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://blog.grio.com/2015/11/sql-nosql-a-brief-history.html>來源:SQL 和 NoSQL,簡短的歷史介紹</a></i>
|
<i><a href=http://blog.grio.com/2015/11/sql-nosql-a-brief-history.html>來源:SQL 和 NoSQL,簡短的歷史介紹</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1014,7 +1014,7 @@ Google 發表了第一個列儲存型資料庫 [Bigtable](http://www.read.seas.h
|
|||||||
#### 圖形資料庫
|
#### 圖形資料庫
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/fNcl65g.png">
|
<img src="http://i.imgur.com/fNcl65g.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://en.wikipedia.org/wiki/File:GraphDatabase_PropertyGraph.png>來源: 圖形化資料庫</a></i>
|
<i><a href=https://en.wikipedia.org/wiki/File:GraphDatabase_PropertyGraph.png>來源: 圖形化資料庫</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1042,7 +1042,7 @@ Google 發表了第一個列儲存型資料庫 [Bigtable](http://www.read.seas.h
|
|||||||
### SQL 或 NoSQL
|
### SQL 或 NoSQL
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/wXGqG5f.png">
|
<img src="http://i.imgur.com/wXGqG5f.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://www.infoq.com/articles/Transition-RDBMS-NoSQL/>來源:從 RDBMS 轉換到 NoSQL</a></i>
|
<i><a href=https://www.infoq.com/articles/Transition-RDBMS-NoSQL/>來源:從 RDBMS 轉換到 NoSQL</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1084,7 +1084,7 @@ Google 發表了第一個列儲存型資料庫 [Bigtable](http://www.read.seas.h
|
|||||||
## 快取
|
## 快取
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/Q6z24La.png">
|
<img src="http://i.imgur.com/Q6z24La.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>來源:可擴展的系統設計模式</a></i>
|
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>來源:可擴展的系統設計模式</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1155,7 +1155,7 @@ Redis 還有以下額外的功能:
|
|||||||
#### 快取模式
|
#### 快取模式
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/ONjORqk.png">
|
<img src="http://i.imgur.com/ONjORqk.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast>資料來源:從快取到記憶體資料網格</a></i>
|
<i><a href=http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast>資料來源:從快取到記憶體資料網格</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1191,7 +1191,7 @@ def get_user(self, user_id):
|
|||||||
#### 寫入模式
|
#### 寫入模式
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/0vBc0hN.png">
|
<img src="http://i.imgur.com/0vBc0hN.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>資料來源:可獲展性、可用性、穩定性與模式</a></i>
|
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>資料來源:可獲展性、可用性、穩定性與模式</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1226,7 +1226,7 @@ def set_user(user_id, values):
|
|||||||
#### 事後寫入(回寫)
|
#### 事後寫入(回寫)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/rgSrvjG.png">
|
<img src="http://i.imgur.com/rgSrvjG.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>資料來源:可獲展性、可用性、穩定性與模式</a></i>
|
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>資料來源:可獲展性、可用性、穩定性與模式</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1244,7 +1244,7 @@ def set_user(user_id, values):
|
|||||||
#### 更新式快取
|
#### 更新式快取
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/kxtjqgE.png">
|
<img src="http://i.imgur.com/kxtjqgE.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast>來源:從快取到記憶體資料網格技術</a></i>
|
<i><a href=http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast>來源:從快取到記憶體資料網格技術</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1276,7 +1276,7 @@ def set_user(user_id, values):
|
|||||||
## 非同步機制
|
## 非同步機制
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/54GYsSx.png">
|
<img src="http://i.imgur.com/54GYsSx.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>資料來源:可縮放性系統架構介紹</a></i>
|
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>資料來源:可縮放性系統架構介紹</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1322,7 +1322,7 @@ def set_user(user_id, values):
|
|||||||
## 通訊
|
## 通訊
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/5KeocQs.jpg">
|
<img src="http://i.imgur.com/5KeocQs.jpg"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.escotal.com/osilayer.html>來源:OSI 七層模型</a></i>
|
<i><a href=http://www.escotal.com/osilayer.html>來源:OSI 七層模型</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1354,7 +1354,7 @@ HTTP 是依賴於較底層的協議(例如:**TCP** 和 **UDP**) 的應用層
|
|||||||
### 傳輸控制通訊協定(TCP)
|
### 傳輸控制通訊協定(TCP)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/JdAsdvG.jpg">
|
<img src="http://i.imgur.com/JdAsdvG.jpg"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/>來源:如何開發多人遊戲</a></i>
|
<i><a href=http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/>來源:如何開發多人遊戲</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1378,7 +1378,7 @@ TCP 對於需要高可靠、低時間急迫性的應用來說很有用,比如
|
|||||||
### 使用者資料流通訊協定 (UDP)
|
### 使用者資料流通訊協定 (UDP)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/yzDrJtA.jpg">
|
<img src="http://i.imgur.com/yzDrJtA.jpg"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/>資料來源:如何製作多人遊戲</a></i>
|
<i><a href=http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/>資料來源:如何製作多人遊戲</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1407,7 +1407,7 @@ UDP 的可靠性較低,但適合用在像是網路電話、視訊聊天、串
|
|||||||
### 遠端程式呼叫 (RPC)
|
### 遠端程式呼叫 (RPC)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/iF4Mkb5.png">
|
<img src="http://i.imgur.com/iF4Mkb5.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.puncsky.com/blog/2016-02-13-crack-the-system-design-interview>資料來源:破解系統設計面試</a></i>
|
<i><a href=http://www.puncsky.com/blog/2016-02-13-crack-the-system-design-interview>資料來源:破解系統設計面試</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1630,7 +1630,7 @@ Notes
|
|||||||
> 底下是關於真實世界的系統架構是如何設計的文章
|
> 底下是關於真實世界的系統架構是如何設計的文章
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/TcUo2fw.png">
|
<img src="http://i.imgur.com/TcUo2fw.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://www.infoq.com/presentations/Twitter-Timeline-Scalability>資料來源:可擴展式的 Twitter 時間軸設計</a></i>
|
<i><a href=https://www.infoq.com/presentations/Twitter-Timeline-Scalability>資料來源:可擴展式的 Twitter 時間軸設計</a></i>
|
||||||
</p>
|
</p>
|
||||||
|
60
README.md
60
README.md
@ -3,7 +3,7 @@
|
|||||||
# The System Design Primer
|
# The System Design Primer
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/jj3A5N8.png">
|
<img src="http://i.imgur.com/jj3A5N8.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ Additional topics for interview prep:
|
|||||||
## Anki flashcards
|
## Anki flashcards
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/zdCAkB3.png">
|
<img src="http://i.imgur.com/zdCAkB3.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -61,7 +61,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)?
|
Looking for resources to help you prep for the [**Coding Interview**](https://github.com/donnemartin/interactive-coding-challenges)?
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/b4YtAEN.png">
|
<img src="http://i.imgur.com/b4YtAEN.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ Review the [Contributing Guidelines](CONTRIBUTING.md).
|
|||||||
> Each section contains links to more in-depth resources.
|
> Each section contains links to more in-depth resources.
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/jrUBAF7.png">
|
<img src="http://i.imgur.com/jrUBAF7.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -436,7 +436,7 @@ Generally, you should aim for **maximal throughput** with **acceptable latency**
|
|||||||
### CAP theorem
|
### CAP theorem
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/bgLMI2u.png">
|
<img src="http://i.imgur.com/bgLMI2u.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://robertgreiner.com/2014/08/cap-theorem-revisited>Source: CAP theorem revisited</a></i>
|
<i><a href=http://robertgreiner.com/2014/08/cap-theorem-revisited>Source: CAP theorem revisited</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -530,7 +530,7 @@ This topic is further discussed in the [Database](#database) section:
|
|||||||
## Domain name system
|
## Domain name system
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/IOyLj4i.jpg">
|
<img src="http://i.imgur.com/IOyLj4i.jpg"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/srikrupa5/dns-security-presentation-issa>Source: DNS security presentation</a></i>
|
<i><a href=http://www.slideshare.net/srikrupa5/dns-security-presentation-issa>Source: DNS security presentation</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -568,7 +568,7 @@ Services such as [CloudFlare](https://www.cloudflare.com/dns/) and [Route 53](ht
|
|||||||
## Content delivery network
|
## Content delivery network
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/h9TAuGI.jpg">
|
<img src="http://i.imgur.com/h9TAuGI.jpg"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://www.creative-artworks.eu/why-use-a-content-delivery-network-cdn/>Source: Why use a CDN</a></i>
|
<i><a href=https://www.creative-artworks.eu/why-use-a-content-delivery-network-cdn/>Source: Why use a CDN</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -609,7 +609,7 @@ Sites with heavy traffic work well with pull CDNs, as traffic is spread out more
|
|||||||
## Load balancer
|
## Load balancer
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/h81n9iK.png">
|
<img src="http://i.imgur.com/h81n9iK.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>Source: Scalable system design patterns</a></i>
|
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>Source: Scalable system design patterns</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -679,7 +679,7 @@ Load balancers can also help with horizontal scaling, improving performance and
|
|||||||
## Reverse proxy (web server)
|
## Reverse proxy (web server)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/n41Azff.png">
|
<img src="http://i.imgur.com/n41Azff.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://upload.wikimedia.org/wikipedia/commons/6/67/Reverse_proxy_h2g2bob.svg>Source: Wikipedia</a></i>
|
<i><a href=https://upload.wikimedia.org/wikipedia/commons/6/67/Reverse_proxy_h2g2bob.svg>Source: Wikipedia</a></i>
|
||||||
<br/>
|
<br/>
|
||||||
@ -722,7 +722,7 @@ Additional benefits include:
|
|||||||
## Application layer
|
## Application layer
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/yB5SYwm.png">
|
<img src="http://i.imgur.com/yB5SYwm.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>Source: Intro to architecting systems for scale</a></i>
|
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>Source: Intro to architecting systems for scale</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -757,7 +757,7 @@ Systems such as [Consul](https://www.consul.io/docs/index.html), [Etcd](https://
|
|||||||
## Database
|
## Database
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/Xkm5CXz.png">
|
<img src="http://i.imgur.com/Xkm5CXz.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://www.youtube.com/watch?v=w95murBkYmU>Source: Scaling up to your first 10 million users</a></i>
|
<i><a href=https://www.youtube.com/watch?v=w95murBkYmU>Source: Scaling up to your first 10 million users</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -780,7 +780,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.
|
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">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/C9ioGtn.png">
|
<img src="http://i.imgur.com/C9ioGtn.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -795,7 +795,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.
|
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">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/krAHLGg.png">
|
<img src="http://i.imgur.com/krAHLGg.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -823,7 +823,7 @@ Both masters serve reads and writes and coordinate with each other on writes. I
|
|||||||
#### Federation
|
#### Federation
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/U3qV33e.png">
|
<img src="http://i.imgur.com/U3qV33e.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://www.youtube.com/watch?v=w95murBkYmU>Source: Scaling up to your first 10 million users</a></i>
|
<i><a href=https://www.youtube.com/watch?v=w95murBkYmU>Source: Scaling up to your first 10 million users</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -844,7 +844,7 @@ Federation (or functional partitioning) splits up databases by function. For ex
|
|||||||
#### Sharding
|
#### Sharding
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/wU8x5Id.png">
|
<img src="http://i.imgur.com/wU8x5Id.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -988,7 +988,7 @@ Document stores provide high flexibility and are often used for working with occ
|
|||||||
#### Wide column store
|
#### Wide column store
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/n16iOGk.png">
|
<img src="http://i.imgur.com/n16iOGk.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://blog.grio.com/2015/11/sql-nosql-a-brief-history.html>Source: SQL & NoSQL, a brief history</a></i>
|
<i><a href=http://blog.grio.com/2015/11/sql-nosql-a-brief-history.html>Source: SQL & NoSQL, a brief history</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1011,7 +1011,7 @@ Wide column stores offer high availability and high scalability. They are often
|
|||||||
#### Graph database
|
#### Graph database
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/fNcl65g.png">
|
<img src="http://i.imgur.com/fNcl65g.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://en.wikipedia.org/wiki/File:GraphDatabase_PropertyGraph.png>Source: Graph database</a></i>
|
<i><a href=https://en.wikipedia.org/wiki/File:GraphDatabase_PropertyGraph.png>Source: Graph database</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1039,7 +1039,7 @@ Graphs databases offer high performance for data models with complex relationshi
|
|||||||
### SQL or NoSQL
|
### SQL or NoSQL
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/wXGqG5f.png">
|
<img src="http://i.imgur.com/wXGqG5f.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://www.infoq.com/articles/Transition-RDBMS-NoSQL/>Source: Transitioning from RDBMS to NoSQL</a></i>
|
<i><a href=https://www.infoq.com/articles/Transition-RDBMS-NoSQL/>Source: Transitioning from RDBMS to NoSQL</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1081,7 +1081,7 @@ Sample data well-suited for NoSQL:
|
|||||||
## Cache
|
## Cache
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/Q6z24La.png">
|
<img src="http://i.imgur.com/Q6z24La.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>Source: Scalable system design patterns</a></i>
|
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>Source: Scalable system design patterns</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1152,7 +1152,7 @@ Since you can only store a limited amount of data in cache, you'll need to deter
|
|||||||
#### Cache-aside
|
#### Cache-aside
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/ONjORqk.png">
|
<img src="http://i.imgur.com/ONjORqk.png"/>
|
||||||
<br/>
|
<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>
|
<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>
|
</p>
|
||||||
@ -1188,7 +1188,7 @@ Subsequent reads of data added to cache are fast. Cache-aside is also referred
|
|||||||
#### Write-through
|
#### Write-through
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/0vBc0hN.png">
|
<img src="http://i.imgur.com/0vBc0hN.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1223,7 +1223,7 @@ Write-through is a slow overall operation due to the write operation, but subseq
|
|||||||
#### Write-behind (write-back)
|
#### Write-behind (write-back)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/rgSrvjG.png">
|
<img src="http://i.imgur.com/rgSrvjG.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1241,7 +1241,7 @@ In write-behind, the application does the following:
|
|||||||
#### Refresh-ahead
|
#### Refresh-ahead
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/kxtjqgE.png">
|
<img src="http://i.imgur.com/kxtjqgE.png"/>
|
||||||
<br/>
|
<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>
|
<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>
|
</p>
|
||||||
@ -1273,7 +1273,7 @@ Refresh-ahead can result in reduced latency vs read-through if the cache can acc
|
|||||||
## Asynchronism
|
## Asynchronism
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/54GYsSx.png">
|
<img src="http://i.imgur.com/54GYsSx.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>Source: Intro to architecting systems for scale</a></i>
|
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>Source: Intro to architecting systems for scale</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1319,7 +1319,7 @@ If queues start to grow significantly, the queue size can become larger than mem
|
|||||||
## Communication
|
## Communication
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/5KeocQs.jpg">
|
<img src="http://i.imgur.com/5KeocQs.jpg"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=http://www.escotal.com/osilayer.html>Source: OSI 7 layer model</a></i>
|
<i><a href=http://www.escotal.com/osilayer.html>Source: OSI 7 layer model</a></i>
|
||||||
</p>
|
</p>
|
||||||
@ -1351,7 +1351,7 @@ HTTP is an application layer protocol relying on lower-level protocols such as *
|
|||||||
### Transmission control protocol (TCP)
|
### Transmission control protocol (TCP)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/JdAsdvG.jpg">
|
<img src="http://i.imgur.com/JdAsdvG.jpg"/>
|
||||||
<br/>
|
<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>
|
<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>
|
</p>
|
||||||
@ -1375,7 +1375,7 @@ Use TCP over UDP when:
|
|||||||
### User datagram protocol (UDP)
|
### User datagram protocol (UDP)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/yzDrJtA.jpg">
|
<img src="http://i.imgur.com/yzDrJtA.jpg"/>
|
||||||
<br/>
|
<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>
|
<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>
|
</p>
|
||||||
@ -1404,7 +1404,7 @@ Use UDP over TCP when:
|
|||||||
### Remote procedure call (RPC)
|
### Remote procedure call (RPC)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/iF4Mkb5.png">
|
<img src="http://i.imgur.com/iF4Mkb5.png"/>
|
||||||
<br/>
|
<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>
|
<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>
|
</p>
|
||||||
@ -1600,7 +1600,7 @@ Handy metrics based on numbers above:
|
|||||||
| Question | Reference(s) |
|
| Question | Reference(s) |
|
||||||
|---|---|
|
|---|---|
|
||||||
| Design a file sync service like Dropbox | [youtube.com](https://www.youtube.com/watch?v=PE4gwstWhmc) |
|
| Design a file sync service like Dropbox | [youtube.com](https://www.youtube.com/watch?v=PE4gwstWhmc) |
|
||||||
| Design a search engine like Google | [queue.acm.org](http://queue.acm.org/detail.cfm?id=988407)<br/>[stackexchange.com](http://programmers.stackexchange.com/questions/38324/interview-question-how-would-you-implement-google-search)<br/>[ardendertat.com](http://www.ardendertat.com/2012/01/11/implementing-search-engines/)<br>[stanford.edu](http://infolab.stanford.edu/~backrub/google.html) |
|
| Design a search engine like Google | [queue.acm.org](http://queue.acm.org/detail.cfm?id=988407)<br/>[stackexchange.com](http://programmers.stackexchange.com/questions/38324/interview-question-how-would-you-implement-google-search)<br/>[ardendertat.com](http://www.ardendertat.com/2012/01/11/implementing-search-engines/)<br/>[stanford.edu](http://infolab.stanford.edu/~backrub/google.html) |
|
||||||
| Design a scalable web crawler like Google | [quora.com](https://www.quora.com/How-can-I-build-a-web-crawler-from-scratch) |
|
| Design a scalable web crawler like Google | [quora.com](https://www.quora.com/How-can-I-build-a-web-crawler-from-scratch) |
|
||||||
| Design Google docs | [code.google.com](https://code.google.com/p/google-mobwrite/)<br/>[neil.fraser.name](https://neil.fraser.name/writing/sync/) |
|
| Design Google docs | [code.google.com](https://code.google.com/p/google-mobwrite/)<br/>[neil.fraser.name](https://neil.fraser.name/writing/sync/) |
|
||||||
| Design a key-value store like Redis | [slideshare.net](http://www.slideshare.net/dvirsky/introduction-to-redis) |
|
| Design a key-value store like Redis | [slideshare.net](http://www.slideshare.net/dvirsky/introduction-to-redis) |
|
||||||
@ -1628,7 +1628,7 @@ Handy metrics based on numbers above:
|
|||||||
> Articles on how real world systems are designed.
|
> Articles on how real world systems are designed.
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://i.imgur.com/TcUo2fw.png">
|
<img src="http://i.imgur.com/TcUo2fw.png"/>
|
||||||
<br/>
|
<br/>
|
||||||
<i><a href=https://www.infoq.com/presentations/Twitter-Timeline-Scalability>Source: Twitter timelines at scale</a></i>
|
<i><a href=https://www.infoq.com/presentations/Twitter-Timeline-Scalability>Source: Twitter timelines at scale</a></i>
|
||||||
</p>
|
</p>
|
||||||
|
3
epub-metadata.yaml
Normal file
3
epub-metadata.yaml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
title: System Design Primer
|
||||||
|
creator: Donne Martin
|
||||||
|
date: 2018
|
40
generate-epub.sh
Executable file
40
generate-epub.sh
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
#! /usr/bin/env sh
|
||||||
|
|
||||||
|
generate_from_stdin() {
|
||||||
|
outfile=$1
|
||||||
|
language=$2
|
||||||
|
|
||||||
|
echo "Generating '$language' ..."
|
||||||
|
|
||||||
|
pandoc --metadata-file=epub-metadata.yaml --metadata=lang:$2 --from=markdown -o $1 <&0
|
||||||
|
|
||||||
|
echo "Done! You can find the '$language' book at ./$outfile"
|
||||||
|
}
|
||||||
|
|
||||||
|
generate_with_solutions () {
|
||||||
|
tmpfile=$(mktemp /tmp/sytem-design-primer-epub-generator.XXX)
|
||||||
|
|
||||||
|
cat ./README.md >> $tmpfile
|
||||||
|
|
||||||
|
for dir in ./solutions/system_design/*; do
|
||||||
|
case $dir in *template*) continue;; esac
|
||||||
|
case $dir in *__init__.py*) continue;; esac
|
||||||
|
: [[ -d "$dir" ]] && ( cd "$dir" && cat ./README.md >> $tmpfile && echo "" >> $tmpfile )
|
||||||
|
done
|
||||||
|
|
||||||
|
cat $tmpfile | generate_from_stdin 'README.epub' 'en'
|
||||||
|
|
||||||
|
rm "$tmpfile"
|
||||||
|
}
|
||||||
|
|
||||||
|
generate () {
|
||||||
|
name=$1
|
||||||
|
language=$2
|
||||||
|
|
||||||
|
cat $name.md | generate_from_stdin $name.epub $language
|
||||||
|
}
|
||||||
|
|
||||||
|
generate_with_solutions
|
||||||
|
generate README-ja ja
|
||||||
|
generate README-zh-Hans zh-Hans
|
||||||
|
generate README-zh-TW zh-TW
|
Loading…
Reference in New Issue
Block a user