Update from main

pull/502/head
Alex Voitau 2021-01-18 12:54:26 -08:00
commit 5990bdfaf6
50 changed files with 400 additions and 201 deletions

11
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,11 @@
## Review the Contributing Guidelines
Before submitting a pull request, verify it meets all requirements in the [Contributing Guidelines](https://github.com/donnemartin/system-design-primer/blob/master/CONTRIBUTING.md).
### Translations
See the [Contributing Guidelines](https://github.com/donnemartin/system-design-primer/blob/master/CONTRIBUTING.md). Verify you've:
* 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

@ -45,27 +45,33 @@ If you are not familiar with pull requests, review the [pull request docs](https
We'd like for the guide to be available in many languages. Here is the process for maintaining translations:
* This original version and content of the guide is maintained in English.
* Translations follow the content of the original. Unfortunately, contributors must speak at least some English, so that translations do not diverge.
* Each translation has a maintainer to update the translation as the original evolves and to review others' changes. This doesn't require a lot of time, but review by the maintainer is important to maintain quality.
* Translations follow the content of the original. Contributors must speak at least some English, so that translations do not diverge.
* Each translation has a maintainer to update the translation as the original evolves and to review others' changes. This doesn't require a lot of time, but a review by the maintainer is important to maintain quality.
See [Translations](TRANSLATIONS.md).
### Changes to translations
* Changes to content should be made to the English version first, and then translated to each other language.
* Changes that improve translations should be made directly on the file for that language. PRs should only modify one language at a time.
* Submit a PR with changes to the file in that language. Each language has a maintainer, who reviews changes in that language. Then the primary maintainer @donnemartin merges it in.
* Prefix PRs and issues with language codes if they are for that translation only, e.g. "es: Improve grammar", so maintainers can find them easily.
* Changes that improve translations should be made directly on the file for that language. Pull requests should only modify one language at a time.
* Submit a pull request with changes to the file in that language. Each language has a maintainer, who reviews changes in that language. Then the primary maintainer [@donnemartin](https://github.com/donnemartin) merges it in.
* Prefix pull requests and issues with language codes if they are for that translation only, e.g. "es: Improve grammar", so maintainers can find them easily.
* Tag the translation maintainer for a code review, see the list of [translation maintainers](TRANSLATIONS.md).
* You will need to get a review from a native speaker (preferably the language maintainer) before your pull request is merged.
### Adding translations to new languages
Translations to new languages are always welcome, especially if you can maintain the translation!
Translations to new languages are always welcome! Keep in mind a transation must be maintained.
* Check existing issues to see if a translation is in progress or stalled. If so, offer to help.
* If it is not in progress, file an issue for your language so people know you are working on it and we can arrange. Confirm you are native level in the language and are willing to maintain the translation, so it's not orphaned.
* To get it started, fork the repo, then submit a PR with the single file README-xx.md added, where xx is the language code. Use standard [IETF language tags](https://www.w3.org/International/articles/language-tags/), i.e. the same as is used by Wikipedia, *not* the code for a single country. These are usually just the two-letter lowercase code, for example, `fr` for French and `uk` for Ukrainian (not `ua`, which is for the country). For languages that have variations, use the shortest tag, such as `zh-Hant`.
* Invite friends to review if possible. If desired, feel free to invite friends to help your original translation by letting them fork your repo, then merging their PRs.
* Add links to your translation at the top of every README*.md file. (For consistency, the link should be added in alphabetical order by ISO code, and the anchor text should be in the native language.)
* When done, indicate on the PR that it's ready to be merged into the main repo.
* Once accepted, your PR will be squashed into a single commit into the `master` branch.
* 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.
* If a translation has not yet been started, file an issue for your language so people know you are working on it and we'll coordinate. Confirm you are native level in the language and are willing to maintain the translation, so it's not orphaned.
* To get started, fork the repo, then submit a pull request to the main repo with the single file README-xx.md added, where xx is the language code. Use standard [IETF language tags](https://www.w3.org/International/articles/language-tags/), i.e. the same as is used by Wikipedia, *not* the code for a single country. These are usually just the two-letter lowercase code, for example, `fr` for French and `uk` for Ukrainian (not `ua`, which is for the country). For languages that have variations, use the shortest tag, such as `zh-Hant`.
* Feel free to invite friends to help your original translation by having them fork your repo, then merging their pull requests to your forked repo. Translations are difficult and usually have errors that others need to find.
* Add links to your translation at the top of every README-XX.md file. For consistency, the link should be added in alphabetical order by ISO code, and the anchor text should be in the native language.
* When you've fully translated the English README.md, comment on the pull request in the main repo that it's ready to be merged.
* You'll need to have a complete and reviewed translation of the English README.md before your translation will be merged into the `master` branch.
* Once accepted, your pull request will be squashed into a single commit into the `master` branch.
### Translation template credits

View File

@ -1,9 +1,9 @@
*[English](README.md) ∙ [日本語](README-ja.md) ∙ [简体中文](README-zh-Hans.md) ∙ [繁體中文](README-zh-TW.md) | [العَرَبِيَّة‎](https://github.com/donnemartin/system-design-primer/issues/170) ∙ [বাংলা](https://github.com/donnemartin/system-design-primer/issues/220) ∙ [Português do Brasil](https://github.com/donnemartin/system-design-primer/issues/40) ∙ [Deutsch](https://github.com/donnemartin/system-design-primer/issues/186) ∙ [ελληνικά](https://github.com/donnemartin/system-design-primer/issues/130) ∙ [עברית](https://github.com/donnemartin/system-design-primer/issues/272) ∙ [Italiano](https://github.com/donnemartin/system-design-primer/issues/104) ∙ [韓國語](https://github.com/donnemartin/system-design-primer/issues/102) ∙ [فارسی](https://github.com/donnemartin/system-design-primer/issues/110) ∙ [Polski](https://github.com/donnemartin/system-design-primer/issues/68) ∙ [русский язык](https://github.com/donnemartin/system-design-primer/issues/87) ∙ [Español](https://github.com/donnemartin/system-design-primer/issues/136) ∙ [ภาษาไทย](https://github.com/donnemartin/system-design-primer/issues/187) ∙ [Türkçe](https://github.com/donnemartin/system-design-primer/issues/39) ∙ [tiếng Việt](https://github.com/donnemartin/system-design-primer/issues/127) ∙ [Français](https://github.com/donnemartin/system-design-primer/issues/250) | [Add Translation](https://github.com/donnemartin/system-design-primer/issues/28)*
*[English](README.md) ∙ [日本語](README-ja.md) ∙ [简体中文](README-zh-Hans.md) ∙ [繁體中文](README-zh-TW.md) | [العَرَبِيَّة‎](https://github.com/donnemartin/system-design-primer/issues/170) ∙ [বাংলা](https://github.com/donnemartin/system-design-primer/issues/220) ∙ [Português do Brasil](https://github.com/donnemartin/system-design-primer/issues/40) ∙ [Deutsch](https://github.com/donnemartin/system-design-primer/issues/186) ∙ [ελληνικά](https://github.com/donnemartin/system-design-primer/issues/130) ∙ [עברית](https://github.com/donnemartin/system-design-primer/issues/272) ∙ [Italiano](https://github.com/donnemartin/system-design-primer/issues/104) ∙ [한국어](https://github.com/donnemartin/system-design-primer/issues/102) ∙ [فارسی](https://github.com/donnemartin/system-design-primer/issues/110) ∙ [Polski](https://github.com/donnemartin/system-design-primer/issues/68) ∙ [русский язык](https://github.com/donnemartin/system-design-primer/issues/87) ∙ [Español](https://github.com/donnemartin/system-design-primer/issues/136) ∙ [ภาษาไทย](https://github.com/donnemartin/system-design-primer/issues/187) ∙ [Türkçe](https://github.com/donnemartin/system-design-primer/issues/39) ∙ [tiếng Việt](https://github.com/donnemartin/system-design-primer/issues/127) ∙ [Français](https://github.com/donnemartin/system-design-primer/issues/250) | [Add Translation](https://github.com/donnemartin/system-design-primer/issues/28)*
# システム設計入門
<p align="center">
<img src="http://i.imgur.com/jj3A5N8.png"/>
<img src="images/jj3A5N8.png">
<br/>
</p>
@ -44,7 +44,7 @@
## 暗記カード
<p align="center">
<img src="http://i.imgur.com/zdCAkB3.png"/>
<img src="images/zdCAkB3.png">
<br/>
</p>
@ -61,7 +61,7 @@
コード技術面接用の問題を探している場合は[**こちら**](https://github.com/donnemartin/interactive-coding-challenges)
<p align="center">
<img src="http://i.imgur.com/b4YtAEN.png"/>
<img src="images/b4YtAEN.png">
<br/>
</p>
@ -91,7 +91,7 @@
> それぞれのセクションはより学びを深めるような他の文献へのリンクが貼られています。
<p align="center">
<img src="http://i.imgur.com/jrUBAF7.png"/>
<img src="images/jrUBAF7.png">
<br/>
</p>
@ -180,7 +180,7 @@
> 学習スパンに応じてみるべきトピックス (short, medium, long)
![Imgur](http://i.imgur.com/OfVllex.png)
![Imgur](images/OfVllex.png)
**Q: 面接のためには、ここにあるものすべてをやらないといけないのでしょうか?**
@ -302,49 +302,49 @@
[問題と解答を見る](solutions/system_design/pastebin/README.md)
![Imgur](http://i.imgur.com/4edXG0T.png)
![Imgur](images/4edXG0T.png)
### Twitterタイムライン&検索 (もしくはFacebookフィード&検索)を設計する
[問題と解答を見る](solutions/system_design/twitter/README.md)
![Imgur](http://i.imgur.com/jrUBAF7.png)
![Imgur](images/jrUBAF7.png)
### ウェブクローラーの設計
[問題と解答を見る](solutions/system_design/web_crawler/README.md)
![Imgur](http://i.imgur.com/bWxPtQA.png)
![Imgur](images/bWxPtQA.png)
### Mint.comの設計
[問題と解答を見る](solutions/system_design/mint/README.md)
![Imgur](http://i.imgur.com/V5q57vU.png)
![Imgur](images/V5q57vU.png)
### SNSサービスのデータ構造を設計する
[問題と解答を見る](solutions/system_design/social_graph/README.md)
![Imgur](http://i.imgur.com/cdCv5g7.png)
![Imgur](images/cdCv5g7.png)
### 検索エンジンのキー/バリュー構造を設計する
[問題と解答を見る](solutions/system_design/query_cache/README.md)
![Imgur](http://i.imgur.com/4j99mhe.png)
![Imgur](images/4j99mhe.png)
### Amazonのカテゴリ毎の売り上げランキングを設計する
[問題と解答を見る](solutions/system_design/sales_rank/README.md)
![Imgur](http://i.imgur.com/MzExP06.png)
![Imgur](images/MzExP06.png)
### AWS上で100万人規模のユーザーを捌くサービスを設計する
[問題と解答を見る](solutions/system_design/scaling_aws/README.md)
![Imgur](http://i.imgur.com/jj3A5N8.png)
![Imgur](images/jj3A5N8.png)
## オブジェクト指向設計問題と解答
@ -436,7 +436,7 @@
### CAP 理論
<p align="center">
<img src="http://i.imgur.com/bgLMI2u.png"/>
<img src="images/bgLMI2u.png">
<br/>
<i><a href=http://robertgreiner.com/2014/08/cap-theorem-revisited>Source: CAP theorem revisited</a></i>
</p>
@ -530,7 +530,7 @@
## ドメインネームシステム
<p align="center">
<img src="http://i.imgur.com/IOyLj4i.jpg"/>
<img src="images/IOyLj4i.jpg">
<br/>
<i><a href=http://www.slideshare.net/srikrupa5/dns-security-presentation-issa>Source: DNS security presentation</a></i>
</p>
@ -568,7 +568,7 @@ DNSは少数のオーソライズされたサーバーが上位に位置する
## コンテンツデリバリーネットワーク(Content delivery network)
<p align="center">
<img src="http://i.imgur.com/h9TAuGI.jpg"/>
<img src="images/h9TAuGI.jpg">
<br/>
<i><a href=https://www.creative-artworks.eu/why-use-a-content-delivery-network-cdn/>Source: Why use a CDN</a></i>
</p>
@ -609,7 +609,7 @@ CDNを用いてコンテンツを配信することで以下の二つの理由
## ロードバランサー
<p align="center">
<img src="http://i.imgur.com/h81n9iK.png"/>
<img src="images/h81n9iK.png">
<br/>
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>Source: Scalable system design patterns</a></i>
</p>
@ -679,7 +679,7 @@ Layer 7 ロードバランサーは [アプリケーションレイヤー](#通
## リバースプロキシ(webサーバー)
<p align="center">
<img src="http://i.imgur.com/n41Azff.png"/>
<img src="images/n41Azff.png">
<br/>
<i><a href=https://upload.wikimedia.org/wikipedia/commons/6/67/Reverse_proxy_h2g2bob.svg>Source: Wikipedia</a></i>
<br/>
@ -722,7 +722,7 @@ Layer 7 ロードバランサーは [アプリケーションレイヤー](#通
## アプリケーション層
<p align="center">
<img src="http://i.imgur.com/yB5SYwm.png"/>
<img src="images/yB5SYwm.png">
<br/>
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>Source: Intro to architecting systems for scale</a></i>
</p>
@ -759,7 +759,7 @@ Layer 7 ロードバランサーは [アプリケーションレイヤー](#通
## データベース
<p align="center">
<img src="http://i.imgur.com/Xkm5CXz.png"/>
<img src="images/Xkm5CXz.png">
<br/>
<i><a href=https://www.youtube.com/watch?v=w95murBkYmU>Source: Scaling up to your first 10 million users</a></i>
</p>
@ -782,7 +782,7 @@ SQLなどのリレーショナルデータベースはテーブルに整理さ
マスターデータベースが読み取りと書き込みを処理し、書き込みを一つ以上のスレーブデータベースに複製します。スレーブデータベースは読み取りのみを処理します。スレーブデータベースは木構造のように追加のスレーブにデータを複製することもできます。マスターデータベースがオフラインになった場合には、いずれかのスレーブがマスターに昇格するか、新しいマスターデータベースが追加されるまでは読み取り専用モードで稼働します。
<p align="center">
<img src="http://i.imgur.com/C9ioGtn.png"/>
<img src="images/C9ioGtn.png">
<br/>
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
</p>
@ -797,7 +797,7 @@ SQLなどのリレーショナルデータベースはテーブルに整理さ
いずれのマスターも読み取り書き込みの両方に対応する。書き込みに関してはそれぞれ協調する。いずれかのマスターが落ちても、システム全体としては読み書き両方に対応したまま運用できる。
<p align="center">
<img src="http://i.imgur.com/krAHLGg.png"/>
<img src="images/krAHLGg.png">
<br/>
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
</p>
@ -825,7 +825,7 @@ SQLなどのリレーショナルデータベースはテーブルに整理さ
#### Federation
<p align="center">
<img src="http://i.imgur.com/U3qV33e.png"/>
<img src="images/U3qV33e.png">
<br/>
<i><a href=https://www.youtube.com/watch?v=w95murBkYmU>Source: Scaling up to your first 10 million users</a></i>
</p>
@ -846,7 +846,7 @@ SQLなどのリレーショナルデータベースはテーブルに整理さ
#### シャーディング
<p align="center">
<img src="http://i.imgur.com/wU8x5Id.png"/>
<img src="images/wU8x5Id.png">
<br/>
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
</p>
@ -990,7 +990,7 @@ NoSQL は **key-value store**、 **document-store**、 **wide column store**、
#### ワイドカラムストア
<p align="center">
<img src="http://i.imgur.com/n16iOGk.png"/>
<img src="images/n16iOGk.png">
<br/>
<i><a href=http://blog.grio.com/2015/11/sql-nosql-a-brief-history.html>Source: SQL & NoSQL, a brief history</a></i>
</p>
@ -1013,7 +1013,7 @@ Googleは[Bigtable](http://www.read.seas.harvard.edu/~kohler/class/cs239-w08/cha
#### グラフデータベース
<p align="center">
<img src="http://i.imgur.com/fNcl65g.png"/>
<img src="images/fNcl65g.png">
<br/>
<i><a href=https://en.wikipedia.org/wiki/File:GraphDatabase_PropertyGraph.png>Source: Graph database</a></i>
</p>
@ -1041,7 +1041,7 @@ Googleは[Bigtable](http://www.read.seas.harvard.edu/~kohler/class/cs239-w08/cha
### SQLかNoSQLか
<p align="center">
<img src="http://i.imgur.com/wXGqG5f.png"/>
<img src="images/wXGqG5f.png">
<br/>
<i><a href=https://www.infoq.com/articles/Transition-RDBMS-NoSQL/>Source: Transitioning from RDBMS to NoSQL</a></i>
</p>
@ -1083,7 +1083,7 @@ NoSQLに適するサンプルデータ:
## キャッシュ
<p align="center">
<img src="http://i.imgur.com/Q6z24La.png"/>
<img src="images/Q6z24La.png">
<br/>
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>Source: Scalable system design patterns</a></i>
</p>
@ -1154,7 +1154,7 @@ Redisはさらに以下のような機能を備えています:
#### キャッシュアサイド
<p align="center">
<img src="http://i.imgur.com/ONjORqk.png"/>
<img src="images/ONjORqk.png">
<br/>
<i><a href=http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast>Source: From cache to in-memory data grid</a></i>
</p>
@ -1190,7 +1190,7 @@ def get_user(self, user_id):
#### ライトスルー
<p align="center">
<img src="http://i.imgur.com/0vBc0hN.png"/>
<img src="images/0vBc0hN.png">
<br/>
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
</p>
@ -1225,7 +1225,7 @@ def set_user(user_id, values):
#### ライトビハインド (ライトバック)
<p align="center">
<img src="http://i.imgur.com/rgSrvjG.png"/>
<img src="images/rgSrvjG.png">
<br/>
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>Source: Scalability, availability, stability, patterns</a></i>
</p>
@ -1243,7 +1243,7 @@ def set_user(user_id, values):
#### リフレッシュアヘッド
<p align="center">
<img src="http://i.imgur.com/kxtjqgE.png"/>
<img src="images/kxtjqgE.png">
<br/>
<i><a href=http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast>Source: From cache to in-memory data grid</a></i>
</p>
@ -1275,7 +1275,7 @@ def set_user(user_id, values):
## 非同期処理
<p align="center">
<img src="http://i.imgur.com/54GYsSx.png"/>
<img src="images/54GYsSx.png">
<br/>
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>Source: Intro to architecting systems for scale</a></i>
</p>
@ -1321,7 +1321,7 @@ def set_user(user_id, values):
## 通信
<p align="center">
<img src="http://i.imgur.com/5KeocQs.jpg"/>
<img src="images/5KeocQs.jpg">
<br/>
<i><a href=http://www.escotal.com/osilayer.html>Source: OSI 7 layer model</a></i>
</p>
@ -1353,7 +1353,7 @@ HTTPは**TCP** や **UDP** などの低級プロトコルに依存している
### 伝送制御プロトコル (TCP)
<p align="center">
<img src="http://i.imgur.com/JdAsdvG.jpg"/>
<img src="images/JdAsdvG.jpg">
<br/>
<i><a href=http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/>Source: How to make a multiplayer game</a></i>
</p>
@ -1377,7 +1377,7 @@ TCPは高い依存性を要し、時間制約が厳しくないものに適し
### ユーザデータグラムプロトコル (UDP)
<p align="center">
<img src="http://i.imgur.com/yzDrJtA.jpg"/>
<img src="images/yzDrJtA.jpg">
<br/>
<i><a href=http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/>Source: How to make a multiplayer game</a></i>
</p>
@ -1406,7 +1406,7 @@ TCPよりもUDPを使うのは:
### 遠隔手続呼出 (RPC)
<p align="center">
<img src="http://i.imgur.com/iF4Mkb5.png"/>
<img src="images/iF4Mkb5.png">
<br/>
<i><a href=http://www.puncsky.com/blog/2016-02-13-crack-the-system-design-interview>Source: Crack the system design interview</a></i>
</p>
@ -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>

View File

@ -3,12 +3,12 @@
> * 译者:[XatMassacrE](https://github.com/XatMassacrE)、[L9m](https://github.com/L9m)、[Airmacho](https://github.com/Airmacho)、[xiaoyusilen](https://github.com/xiaoyusilen)、[jifaxu](https://github.com/jifaxu)、[根号三](https://github.com/sqrthree)
> * 这个 [链接](https://github.com/xitu/system-design-primer/compare/master...donnemartin:master) 用来查看本翻译与英文版是否有差别(如果你没有看到 README.md 发生变化,那就意味着这份翻译文档是最新的)。
*[English](README.md) ∙ [日本語](README-ja.md) ∙ [简体中文](README-zh-Hans.md) ∙ [繁體中文](README-zh-TW.md) | [العَرَبِيَّة‎](https://github.com/donnemartin/system-design-primer/issues/170) ∙ [বাংলা](https://github.com/donnemartin/system-design-primer/issues/220) ∙ [Português do Brasil](https://github.com/donnemartin/system-design-primer/issues/40) ∙ [Deutsch](https://github.com/donnemartin/system-design-primer/issues/186) ∙ [ελληνικά](https://github.com/donnemartin/system-design-primer/issues/130) ∙ [עברית](https://github.com/donnemartin/system-design-primer/issues/272) ∙ [Italiano](https://github.com/donnemartin/system-design-primer/issues/104) ∙ [韓國語](https://github.com/donnemartin/system-design-primer/issues/102) ∙ [فارسی](https://github.com/donnemartin/system-design-primer/issues/110) ∙ [Polski](https://github.com/donnemartin/system-design-primer/issues/68) ∙ [русский язык](https://github.com/donnemartin/system-design-primer/issues/87) ∙ [Español](https://github.com/donnemartin/system-design-primer/issues/136) ∙ [ภาษาไทย](https://github.com/donnemartin/system-design-primer/issues/187) ∙ [Türkçe](https://github.com/donnemartin/system-design-primer/issues/39) ∙ [tiếng Việt](https://github.com/donnemartin/system-design-primer/issues/127) ∙ [Français](https://github.com/donnemartin/system-design-primer/issues/250) | [Add Translation](https://github.com/donnemartin/system-design-primer/issues/28)*
*[English](README.md) ∙ [日本語](README-ja.md) ∙ [简体中文](README-zh-Hans.md) ∙ [繁體中文](README-zh-TW.md) | [العَرَبِيَّة‎](https://github.com/donnemartin/system-design-primer/issues/170) ∙ [বাংলা](https://github.com/donnemartin/system-design-primer/issues/220) ∙ [Português do Brasil](https://github.com/donnemartin/system-design-primer/issues/40) ∙ [Deutsch](https://github.com/donnemartin/system-design-primer/issues/186) ∙ [ελληνικά](https://github.com/donnemartin/system-design-primer/issues/130) ∙ [עברית](https://github.com/donnemartin/system-design-primer/issues/272) ∙ [Italiano](https://github.com/donnemartin/system-design-primer/issues/104) ∙ [한국어](https://github.com/donnemartin/system-design-primer/issues/102) ∙ [فارسی](https://github.com/donnemartin/system-design-primer/issues/110) ∙ [Polski](https://github.com/donnemartin/system-design-primer/issues/68) ∙ [русский язык](https://github.com/donnemartin/system-design-primer/issues/87) ∙ [Español](https://github.com/donnemartin/system-design-primer/issues/136) ∙ [ภาษาไทย](https://github.com/donnemartin/system-design-primer/issues/187) ∙ [Türkçe](https://github.com/donnemartin/system-design-primer/issues/39) ∙ [tiếng Việt](https://github.com/donnemartin/system-design-primer/issues/127) ∙ [Français](https://github.com/donnemartin/system-design-primer/issues/250) | [Add Translation](https://github.com/donnemartin/system-design-primer/issues/28)*
# 系统设计入门
<p align="center">
<img src="http://i.imgur.com/jj3A5N8.png"/>
<img src="images/jj3A5N8.png">
<br/>
</p>
@ -49,7 +49,7 @@
## 抽认卡
<p align="center">
<img src="http://i.imgur.com/zdCAkB3.png"/>
<img src="images/zdCAkB3.png">
<br/>
</p>
@ -66,7 +66,7 @@
你正在寻找资源以准备[**编程面试**](https://github.com/donnemartin/interactive-coding-challenges)吗?
<p align="center">
<img src="http://i.imgur.com/b4YtAEN.png"/>
<img src="images/b4YtAEN.png">
<br/>
</p>
@ -97,7 +97,7 @@
<p align="center">
<img src="http://i.imgur.com/jrUBAF7.png"/>
<img src="images/jrUBAF7.png">
<br/>
</p>
@ -186,7 +186,7 @@
> 基于你面试的时间线(短、中、长)去复习那些推荐的主题。
![Imgur](http://i.imgur.com/OfVllex.png)
![Imgur](images/OfVllex.png)
**问:对于面试来说,我需要知道这里的所有知识点吗?**
@ -307,49 +307,49 @@
[查看实践与解答](solutions/system_design/pastebin/README.md)
![Imgur](http://i.imgur.com/4edXG0T.png)
![Imgur](images/4edXG0T.png)
### 设计 Twitter 时间线和搜索 (或者 Facebook feed 和搜索)
[查看实践与解答](solutions/system_design/twitter/README.md)
![Imgur](http://i.imgur.com/jrUBAF7.png)
![Imgur](images/jrUBAF7.png)
### 设计一个网页爬虫
[查看实践与解答](solutions/system_design/web_crawler/README.md)
![Imgur](http://i.imgur.com/bWxPtQA.png)
![Imgur](images/bWxPtQA.png)
### 设计 Mint.com
[查看实践与解答](solutions/system_design/mint/README.md)
![Imgur](http://i.imgur.com/V5q57vU.png)
![Imgur](images/V5q57vU.png)
### 为一个社交网络设计数据结构
[查看实践与解答](solutions/system_design/social_graph/README.md)
![Imgur](http://i.imgur.com/cdCv5g7.png)
![Imgur](images/cdCv5g7.png)
### 为搜索引擎设计一个 key-value 储存
[查看实践与解答](solutions/system_design/query_cache/README.md)
![Imgur](http://i.imgur.com/4j99mhe.png)
![Imgur](images/4j99mhe.png)
### 设计按类别分类的 Amazon 销售排名
[查看实践与解答](solutions/system_design/sales_rank/README.md)
![Imgur](http://i.imgur.com/MzExP06.png)
![Imgur](images/MzExP06.png)
### 在 AWS 上设计一个百万用户级别的系统
[查看实践与解答](solutions/system_design/scaling_aws/README.md)
![Imgur](http://i.imgur.com/jj3A5N8.png)
![Imgur](images/jj3A5N8.png)
## 面向对象设计的面试问题及解答
@ -441,7 +441,7 @@
### CAP 理论
<p align="center">
<img src="http://i.imgur.com/bgLMI2u.png"/>
<img src="images/bgLMI2u.png">
<br/>
<strong><a href="http://robertgreiner.com/2014/08/cap-theorem-revisited">来源:再看 CAP 理论</a></strong>
</p>
@ -536,7 +536,7 @@ DNS 和 email 等系统使用的是此种方式。最终一致性在高可用性
## 域名系统
<p align="center">
<img src="http://i.imgur.com/IOyLj4i.jpg"/>
<img src="images/IOyLj4i.jpg">
<br/>
<strong><a href="http://www.slideshare.net/srikrupa5/dns-security-presentation-issa">来源DNS 安全介绍</a></strong>
</p>
@ -574,7 +574,7 @@ DNS 和 email 等系统使用的是此种方式。最终一致性在高可用性
## 内容分发网络CDN
<p align="center">
<img src="http://i.imgur.com/h9TAuGI.jpg"/>
<img src="images/h9TAuGI.jpg">
<br/>
<strong><a href="https://www.creative-artworks.eu/why-use-a-content-delivery-network-cdn/">来源:为什么使用 CDN</a></strong>
</p>
@ -613,7 +613,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
## 负载均衡器
<p align="center">
<img src="http://i.imgur.com/h81n9iK.png"/>
<img src="images/h81n9iK.png">
<br/>
<strong><a href="http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html">来源:可扩展的系统设计模式</a></strong>
</p>
@ -682,7 +682,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
## 反向代理web 服务器)
<p align="center">
<img src="http://i.imgur.com/n41Azff.png"/>
<img src="images/n41Azff.png">
<br/>
<strong><a href="https://upload.wikimedia.org/wikipedia/commons/6/67/Reverse_proxy_h2g2bob.svg">资料来源:维基百科</a></strong>
<br/>
@ -726,7 +726,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
## 应用层
<p align="center">
<img src="http://i.imgur.com/yB5SYwm.png"/>
<img src="images/yB5SYwm.png">
<br/>
<strong><a href="http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer">资料来源:可缩放系统构架介绍</a></strong>
</p>
@ -764,7 +764,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
## 数据库
<p align="center">
<img src="http://i.imgur.com/Xkm5CXz.png"/>
<img src="images/Xkm5CXz.png">
<br/>
<strong><a href="https://www.youtube.com/watch?v=w95murBkYmU">资料来源:扩展你的用户数到第一个一千万</a></strong>
</p>
@ -785,7 +785,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
关系型数据库扩展包括许多技术:**主从复制**、**主主复制**、**联合**、**分片**、**非规范化**和 **SQL调优**
<p align="center">
<img src="http://i.imgur.com/C9ioGtn.png"/>
<img src="images/C9ioGtn.png">
<br/>
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
</p>
@ -800,7 +800,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
- 参考[不利之处:复制](#不利之处复制)中,主从复制和主主复制**共同**的问题。
<p align="center">
<img src="http://i.imgur.com/krAHLGg.png"/>
<img src="images/krAHLGg.png">
<br/>
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
</p>
@ -835,7 +835,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
#### 联合
<p align="center">
<img src="http://i.imgur.com/U3qV33e.png"/>
<img src="images/U3qV33e.png">
<br/>
<strong><a href="https://www.youtube.com/watch?v=w95murBkYmU">资料来源:扩展你的用户数到第一个一千万</a></strong>
</p>
@ -857,7 +857,7 @@ CDN 拉取是当第一个用户请求该资源时,从服务器上拉取资源
#### 分片
<p align="center">
<img src="http://i.imgur.com/wU8x5Id.png"/>
<img src="images/wU8x5Id.png">
<br/>
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
</p>
@ -1001,7 +1001,7 @@ MongoDB 和 CouchDB 等一些文档类型存储还提供了类似 SQL 语言的
#### 列型存储
<p align="center">
<img src="http://i.imgur.com/n16iOGk.png"/>
<img src="images/n16iOGk.png">
<br/>
<strong><a href="http://blog.grio.com/2015/11/sql-nosql-a-brief-history.html">资料来源: SQL 和 NoSQL一个简短的历史</a></strong>
</p>
@ -1024,7 +1024,7 @@ Google 发布了第一个列型存储数据库 [Bigtable](http://www.read.seas.h
#### 图数据库
<p align="center">
<img src="http://i.imgur.com/fNcl65g.png"/>
<img src="images/fNcl65g.png">
<br/>
<strong><a href="https://en.wikipedia.org/wiki/File:GraphDatabase_PropertyGraph.png"/>资料来源:图数据库</a></strong>
</p>
@ -1051,7 +1051,7 @@ Google 发布了第一个列型存储数据库 [Bigtable](http://www.read.seas.h
### SQL 还是 NoSQL
<p align="center">
<img src="http://i.imgur.com/wXGqG5f.png"/>
<img src="images/wXGqG5f.png">
<br/>
<strong><a href="https://www.infoq.com/articles/Transition-RDBMS-NoSQL/">资料来源:从 RDBMS 转换到 NoSQL</a></strong>
</p>
@ -1092,7 +1092,7 @@ Google 发布了第一个列型存储数据库 [Bigtable](http://www.read.seas.h
## 缓存
<p align="center">
<img src="http://i.imgur.com/Q6z24La.png"/>
<img src="images/Q6z24La.png">
<br/>
<strong><a href="http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html">资料来源:可扩展的系统设计模式</a></strong>
</p>
@ -1163,7 +1163,7 @@ Redis 有下列附加功能:
#### 缓存模式
<p align="center">
<img src="http://i.imgur.com/ONjORqk.png"/>
<img src="images/ONjORqk.png">
<br/>
<strong><a href="http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast">资料来源:从缓存到内存数据网格</a></strong>
</p>
@ -1199,7 +1199,7 @@ def get_user(self, user_id):
#### 直写模式
<p align="center">
<img src="http://i.imgur.com/0vBc0hN.png"/>
<img src="images/0vBc0hN.png">
<br/>
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
</p>
@ -1234,7 +1234,7 @@ def set_user(user_id, values):
#### 回写模式
<p align="center">
<img src="http://i.imgur.com/rgSrvjG.png"/>
<img src="images/rgSrvjG.png">
<br/>
<strong><a href="http://www.slideshare.net/jboner/scalability-availability-stability-patterns/">资料来源:可扩展性、可用性、稳定性、模式</a></strong>
</p>
@ -1252,7 +1252,7 @@ def set_user(user_id, values):
#### 刷新
<p align="center">
<img src="http://i.imgur.com/kxtjqgE.png"/>
<img src="images/kxtjqgE.png">
<br/>
<strong><a href=http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast>资料来源:从缓存到内存数据网格</a></strong>
</p>
@ -1284,7 +1284,7 @@ def set_user(user_id, values):
## 异步
<p align="center">
<img src="http://i.imgur.com/54GYsSx.png"/>
<img src="images/54GYsSx.png">
<br/>
<strong><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>资料来源:可缩放系统构架介绍</a></strong>
</p>
@ -1330,7 +1330,7 @@ def set_user(user_id, values):
## 通讯
<p align="center">
<img src="http://i.imgur.com/5KeocQs.jpg"/>
<img src="images/5KeocQs.jpg">
<br/>
<strong><a href=http://www.escotal.com/osilayer.html>资料来源OSI 7层模型</a></strong>
</p>
@ -1365,7 +1365,7 @@ HTTP 是依赖于较低级协议(如 **TCP** 和 **UDP**)的应用层协议
### 传输控制协议TCP
<p align="center">
<img src="http://i.imgur.com/JdAsdvG.jpg"/>
<img src="images/JdAsdvG.jpg">
<br/>
<strong><a href="http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/">资料来源:如何制作多人游戏</a></strong>
</p>
@ -1389,7 +1389,7 @@ TCP 对于需要高可靠性但时间紧迫的应用程序很有用。比如包
### 用户数据报协议UDP
<p align="center">
<img src="http://i.imgur.com/yzDrJtA.jpg"/>
<img src="images/yzDrJtA.jpg">
<br/>
<strong><a href="http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1">资料来源:如何制作多人游戏</a></strong>
</p>
@ -1418,7 +1418,7 @@ UDP 可靠性更低但适合用在网络电话、视频聊天,流媒体和实
### 远程过程调用协议RPC
<p align="center">
<img src="http://i.imgur.com/iF4Mkb5.png"/>
<img src="images/iF4Mkb5.png">
<br/>
<strong><a href="http://www.puncsky.com/blog/2016/02/14/crack-the-system-design-interview">Source: Crack the system design interview</a></strong>
</p>
@ -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>

View File

@ -1,9 +1,9 @@
*[English](README.md) ∙ [日本語](README-ja.md) ∙ [简体中文](README-zh-Hans.md) ∙ [繁體中文](README-zh-TW.md) | [العَرَبِيَّة‎](https://github.com/donnemartin/system-design-primer/issues/170) ∙ [বাংলা](https://github.com/donnemartin/system-design-primer/issues/220) ∙ [Português do Brasil](https://github.com/donnemartin/system-design-primer/issues/40) ∙ [Deutsch](https://github.com/donnemartin/system-design-primer/issues/186) ∙ [ελληνικά](https://github.com/donnemartin/system-design-primer/issues/130) ∙ [עברית](https://github.com/donnemartin/system-design-primer/issues/272) ∙ [Italiano](https://github.com/donnemartin/system-design-primer/issues/104) ∙ [韓國語](https://github.com/donnemartin/system-design-primer/issues/102) ∙ [فارسی](https://github.com/donnemartin/system-design-primer/issues/110) ∙ [Polski](https://github.com/donnemartin/system-design-primer/issues/68) ∙ [русский язык](https://github.com/donnemartin/system-design-primer/issues/87) ∙ [Español](https://github.com/donnemartin/system-design-primer/issues/136) ∙ [ภาษาไทย](https://github.com/donnemartin/system-design-primer/issues/187) ∙ [Türkçe](https://github.com/donnemartin/system-design-primer/issues/39) ∙ [tiếng Việt](https://github.com/donnemartin/system-design-primer/issues/127) ∙ [Français](https://github.com/donnemartin/system-design-primer/issues/250) | [Add Translation](https://github.com/donnemartin/system-design-primer/issues/28)*
*[English](README.md) ∙ [日本語](README-ja.md) ∙ [简体中文](README-zh-Hans.md) ∙ [繁體中文](README-zh-TW.md) | [العَرَبِيَّة‎](https://github.com/donnemartin/system-design-primer/issues/170) ∙ [বাংলা](https://github.com/donnemartin/system-design-primer/issues/220) ∙ [Português do Brasil](https://github.com/donnemartin/system-design-primer/issues/40) ∙ [Deutsch](https://github.com/donnemartin/system-design-primer/issues/186) ∙ [ελληνικά](https://github.com/donnemartin/system-design-primer/issues/130) ∙ [עברית](https://github.com/donnemartin/system-design-primer/issues/272) ∙ [Italiano](https://github.com/donnemartin/system-design-primer/issues/104) ∙ [한국어](https://github.com/donnemartin/system-design-primer/issues/102) ∙ [فارسی](https://github.com/donnemartin/system-design-primer/issues/110) ∙ [Polski](https://github.com/donnemartin/system-design-primer/issues/68) ∙ [русский язык](https://github.com/donnemartin/system-design-primer/issues/87) ∙ [Español](https://github.com/donnemartin/system-design-primer/issues/136) ∙ [ภาษาไทย](https://github.com/donnemartin/system-design-primer/issues/187) ∙ [Türkçe](https://github.com/donnemartin/system-design-primer/issues/39) ∙ [tiếng Việt](https://github.com/donnemartin/system-design-primer/issues/127) ∙ [Français](https://github.com/donnemartin/system-design-primer/issues/250) | [Add Translation](https://github.com/donnemartin/system-design-primer/issues/28)*
# 系統設計入門
<p align="center">
<img src="http://i.imgur.com/jj3A5N8.png"/>
<img src="images/jj3A5N8.png">
<br/>
</p>
@ -44,7 +44,7 @@
## 學習單字卡
<p align="center">
<img src="http://i.imgur.com/zdCAkB3.png"/>
<img src="images/zdCAkB3.png">
<br/>
</p>
@ -61,7 +61,7 @@
你正在尋找資源來面對[**程式語言面試**](https://github.com/donnemartin/interactive-coding-challenges)嗎?
<p align="center">
<img src="http://i.imgur.com/b4YtAEN.png"/>
<img src="images/b4YtAEN.png">
<br/>
</p>
@ -91,7 +91,7 @@
> 每一章節都包含更深入資源的連結。
<p align="center">
<img src="http://i.imgur.com/jrUBAF7.png"/>
<img src="images/jrUBAF7.png">
<br/>
</p>
@ -180,7 +180,7 @@
> 基於你面試的時間 (短、中、長) 來複習這些建議的主題。
![Imgur](http://i.imgur.com/OfVllex.png)
![Imgur](images/OfVllex.png)
**Q: 對於面試者來說,我需要知道這裡所有的知識嗎?**
@ -302,49 +302,49 @@
[閱讀練習與解答](solutions/system_design/pastebin/README.md)
![Imgur](http://i.imgur.com/4edXG0T.png)
![Imgur](images/4edXG0T.png)
### 設計一個像是 Twitter 的 timeline (或 Facebook feed)設計一個 Twitter 搜尋功能 (or Facebook 搜尋功能)
[閱讀練習與解答](solutions/system_design/twitter/README.md)
![Imgur](http://i.imgur.com/jrUBAF7.png)
![Imgur](images/jrUBAF7.png)
### 設計一個爬蟲系統
[閱讀練習與解答](solutions/system_design/web_crawler/README.md)
![Imgur](http://i.imgur.com/bWxPtQA.png)
![Imgur](images/bWxPtQA.png)
### 設計 Mint.com 網站
[閱讀練習與解答](solutions/system_design/mint/README.md)
![Imgur](http://i.imgur.com/V5q57vU.png)
![Imgur](images/V5q57vU.png)
### 設計一個社交網站的資料結構
[閱讀練習與解答](solutions/system_design/social_graph/README.md)
![Imgur](http://i.imgur.com/cdCv5g7.png)
![Imgur](images/cdCv5g7.png)
### 設計一個搜尋引擎使用的鍵值儲存資料結構
[閱讀練習與解答](solutions/system_design/query_cache/README.md)
![Imgur](http://i.imgur.com/4j99mhe.png)
![Imgur](images/4j99mhe.png)
### 設計一個根據產品分類的亞馬遜銷售排名
[閱讀練習與解答](solutions/system_design/sales_rank/README.md)
![Imgur](http://i.imgur.com/MzExP06.png)
![Imgur](images/MzExP06.png)
### 在 AWS 上設計一個百萬用戶等級的系統
[閱讀練習與解答](solutions/system_design/scaling_aws/README.md)
![Imgur](http://i.imgur.com/jj3A5N8.png)
![Imgur](images/jj3A5N8.png)
## 物件導向設計面試問題與解答
@ -435,7 +435,7 @@
### CAP 理論
<p align="center">
<img src="http://i.imgur.com/bgLMI2u.png"/>
<img src="images/bgLMI2u.png">
<br/>
<i><a href=http://robertgreiner.com/2014/08/cap-theorem-revisited>來源:再看 CAP 理論</a></i>
</p>
@ -529,7 +529,7 @@ DNS 或是電子郵件系統使用的就是這種方式,最終一致性在高
## 域名系統
<p align="center">
<img src="http://i.imgur.com/IOyLj4i.jpg"/>
<img src="images/IOyLj4i.jpg">
<br/>
<i><a href=http://www.slideshare.net/srikrupa5/dns-security-presentation-issa>資料來源DNS 安全介紹</a></i>
</p>
@ -567,7 +567,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
## 內容傳遞網路(CDN)
<p align="center">
<img src="http://i.imgur.com/h9TAuGI.jpg"/>
<img src="images/h9TAuGI.jpg">
<br/>
<i><a href=https://www.creative-artworks.eu/why-use-a-content-delivery-network-cdn/>來源:為什麼要使用 CDN</a></i>
</p>
@ -608,7 +608,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
## 負載平衡器
<p align="center">
<img src="http://i.imgur.com/h81n9iK.png"/>
<img src="images/h81n9iK.png">
<br/>
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>來源:可擴展的系統設計模式</a></i>
</p>
@ -678,7 +678,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
## 反向代理(網頁伺服器)
<p align="center">
<img src="http://i.imgur.com/n41Azff.png"/>
<img src="images/n41Azff.png">
<br/>
<i><a href=https://upload.wikimedia.org/wikipedia/commons/6/67/Reverse_proxy_h2g2bob.svg>來源:維基百科</a></i>
<br/>
@ -721,7 +721,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
## 應用層
<p align="center">
<img src="http://i.imgur.com/yB5SYwm.png"/>
<img src="images/yB5SYwm.png">
<br/>
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>資料來源:可縮放式系統架構介紹</a></i>
</p>
@ -758,7 +758,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
## 資料庫
<p align="center">
<img src="http://i.imgur.com/Xkm5CXz.png"/>
<img src="images/Xkm5CXz.png">
<br/>
<i><a href=https://www.youtube.com/watch?v=vg5onp8TU6Q>來源:擴展你的使用者數量到第一個一千萬量級</a></i>
</p>
@ -781,7 +781,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
主資料庫負責讀和寫,並且將寫入的資料複寫至一或多個從屬資料庫中,從屬資料庫只負責讀取。而從屬資料庫可以再將寫入複製到更多以樹狀結構的其他資料庫中。如果主資料庫離線了,系統可以以只讀模式運行,直到某個從屬資料庫被提升為主資料庫,或有新的主資料庫出現。
<p align="center">
<img src="http://i.imgur.com/C9ioGtn.png"/>
<img src="images/C9ioGtn.png">
<br/>
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>來源: 可擴展性、可用性、穩定性及其模式</a></i>
</p>
@ -796,7 +796,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
兩個主要的資料庫都負責讀取和寫入,並且兩者互相協調。如果其中一個主要資料庫離線,系統可以繼續運作。
<p align="center">
<img src="http://i.imgur.com/krAHLGg.png"/>
<img src="images/krAHLGg.png">
<br/>
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>來源: 可擴展性、可用性、穩定性及其模式</a></i>
</p>
@ -824,7 +824,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
#### 聯邦式資料庫
<p align="center">
<img src="http://i.imgur.com/U3qV33e.png"/>
<img src="images/U3qV33e.png">
<br/>
<i><a href=https://www.youtube.com/watch?v=vg5onp8TU6Q>來源:擴展你的使用者數量到第一個一千萬量級</a></i>
</p>
@ -845,7 +845,7 @@ DNS 是階層式的架構,一部分的 DNS 伺服器位於頂層,當查詢
#### 分片
<p align="center">
<img src="http://i.imgur.com/wU8x5Id.png"/>
<img src="images/wU8x5Id.png">
<br/>
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>來源: 可擴展性、可用性、穩定性及其模式</a></i>
</p>
@ -991,7 +991,7 @@ NoSQL 指的是 **鍵-值對的資料庫**、**文件類型資料庫**、**列
#### 列儲存型資料庫
<p align="center">
<img src="http://i.imgur.com/n16iOGk.png"/>
<img src="images/n16iOGk.png">
<br/>
<i><a href=http://blog.grio.com/2015/11/sql-nosql-a-brief-history.html>來源SQL 和 NoSQL簡短的歷史介紹</a></i>
</p>
@ -1014,7 +1014,7 @@ Google 發表了第一個列儲存型資料庫 [Bigtable](http://www.read.seas.h
#### 圖形資料庫
<p align="center">
<img src="http://i.imgur.com/fNcl65g.png"/>
<img src="images/fNcl65g.png">
<br/>
<i><a href=https://en.wikipedia.org/wiki/File:GraphDatabase_PropertyGraph.png>來源: 圖形化資料庫</a></i>
</p>
@ -1042,7 +1042,7 @@ Google 發表了第一個列儲存型資料庫 [Bigtable](http://www.read.seas.h
### SQL 或 NoSQL
<p align="center">
<img src="http://i.imgur.com/wXGqG5f.png"/>
<img src="images/wXGqG5f.png">
<br/>
<i><a href=https://www.infoq.com/articles/Transition-RDBMS-NoSQL/>來源:從 RDBMS 轉換到 NoSQL</a></i>
</p>
@ -1084,7 +1084,7 @@ Google 發表了第一個列儲存型資料庫 [Bigtable](http://www.read.seas.h
## 快取
<p align="center">
<img src="http://i.imgur.com/Q6z24La.png"/>
<img src="images/Q6z24La.png">
<br/>
<i><a href=http://horicky.blogspot.com/2010/10/scalable-system-design-patterns.html>來源:可擴展的系統設計模式</a></i>
</p>
@ -1155,7 +1155,7 @@ Redis 還有以下額外的功能:
#### 快取模式
<p align="center">
<img src="http://i.imgur.com/ONjORqk.png"/>
<img src="images/ONjORqk.png">
<br/>
<i><a href=http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast>資料來源:從快取到記憶體資料網格</a></i>
</p>
@ -1191,7 +1191,7 @@ def get_user(self, user_id):
#### 寫入模式
<p align="center">
<img src="http://i.imgur.com/0vBc0hN.png"/>
<img src="images/0vBc0hN.png">
<br/>
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>資料來源:可獲展性、可用性、穩定性與模式</a></i>
</p>
@ -1226,7 +1226,7 @@ def set_user(user_id, values):
#### 事後寫入(回寫)
<p align="center">
<img src="http://i.imgur.com/rgSrvjG.png"/>
<img src="images/rgSrvjG.png">
<br/>
<i><a href=http://www.slideshare.net/jboner/scalability-availability-stability-patterns/>資料來源:可獲展性、可用性、穩定性與模式</a></i>
</p>
@ -1244,7 +1244,7 @@ def set_user(user_id, values):
#### 更新式快取
<p align="center">
<img src="http://i.imgur.com/kxtjqgE.png"/>
<img src="images/kxtjqgE.png">
<br/>
<i><a href=http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast>來源:從快取到記憶體資料網格技術</a></i>
</p>
@ -1276,7 +1276,7 @@ def set_user(user_id, values):
## 非同步機制
<p align="center">
<img src="http://i.imgur.com/54GYsSx.png"/>
<img src="images/54GYsSx.png">
<br/>
<i><a href=http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer>資料來源:可縮放性系統架構介紹</a></i>
</p>
@ -1322,7 +1322,7 @@ def set_user(user_id, values):
## 通訊
<p align="center">
<img src="http://i.imgur.com/5KeocQs.jpg"/>
<img src="images/5KeocQs.jpg">
<br/>
<i><a href=http://www.escotal.com/osilayer.html>來源OSI 七層模型</a></i>
</p>
@ -1354,7 +1354,7 @@ HTTP 是依賴於較底層的協議(例如:**TCP** 和 **UDP**) 的應用層
### 傳輸控制通訊協定(TCP)
<p align="center">
<img src="http://i.imgur.com/JdAsdvG.jpg"/>
<img src="images/JdAsdvG.jpg">
<br/>
<i><a href=http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/>來源:如何開發多人遊戲</a></i>
</p>
@ -1378,7 +1378,7 @@ TCP 對於需要高可靠、低時間急迫性的應用來說很有用,比如
### 使用者資料流通訊協定 (UDP)
<p align="center">
<img src="http://i.imgur.com/yzDrJtA.jpg"/>
<img src="images/yzDrJtA.jpg">
<br/>
<i><a href=http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/>資料來源:如何製作多人遊戲</a></i>
</p>
@ -1407,7 +1407,7 @@ UDP 的可靠性較低,但適合用在像是網路電話、視訊聊天、串
### 遠端程式呼叫 (RPC)
<p align="center">
<img src="http://i.imgur.com/iF4Mkb5.png"/>
<img src="images/iF4Mkb5.png">
<br/>
<i><a href=http://www.puncsky.com/blog/2016-02-13-crack-the-system-design-interview>資料來源:破解系統設計面試</a></i>
</p>
@ -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>

116
README.md
View File

@ -1,9 +1,11 @@
*[English](README.md) ∙ [日本語](README-ja.md) ∙ [简体中文](README-zh-Hans.md) ∙ [繁體中文](README-zh-TW.md) ∙ [Русский](README-ru.md) | [العَرَبِيَّة‎](https://github.com/donnemartin/system-design-primer/issues/170) ∙ [বাংলা](https://github.com/donnemartin/system-design-primer/issues/220) ∙ [Português do Brasil](https://github.com/donnemartin/system-design-primer/issues/40) ∙ [Deutsch](https://github.com/donnemartin/system-design-primer/issues/186) ∙ [ελληνικά](https://github.com/donnemartin/system-design-primer/issues/130) ∙ [עברית](https://github.com/donnemartin/system-design-primer/issues/272) ∙ [Italiano](https://github.com/donnemartin/system-design-primer/issues/104) ∙ [韓國語](https://github.com/donnemartin/system-design-primer/issues/102) ∙ [فارسی](https://github.com/donnemartin/system-design-primer/issues/110) ∙ [Polski](https://github.com/donnemartin/system-design-primer/issues/68) ∙ [Español](https://github.com/donnemartin/system-design-primer/issues/136) ∙ [ภาษาไทย](https://github.com/donnemartin/system-design-primer/issues/187) ∙ [Türkçe](https://github.com/donnemartin/system-design-primer/issues/39) ∙ [tiếng Việt](https://github.com/donnemartin/system-design-primer/issues/127) ∙ [Français](https://github.com/donnemartin/system-design-primer/issues/250) | [Add Translation](https://github.com/donnemartin/system-design-primer/issues/28)* <!-- l10n:select -->
*[English](README.md) ∙ [日本語](README-ja.md) ∙ [简体中文](README-zh-Hans.md) ∙ [繁體中文](README-zh-TW.md) ∙ [Русский](README-ru.md) | [العَرَبِيَّة‎](https://github.com/donnemartin/system-design-primer/issues/170) ∙ [বাংলা](https://github.com/donnemartin/system-design-primer/issues/220) ∙ [Português do Brasil](https://github.com/donnemartin/system-design-primer/issues/40) ∙ [Deutsch](https://github.com/donnemartin/system-design-primer/issues/186) ∙ [ελληνικά](https://github.com/donnemartin/system-design-primer/issues/130) ∙ [עברית](https://github.com/donnemartin/system-design-primer/issues/272) ∙ [Italiano](https://github.com/donnemartin/system-design-primer/issues/104) ∙ [한국어](https://github.com/donnemartin/system-design-primer/issues/102) ∙ [فارسی](https://github.com/donnemartin/system-design-primer/issues/110) ∙ [Polski](https://github.com/donnemartin/system-design-primer/issues/68) ∙ [Español](https://github.com/donnemartin/system-design-primer/issues/136) ∙ [ภาษาไทย](https://github.com/donnemartin/system-design-primer/issues/187) ∙ [Türkçe](https://github.com/donnemartin/system-design-primer/issues/39) ∙ [tiếng Việt](https://github.com/donnemartin/system-design-primer/issues/127) ∙ [Français](https://github.com/donnemartin/system-design-primer/issues/250) | [Add Translation](https://github.com/donnemartin/system-design-primer/issues/28)* <!-- l10n:select -->
**Help [translate](TRANSLATIONS.md) this guide!**
# The System Design Primer
<p align="center">
<img src="http://i.imgur.com/jj3A5N8.png"/>
<img src="images/jj3A5N8.png">
<br/>
</p>
@ -44,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>
@ -61,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>
@ -91,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>
@ -181,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?**
@ -280,6 +282,7 @@ Check out the following links to get a better idea of what to expect:
* [How to ace a systems design interview](https://www.palantir.com/2011/10/how-to-rock-a-systems-design-interview/)
* [The system design interview](http://www.hiredintech.com/system-design)
* [Intro to Architecture and Systems Design Interviews](https://www.youtube.com/watch?v=ZgdS0EUmn70)
* [System design template](https://leetcode.com/discuss/career/229177/My-System-Design-Template)
## System design interview questions with solutions
@ -303,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
@ -437,7 +440,7 @@ Generally, you should aim for **maximal throughput** with **acceptable latency**
### CAP theorem
<p align="center">
<img src="http://i.imgur.com/bgLMI2u.png"/>
<img src="images/bgLMI2u.png">
<br/>
<i><a href=http://robertgreiner.com/2014/08/cap-theorem-revisited>Source: CAP theorem revisited</a></i>
</p>
@ -456,7 +459,7 @@ Waiting for a response from the partitioned node might result in a timeout error
#### AP - availability and partition tolerance
Responses return the most recent version of the data available on a node, which might not be the latest. Writes might take some time to propagate when the partition is resolved.
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.
@ -465,6 +468,7 @@ AP is a good choice if the business needs allow for [eventual consistency](#even
* [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
@ -494,7 +498,7 @@ This approach is seen in file systems and RDBMSes. Strong consistency works wel
## Availability patterns
There are two main patterns to support high availability: **fail-over** and **replication**.
There are two complementary patterns to support high availability: **fail-over** and **replication**.
### Fail-over
@ -577,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>
@ -597,8 +601,8 @@ Services such as [CloudFlare](https://www.cloudflare.com/dns/) and [Route 53](ht
* 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
@ -615,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>
@ -624,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
@ -656,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>
@ -665,7 +669,7 @@ Load balancers distribute incoming client requests to computing resources such a
* Preventing requests from going to unhealthy servers
* Preventing overloading resources
* Helping eliminate single points of failure
* Helping to eliminate a single point of failure
Load balancers can be implemented with hardware (expensive) or with software such as HAProxy.
@ -692,7 +696,7 @@ Layer 4 load balancers look at info at the [transport layer](#communication) to
### Layer 7 load balancing
Layer 7 load balancers look at the [application layer](#communication) to decide how to distribute requests. This can involve contents of the header, message, and cookies. Layer 7 load balancers terminates network traffic, reads the message, makes a load-balancing decision, then opens a connection to the selected server. For example, a layer 7 load balancer can direct video traffic to servers that host videos while directing more sensitive user billing traffic to security-hardened servers.
Layer 7 load balancers look at the [application layer](#communication) to decide how to distribute requests. This can involve contents of the header, message, and cookies. Layer 7 load balancers terminate network traffic, reads the message, makes a load-balancing decision, then opens a connection to the selected server. For example, a layer 7 load balancer can direct video traffic to servers that host videos while directing more sensitive user billing traffic to security-hardened servers.
At the cost of flexibility, layer 4 load balancing requires less time and computing resources than Layer 7, although the performance impact can be minimal on modern commodity hardware.
@ -710,7 +714,7 @@ Load balancers can also help with horizontal scaling, improving performance and
### Disadvantage(s): load balancer
* The load balancer can become a performance bottleneck if it does not have enough resources or if it is not configured properly.
* Introducing a load balancer to help eliminate single points of failure results in increased complexity.
* Introducing a load balancer to help eliminate a single point of failure results in increased complexity.
* A single load balancer is a single point of failure, configuring multiple load balancers further increases complexity.
### Source(s) and further reading
@ -726,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/>
@ -769,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>
@ -804,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>
@ -827,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>
@ -842,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>
@ -870,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>
@ -891,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>
@ -1035,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>
@ -1044,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.
@ -1052,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>
@ -1086,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>
@ -1128,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>
@ -1199,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>
@ -1235,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>
@ -1270,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>
@ -1288,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>
@ -1320,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>
@ -1346,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
@ -1366,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>
@ -1398,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>
@ -1422,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>
@ -1451,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>
@ -1609,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
@ -1623,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
@ -1669,6 +1673,7 @@ Handy metrics based on numbers above:
| 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 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 Implemenation](http://bhomnick.net/building-a-simple-limit-order-in-go/) |
| Add a system design question | [Contribute](#contributing) |
### Real world architectures
@ -1676,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>
@ -1752,7 +1757,7 @@ 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/)
@ -1772,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/)

163
TRANSLATIONS.md Normal file
View File

@ -0,0 +1,163 @@
# Translations
**Thank you to our awesome translation maintainers!**
## Contributing
See the [Contributing Guidelines](CONTRIBUTING.md).
## Translation Statuses
* 🎉 **Live**: Merged into `master` branch
* ⏳ **In Progress**: Under active translation for eventual merge into `master` branch
* ❗ **Stalled***: Needs an active maintainer ✋
**Within the past 2 months, there has been 1) No active work in the translation fork, and 2) No discussions from previous maintainer(s) in the discussion thread.*
Languages not listed here have not been started, [contribute](CONTRIBUTING.md)!
Languages are grouped by status and are listed in alphabetical order.
## Live
### 🎉 Japanese
* [README-ja.md](README-ja.md)
* Maintainer(s): [@tsukukobaan](https://github.com/tsukukobaan) 👏
* Discussion Thread: https://github.com/donnemartin/system-design-primer/issues/100
### 🎉 Simplified Chinese
* [zh-Hans.md](README-zh-Hans.md)
* Maintainer(s): [@sqrthree](https://github.com/sqrthree) 👏
* Discussion Thread: https://github.com/donnemartin/system-design-primer/issues/38
### 🎉 Traditional Chinese
* [README-zh-TW.md](README-zh-TW.md)
* Maintainer(s): [@kevingo](https://github.com/kevingo) 👏
* Discussion Thread: https://github.com/donnemartin/system-design-primer/issues/88
## In Progress
### ⏳ Korean
* Maintainer(s): [@bonomoon](https://github.com/bonomoon), [@mingrammer](https://github.com/mingrammer) 👏
* Discussion Thread: https://github.com/donnemartin/system-design-primer/issues/102
* Translation Fork: https://github.com/bonomoon/system-design-primer, https://github.com/donnemartin/system-design-primer/pull/103
### ⏳ Russian
* Maintainer(s): [@voitau](https://github.com/voitau), [@DmitryOlkhovoi](https://github.com/DmitryOlkhovoi) 👏
* Discussion Thread: https://github.com/donnemartin/system-design-primer/issues/87
* Translation Fork: https://github.com/voitau/system-design-primer/blob/master/README-ru.md
## Stalled
**Notes**:
* If you're able to commit to being an active maintainer for a language, let us know in the discussion thread for your language and update this file with a pull request.
* If you're listed here as a "Previous Maintainer" but can commit to being an active maintainer, also let us know.
* See the [Contributing Guidelines](CONTRIBUTING.md).
### ❗ Arabic
* Maintainer(s): **Help Wanted**
* Previous Maintainer(s): [@aymns](https://github.com/aymns)
* Discussion Thread: https://github.com/donnemartin/system-design-primer/issues/170
* Translation Fork: https://github.com/aymns/system-design-primer/blob/develop/README-ar.md
### ❗ Bengali
* Maintainer(s): **Help Wanted**
* Previous Maintainer(s): [@nutboltu](https://github.com/nutboltu)
* Discussion Thread: https://github.com/donnemartin/system-design-primer/issues/220
* Translation Fork: https://github.com/donnemartin/system-design-primer/pull/240
### ❗ Brazilian Portuguese
* Maintainer(s): **Help Wanted**
* Previous Maintainer(s): [@IuryAlves](https://github.com/IuryAlves)
* Discussion Thread: https://github.com/donnemartin/system-design-primer/issues/40
* Translation Fork: https://github.com/IuryAlves/system-design-primer, https://github.com/donnemartin/system-design-primer/pull/67
### ❗ French
* Maintainer(s): **Help Wanted**
* Previous Maintainer(s): [@spuyet](https://github.com/spuyet)
* Discussion Thread: https://github.com/donnemartin/system-design-primer/issues/250
* Translation Fork: https://github.com/spuyet/system-design-primer/blob/add-french-translation/README-fr.md
### ❗ German
* Maintainer(s): **Help Wanted**
* Previous Maintainer(s): [@Allaman](https://github.com/Allaman)
* Discussion Thread: https://github.com/donnemartin/system-design-primer/issues/186
* Translation Fork: None
### ❗ Greek
* Maintainer(s): **Help Wanted**
* Previous Maintainer(s): [@Belonias](https://github.com/Belonias)
* Discussion Thread: https://github.com/donnemartin/system-design-primer/issues/130
* Translation Fork: None
### ❗ Hebrew
* Maintainer(s): **Help Wanted**
* Previous Maintainer(s): [@EladLeev](https://github.com/EladLeev)
* Discussion Thread: https://github.com/donnemartin/system-design-primer/issues/272
* Translation Fork: https://github.com/EladLeev/system-design-primer/tree/he-translate
### ❗ Italian
* Maintainer(s): **Help Wanted**
* Previous Maintainer(s): [@pgoodjohn](https://github.com/pgoodjohn)
* Discussion Thread: https://github.com/donnemartin/system-design-primer/issues/104
* Translation Fork: https://github.com/pgoodjohn/system-design-primer
### ❗ Persian
* Maintainer(s): **Help Wanted**
* Previous Maintainer(s): [@hadisinaee](https://github.com/hadisinaee)
* Discussion Thread: https://github.com/donnemartin/system-design-primer/pull/112
* Translation Fork: https://github.com/donnemartin/system-design-primer/pull/112
### ❗ Spanish
* Maintainer(s): **Help Wanted**
* Previous Maintainer(s): [@eamanu](https://github.com/eamanu)
* Discussion Thread: https://github.com/donnemartin/system-design-primer/issues/136
* Translation Fork: https://github.com/donnemartin/system-design-primer/pull/189
### ❗ Thai
* Maintainer(s): **Help Wanted**
* Previous Maintainer(s): [@iphayao](https://github.com/iphayao)
* Discussion Thread: https://github.com/donnemartin/system-design-primer/issues/187
* Translation Fork: https://github.com/donnemartin/system-design-primer/pull/221
### ❗ Turkish
* Maintainer(s): **Help Wanted**
* Previous Maintainer(s): [@hwclass](https://github.com/hwclass), [@canerbaran](https://github.com/canerbaran), [@emrahtoy](https://github.com/emrahtoy)
* Discussion Thread: https://github.com/donnemartin/system-design-primer/issues/39
* Translation Fork: https://github.com/donnemartin/system-design-primer/pull/239
### ❗ Ukrainian
* Maintainer(s): **Help Wanted**
* Previous Maintainer(s): [@Kietzmann](https://github.com/Kietzmann), [@Acarus](https://github.com/Acarus)
* Discussion Thread: https://github.com/donnemartin/system-design-primer/issues/248
* Translation Fork: https://github.com/Acarus/system-design-primer
### ❗ Vietnamese
* Maintainer(s): **Help Wanted**
* Previous Maintainer(s): [@tranlyvu](https://github.com/tranlyvu), [@duynguyenhoang](https://github.com/duynguyenhoang)
* Discussion Thread: https://github.com/donnemartin/system-design-primer/issues/127
* Translation Fork: https://github.com/donnemartin/system-design-primer/pull/241, https://github.com/donnemartin/system-design-primer/pull/327
## Not Started
Languages not listed here have not been started, [contribute](CONTRIBUTING.md)!

View File

@ -1,4 +1,4 @@
#! /usr/bin/env sh
#! /usr/bin/env bash
generate_from_stdin() {
outfile=$1
@ -34,6 +34,20 @@ generate () {
cat $name.md | generate_from_stdin $name.epub $language
}
# Check if depencies exist
check_dependencies () {
for dependency in "${dependencies[@]}"
do
if ! [ -x "$(command -v $dependency)" ]; then
echo "Error: $dependency is not installed." >&2
exit 1
fi
done
}
dependencies=("pandoc")
check_dependencies
generate_with_solutions
generate README-ja ja
generate README-zh-Hans zh-Hans

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

View File

@ -202,7 +202,7 @@ For sellers not initially seeded in the map, we could use a crowdsourcing effort
```python
class Categorizer(object):
def __init__(self, seller_category_map, self.seller_category_crowd_overrides_map):
def __init__(self, seller_category_map, seller_category_crowd_overrides_map):
self.seller_category_map = seller_category_map
self.seller_category_crowd_overrides_map = \
seller_category_crowd_overrides_map
@ -223,7 +223,7 @@ Transaction implementation:
class Transaction(object):
def __init__(self, created_at, seller, amount):
self.timestamp = timestamp
self.created_at = created_at
self.seller = seller
self.amount = amount
```
@ -241,10 +241,10 @@ class Budget(object):
def create_budget_template(self):
return {
'DefaultCategories.HOUSING': income * .4,
'DefaultCategories.FOOD': income * .2
'DefaultCategories.GAS': income * .1,
'DefaultCategories.SHOPPING': income * .2
DefaultCategories.HOUSING: self.income * .4,
DefaultCategories.FOOD: self.income * .2,
DefaultCategories.GAS: self.income * .1,
DefaultCategories.SHOPPING: self.income * .2,
...
}
@ -373,9 +373,9 @@ Instead of keeping the `monthly_spending` aggregate table in the **SQL Database*
We might only want to store a month of `transactions` data in the database, while storing the rest in a data warehouse or in an **Object Store**. An **Object Store** such as Amazon S3 can comfortably handle the constraint of 250 GB of new content per month.
To address the 2,000 *average* read requests per second (higher at peak), traffic for popular content should be handled by the **Memory Cache** instead of the database. The **Memory Cache** is also useful for handling the unevenly distributed traffic and traffic spikes. The **SQL Read Replicas** should be able to handle the cache misses, as long as the replicas are not bogged down with replicating writes.
To address the 200 *average* read requests per second (higher at peak), traffic for popular content should be handled by the **Memory Cache** instead of the database. The **Memory Cache** is also useful for handling the unevenly distributed traffic and traffic spikes. The **SQL Read Replicas** should be able to handle the cache misses, as long as the replicas are not bogged down with replicating writes.
200 *average* transaction writes per second (higher at peak) might be tough for a single **SQL Write Master-Slave**. We might need to employ additional SQL scaling patterns:
2,000 *average* transaction writes per second (higher at peak) might be tough for a single **SQL Write Master-Slave**. We might need to employ additional SQL scaling patterns:
* [Federation](https://github.com/donnemartin/system-design-primer#federation)
* [Sharding](https://github.com/donnemartin/system-design-primer#sharding)

View File

@ -116,7 +116,7 @@ paste_path varchar(255) NOT NULL
PRIMARY KEY(shortlink)
```
We'll create an [index](https://github.com/donnemartin/system-design-primer#use-good-indices) on `shortlink ` and `created_at` to speed up lookups (log-time instead of scanning the entire table) and to keep the data in memory. Reading 1 MB sequentially from memory takes about 250 microseconds, while reading from SSD takes 4x and from disk takes 80x longer.<sup><a href=https://github.com/donnemartin/system-design-primer#latency-numbers-every-programmer-should-know>1</a></sup>
Setting the primary key to be based on the `shortlink` column creates an [index](https://github.com/donnemartin/system-design-primer#use-good-indices) that the database uses to enforce uniqueness. We'll create an additional index on `created_at` to speed up lookups (log-time instead of scanning the entire table) and to keep the data in memory. Reading 1 MB sequentially from memory takes about 250 microseconds, while reading from SSD takes 4x and from disk takes 80x longer.<sup><a href=https://github.com/donnemartin/system-design-primer#latency-numbers-every-programmer-should-know>1</a></sup>
To generate the unique url, we could:

View File

@ -26,7 +26,7 @@ Without an interviewer to address clarifying questions, we'll define some use ca
#### Out of scope
* **Service** pushes tweets to the Twitter Firehose and other streams
* **Service** strips out tweets based on user's visibility settings
* **Service** strips out tweets based on users' visibility settings
* Hide @reply if the user is not also following the person being replied to
* Respect 'hide retweets' setting
* Analytics
@ -80,6 +80,7 @@ Search
* 60 thousand tweets delivered on fanout per second
* 150 billion tweets delivered on fanout per month * (400 requests per second / 1 billion requests per month)
* 4,000 search requests per second
* 10 billion searches per month * (400 requests per second / 1 billion requests per month)
Handy conversion guide:
@ -128,7 +129,7 @@ If our **Memory Cache** is Redis, we could use a native Redis list with the foll
| tweet_id user_id meta | tweet_id user_id meta | tweet_id user_id meta |
```
The new tweet would be placed in the **Memory Cache**, which populates user's home timeline (activity from people the user is following).
The new tweet would be placed in the **Memory Cache**, which populates the user's home timeline (activity from people the user is following).
We'll use a public [**REST API**](https://github.com/donnemartin/system-design-primer#representational-state-transfer-rest):

View File

@ -77,7 +77,7 @@ Handy conversion guide:
### Use case: Service crawls a list of urls
We'll assume we have an initial list of `links_to_crawl` ranked initially based on overall site popularity. If this is not a reasonable assumption, we can seed the crawler with popular sites that link to outside content such as [Yahoo](https://www.yahoo.com/), [DMOZ](http://www.dmoz.org/), etc
We'll assume we have an initial list of `links_to_crawl` ranked initially based on overall site popularity. If this is not a reasonable assumption, we can seed the crawler with popular sites that link to outside content such as [Yahoo](https://www.yahoo.com/), [DMOZ](http://www.dmoz.org/), etc.
We'll use a table `crawled_links` to store processed links and their page signatures.
@ -282,7 +282,7 @@ Some searches are very popular, while others are only executed once. Popular qu
Below are a few other optimizations to the **Crawling Service**:
* To handle the data size and request load, the **Reverse Index Service** and **Document Service** will likely need to make heavy use sharding and replication.
* To handle the data size and request load, the **Reverse Index Service** and **Document Service** will likely need to make heavy use sharding and federation.
* DNS lookup can be a bottleneck, the **Crawler Service** can keep its own DNS lookup that is refreshed periodically
* The **Crawler Service** can improve performance and reduce memory usage by keeping many open connections at a time, referred to as [connection pooling](https://en.wikipedia.org/wiki/Connection_pool)
* Switching to [UDP](https://github.com/donnemartin/system-design-primer#user-datagram-protocol-udp) could also boost performance