This commit is contained in:
Evara2 2024-04-03 13:20:55 +05:30 committed by GitHub
commit bdfe71c226
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
45 changed files with 192 additions and 191 deletions

View File

@ -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 ..."

View File

@ -61,7 +61,7 @@ See [Translations](TRANSLATIONS.md).
### Adding translations to new languages
Translations to new languages are always welcome! Keep in mind a transation must be maintained.
Translations to new languages are always welcome! Keep in mind a translation must be maintained.
* Do you have time to be a maintainer for a new language? Please see the list of [translations](TRANSLATIONS.md) and tell us so we know we can count on you in the future.
* Check the [translations](TRANSLATIONS.md), issues, and pull requests to see if a translation is in progress or stalled. If it's in progress, offer to help. If it's stalled, consider becoming the maintainer if you can commit to it.

View File

@ -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>
@ -966,7 +966,7 @@ NoSQL は **key-value store**、 **document-store**、 **wide column store**、
* [キーバリューデータベース](https://en.wikipedia.org/wiki/Key-value_database)
* [キーバリューストアの欠点](http://stackoverflow.com/questions/4056093/what-are-the-disadvantages-of-using-a-key-value-table-over-nullable-columns-or)
* [Redisアーキテクチャ](http://qnimate.com/overview-of-redis-architecture/)
* [メムキャッシュアーキテクチャ](https://www.adayinthelifeof.nl/2011/02/06/memcache-internals/)
* [メムキャッシュアーキテクチャ](https://adayinthelifeof.nl/2011/02/06/memcache-internals/)
#### ドキュメントストア
@ -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/)

View File

@ -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>
@ -977,7 +977,7 @@ NoSQL 是**键-值数据库**、**文档型数据库**、**列型数据库**或*
- [键-值数据库](https://en.wikipedia.org/wiki/Key-value_database)
- [键-值存储的劣势](http://stackoverflow.com/questions/4056093/what-are-the-disadvantages-of-using-a-key-value-table-over-nullable-columns-or)
- [Redis 架构](http://qnimate.com/overview-of-redis-architecture/)
- [Memcached 架构](https://www.adayinthelifeof.nl/2011/02/06/memcache-internals/)
- [Memcached 架构](https://adayinthelifeof.nl/2011/02/06/memcache-internals/)
#### 文档类型存储
@ -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/)

View File

@ -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>
@ -967,7 +967,7 @@ NoSQL 指的是 **鍵-值對的資料庫**、**文件類型資料庫**、**列
* [鍵值對資料庫](https://en.wikipedia.org/wiki/Key-value_database)
* [鍵值對資料庫的缺點](http://stackoverflow.com/questions/4056093/what-are-the-disadvantages-of-using-a-key-value-table-over-nullable-columns-or)
* [Redis 架構](http://qnimate.com/overview-of-redis-architecture/)
* [Memcached 架構](https://www.adayinthelifeof.nl/2011/02/06/memcache-internals/)
* [Memcached 架構](https://adayinthelifeof.nl/2011/02/06/memcache-internals/)
#### 文件類型資料庫
@ -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/)

129
README.md
View File

@ -5,7 +5,7 @@
# 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
@ -389,13 +389,13 @@ First, you'll need a basic understanding of common principles, learning about wh
### Step 2: Review the scalability article
[Scalability](http://www.lecloud.net/tagged/scalability/chrono)
[Scalability](https://web.archive.org/web/20221030091841/http://www.lecloud.net/tagged/scalability/chrono)
* Topics covered:
* [Clones](http://www.lecloud.net/post/7295452622/scalability-for-dummies-part-1-clones)
* [Databases](http://www.lecloud.net/post/7994751381/scalability-for-dummies-part-2-database)
* [Caches](http://www.lecloud.net/post/9246290032/scalability-for-dummies-part-3-cache)
* [Asynchronism](http://www.lecloud.net/post/9699762917/scalability-for-dummies-part-4-asynchronism)
* [Clones](https://web.archive.org/web/20220530193911/https://www.lecloud.net/post/7295452622/scalability-for-dummies-part-1-clones)
* [Databases](https://web.archive.org/web/20220602114024/https://www.lecloud.net/post/7994751381/scalability-for-dummies-part-2-database)
* [Caches](https://web.archive.org/web/20230126233752/https://www.lecloud.net/post/9246290032/scalability-for-dummies-part-3-cache)
* [Asynchronism](https://web.archive.org/web/20220926171507/https://www.lecloud.net/post/9699762917/scalability-for-dummies-part-4-asynchronism)
### Next steps
@ -433,14 +433,14 @@ Generally, you should aim for **maximal throughput** with **acceptable latency**
### Source(s) and further reading
* [Understanding latency vs throughput](https://community.cadence.com/cadence_blogs_8/b/sd/archive/2010/09/13/understanding-latency-vs-throughput)
* [Understanding latency vs throughput](https://community.cadence.com/cadence_blogs_8/b/fv/posts/understanding-latency-vs-throughput)
## Availability vs consistency
### 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>
@ -461,13 +461,14 @@ Waiting for a response from the partitioned node might result in a timeout error
Responses return the most readily available version of the data available on any node, which might not be the latest. Writes might take some time to propagate when the partition is resolved.
AP is a good choice if the business needs allow for [eventual consistency](#eventual-consistency) or when the system needs to continue working despite external errors.
AP is a good choice if the business needs to allow for [eventual consistency](#eventual-consistency) or when the system needs to continue working despite external errors.
### 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)
* [The CAP theorem](https://www.youtube.com/watch?v=k-Yaq8AHlFA)
## Consistency patterns
@ -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,12 +597,12 @@ DNS is hierarchical, with a few authoritative servers at the top level. Your ro
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)
* [Weighted round robin](https://www.jscape.com/blog/load-balancing-algorithms)
* Prevent traffic from going to servers under maintenance
* Balance between varying cluster sizes
* A/B testing
* Latency-based
* Geolocation-based
* [Latency-based](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy.html#routing-policy-latency)
* [Geolocation-based](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy.html#routing-policy-geo)
### Disadvantage(s): DNS
@ -618,7 +619,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,7 +628,7 @@ 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
* Users receive content from data centers close to them
* Your servers do not have to serve requests that the CDN fulfills
### Push CDNs
@ -659,7 +660,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 +730,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 +773,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 +808,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 +831,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 +846,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 +874,7 @@ Both masters serve reads and writes and coordinate with each other on writes. I
#### 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 +895,7 @@ Federation (or functional partitioning) splits up databases by function. For ex
#### 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>
@ -1014,7 +1015,7 @@ A key-value store is the basis for more complex systems such as a document store
* [Key-value database](https://en.wikipedia.org/wiki/Key-value_database)
* [Disadvantages of key-value stores](http://stackoverflow.com/questions/4056093/what-are-the-disadvantages-of-using-a-key-value-table-over-nullable-columns-or)
* [Redis architecture](http://qnimate.com/overview-of-redis-architecture/)
* [Memcached architecture](https://www.adayinthelifeof.nl/2011/02/06/memcache-internals/)
* [Memcached architecture](https://adayinthelifeof.nl/2011/02/06/memcache-internals/)
#### Document store
@ -1038,7 +1039,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,7 +1048,7 @@ 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.
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.edureka.co/blog/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.
@ -1055,13 +1056,13 @@ Wide column stores offer high availability and high scalability. They are often
* [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)
* [HBase architecture](https://www.edureka.co/blog/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 +1090,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 +1132,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,7 +1159,7 @@ 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.
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_replacement_policies#Least_recently_used_(LRU)) can help invalidate 'cold' entries and keep 'hot' data in RAM.
Redis has the following additional features:
@ -1202,7 +1203,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 +1239,7 @@ Subsequent reads of data added to cache are fast. Cache-aside is also referred
#### 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 +1274,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 +1292,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 +1324,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 +1350,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 +1370,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 +1402,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 +1426,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 +1455,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 +1613,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,7 +1627,7 @@ Notes
Handy metrics based on numbers above:
* Read sequentially from disk at 30 MB/s
* Read sequentially from HDD at 30 MB/s
* Read sequentially from 1 Gbps Ethernet at 100 MB/s
* Read sequentially from SSD at 1 GB/s
* Read sequentially from main memory at 4 GB/s
@ -1667,11 +1668,12 @@ Handy metrics based on numbers above:
| Design a content delivery network like CloudFlare | [figshare.com](https://figshare.com/articles/Globally_distributed_content_delivery/6605972) |
| Design a trending topic system like Twitter's | [michael-noll.com](http://www.michael-noll.com/blog/2013/01/18/implementing-real-time-trending-topics-in-storm/)<br/>[snikolov .wordpress.com](http://snikolov.wordpress.com/2012/11/14/early-detection-of-twitter-trends/) |
| Design a random ID generation system | [blog.twitter.com](https://blog.twitter.com/2010/announcing-snowflake)<br/>[github.com](https://github.com/twitter/snowflake/) |
| Return the top k requests during a time interval | [cs.ucsb.edu](https://www.cs.ucsb.edu/sites/cs.ucsb.edu/files/docs/reports/2005-23.pdf)<br/>[wpi.edu](http://davis.wpi.edu/xmdv/docs/EDBT11-diyang.pdf) |
| Return the top k requests during a time interval | [cs.ucsb.edu](https://www.cs.ucsb.edu/sites/default/files/documents/2005-23.pdf)<br/>[wpi.edu](http://davis.wpi.edu/xmdv/docs/EDBT11-diyang.pdf) |
| Design a system that serves data from multiple data centers | [highscalability.com](http://highscalability.com/blog/2009/8/24/how-google-serves-data-from-multiple-datacenters.html) |
| Design an online multiplayer card game | [indieflashblog.com](http://www.indieflashblog.com/how-to-create-an-asynchronous-multiplayer-game.html)<br/>[buildnewgames.com](http://buildnewgames.com/real-time-multiplayer/) |
| Design an online multiplayer card game | [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/) |
| Design a garbage collection system | [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) |
| Design an API rate limiter | [https://stripe.com/blog/](https://stripe.com/blog/rate-limiters) |
| Design a Stock Exchange (like NASDAQ or Binance) | [Jane Street](https://youtu.be/b1e4t2k2KJY)<br/>[Golang Implementation](https://around25.com/blog/building-a-trading-engine-for-a-crypto-exchange/)<br/>[Go Implementation](http://bhomnick.net/building-a-simple-limit-order-in-go/) |
| Add a system design question | [Contribute](#contributing) |
### Real world architectures
@ -1679,7 +1681,7 @@ Handy metrics based on numbers above:
> 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>
@ -1721,7 +1723,7 @@ Handy metrics based on numbers above:
| Amazon | [Amazon architecture](http://highscalability.com/amazon-architecture) |
| Cinchcast | [Producing 1,500 hours of audio every day](http://highscalability.com/blog/2012/7/16/cinchcast-architecture-producing-1500-hours-of-audio-every-d.html) |
| DataSift | [Realtime datamining At 120,000 tweets per second](http://highscalability.com/blog/2011/11/29/datasift-architecture-realtime-datamining-at-120000-tweets-p.html) |
| DropBox | [How we've scaled Dropbox](https://www.youtube.com/watch?v=PE4gwstWhmc) |
| Dropbox | [How we've scaled Dropbox](https://www.youtube.com/watch?v=PE4gwstWhmc) |
| ESPN | [Operating At 100,000 duh nuh nuhs per second](http://highscalability.com/blog/2013/11/4/espns-architecture-at-scale-operating-at-100000-duh-nuh-nuhs.html) |
| Google | [Google architecture](http://highscalability.com/google-architecture) |
| Instagram | [14 million users, terabytes of photos](http://highscalability.com/blog/2011/12/6/instagram-architecture-14-million-users-terabytes-of-photos.html)<br/>[What powers Instagram](http://instagram-engineering.tumblr.com/post/13649370142/what-powers-instagram-hundreds-of-instances) |
@ -1755,14 +1757,14 @@ Handy metrics based on numbers above:
* [Box Blogs](https://blog.box.com/blog/category/engineering)
* [Cloudera Developer Blog](http://blog.cloudera.com/)
* [Dropbox Tech Blog](https://tech.dropbox.com/)
* [Engineering at Quora](http://engineering.quora.com/)
* [Engineering at Quora](https://www.quora.com/q/quoraengineering)
* [Ebay Tech Blog](http://www.ebaytechblog.com/)
* [Evernote Tech Blog](https://blog.evernote.com/tech/)
* [Etsy Code as Craft](http://codeascraft.com/)
* [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/)
@ -1775,9 +1777,8 @@ Handy metrics based on numbers above:
* [Microsoft Engineering](https://engineering.microsoft.com/)
* [Microsoft Python Engineering](https://blogs.msdn.microsoft.com/pythonengineering/)
* [Netflix Tech Blog](http://techblog.netflix.com/)
* [Paypal Developer Blog](https://devblog.paypal.com/category/engineering/)
* [Paypal Developer Blog](https://medium.com/paypal-engineering)
* [Pinterest Engineering Blog](https://medium.com/@Pinterest_Engineering)
* [Quora Engineering](https://engineering.quora.com/)
* [Reddit Blog](http://www.redditblog.com/)
* [Salesforce Engineering Blog](https://developer.salesforce.com/blogs/engineering/)
* [Slack Engineering Blog](https://slack.engineering/)

View File

@ -34,7 +34,7 @@ generate () {
cat $name.md | generate_from_stdin $name.epub $language
}
# Check if depencies exist
# Check if dependencies exist
check_dependencies () {
for dependency in "${dependencies[@]}"
do

BIN
images/0vBc0hN.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

BIN
images/4edXG0T.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

BIN
images/4j99mhe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

BIN
images/54GYsSx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

BIN
images/5KeocQs.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

BIN
images/C9ioGtn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

BIN
images/IOyLj4i.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
images/JdAsdvG.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
images/MzExP06.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

BIN
images/ONjORqk.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

BIN
images/OfVllex.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

BIN
images/Q6z24La.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
images/TcUo2fw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 KiB

BIN
images/U3qV33e.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

BIN
images/V5q57vU.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 KiB

BIN
images/Xkm5CXz.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

BIN
images/b4YtAEN.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 KiB

BIN
images/bWxPtQA.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

BIN
images/bgLMI2u.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
images/cdCv5g7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

BIN
images/fNcl65g.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

BIN
images/h81n9iK.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
images/h9TAuGI.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
images/iF4Mkb5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

BIN
images/jj3A5N8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

BIN
images/jrUBAF7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 KiB

BIN
images/krAHLGg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

BIN
images/kxtjqgE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

BIN
images/n16iOGk.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
images/n41Azff.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
images/rgSrvjG.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

BIN
images/wU8x5Id.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

BIN
images/wXGqG5f.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
images/yB5SYwm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

BIN
images/yzDrJtA.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
images/zdCAkB3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@ -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",