Compare commits

...

9 Commits

Author SHA1 Message Date
Donne Martin ac806e46cb
Revert "zh-cn: Sync with upstream to keep it up-to-date (#374)" (#391)
This reverts commit 301b9d88e4.

#374 overwrote the English version of the solutions
2020-03-09 21:46:02 -04:00
根号三 301b9d88e4
zh-cn: Sync with upstream to keep it up-to-date (#374) 2020-03-09 21:34:18 -04:00
Danny Jung 8e9c89129b
Fix broken link in CAP theorem section (#348) 2020-02-16 21:00:44 -05:00
vyq fc563ca297 Fix broken CAP theorem link (#355) 2020-01-20 17:26:09 -07:00
Dan Choi 3b2264e5e8 Fix broken round robin links (#351) 2020-01-15 07:04:08 -08:00
Christian Clauss e50f26960d Change raise NotImplemented to raise NotImplementedError (#345) 2019-12-26 20:11:57 -05:00
SATO Yusuke eaa447cc39 ja: Fix mistranslation in SQL tuning section (#305) 2019-12-08 22:35:44 -05:00
Brandon 3ea0b15b50 zh-Hans: Change translation in SQL tuning (#318) 2019-12-08 22:34:17 -05:00
Duy Nguyen Hoang fdba2a2586 Add API security checklist (#328) 2019-11-03 05:56:24 -05:00
4 changed files with 17 additions and 16 deletions

View File

@ -902,31 +902,31 @@ SQLチューニングは広範な知識を必要とする分野で多くの [本
##### スキーマを絞る
* より早い接続を得るために、連続したブロックの中のディスクにMySQLをダンプする
* MySQLはアクセス速度向上のため、ディスク上の連続したブロックへデータを格納しています
* 長さの決まったフィールドに対しては `VARCHAR` よりも `CHAR` を使うようにしましょう。
* `CHAR` の方が効率的に速くランダムにデータにアクセスできます。 一方、 `VARCHAR` では次のデータに移る前にデータの末尾を検知しなければならないために速度が犠牲になります。
* ブログ投稿などの大きなテキスト `TEXT` を使いましょう。 `TEXT` ではブーリアン型の検索も可能です。 `TEXT` フィールドを使うことは、テキストブロックを配置するのに用いたポインターをディスク上に保存することになります。
* 2の32乗や40億を超えてくる数に関しては `INT` を使いましょう
* ブログの投稿など、大きなテキストには TEXT を使いましょう。 TEXT ではブーリアン型の検索も可能です。 TEXT フィールドには、テキストブロックが配置されている、ディスク上の場所へのポインターが保存されます。
* 2の32乗や40億以下を超えない程度の大きな数には INT を使いましょう。
* 通貨に関しては小数点表示上のエラーを避けるために `DECIMAL` を使いましょう。
* 大きな `BLOBS` を保存するのは避けましょう。どこからそのオブジェクトを取ってくることができるかの情報を保存しましょう。
* `VARCHAR(255)` は8ビットで数えることができる中で最大の文字数ですが、このフィールドがしばしばRDBMSの中で大きな容量を食います。
* [検索性能を向上させる](http://stackoverflow.com/questions/1017239/how-do-null-values-affect-performance-in-a-database-search) ことが可能な箇所については `NOT NULL` 制約を設定しましょう
* `VARCHAR(255)` は8ビットで数えられる最大の文字数です。一部のDBMSでは、1バイトの利用効率を最大化するためにこの文字数がよく使われます。
* [検索性能向上のため](http://stackoverflow.com/questions/1017239/how-do-null-values-affect-performance-in-a-database-search) 、可能であれば `NOT NULL` 制約を設定しましょう
##### インデックスを効果的に用いる
* クエリ(`SELECT`、 `GROUP BY``ORDER BY``JOIN`) を用いて取得する列はインデックスを用いると速度を向上できる
* インデックスは通常、対数的にデータを検索、挿入、削除する際に用いる[B-tree](https://en.wikipedia.org/wiki/B-tree)として表現されています。
* クエリ(`SELECT`、 `GROUP BY``ORDER BY``JOIN`) の対象となる列にインデックスを使うことで速度を向上できるかもしれません
* インデックスは通常、平衡探索木である[B木](https://en.wikipedia.org/wiki/B-tree)の形で表されます。B木によりデータは常にソートされた状態になります。また検索、順次アクセス、挿入、削除を対数時間で行えます。
* インデックスを配置することはデータをメモリーに残すことにつながりより容量を必要とします。
* インデックスの更新も必要になるため書き込みも遅くなります。
* 大きなデータを読み込む際には、インデックスを切ってからデータをロードして再びインデックスをビルドした方が速いことがあります。
* 大量のデータをロードする際には、インデックスを切ってからデータをロードして再びインデックスをビルドした方が速いことがあります。
##### 高負荷なジョインを避ける
* パフォーマンス必要なところには[非正規化](#非正規化)を適用する
* パフォーマンス必要なところには[非正規化](#非正規化)を適用する
##### テーブルのパーティション
* メモリー内に保つために、分離されたテーブルを分割してそれぞれにホットスポットを設定する。
* テーブルを分割し、ホットスポットを独立したテーブルに分離してメモリーに乗せられるようにする。
##### クエリキャッシュを調整する
@ -935,7 +935,7 @@ SQLチューニングは広範な知識を必要とする分野で多くの [本
##### その他の参考資料、ページ: SQLチューニング
* [MySQLクエリを最適化するためのTips](http://20bits.com/article/10-tips-for-optimizing-mysql-queries-that-dont-suck)
* [VARCHAR(255)をそんなにたくさん使う必要ある](http://stackoverflow.com/questions/1217466/is-there-a-good-reason-i-see-varchar255-used-so-often-as-opposed-to-another-l)
* [VARCHAR(255)をやたらよく見かけるのはなんで](http://stackoverflow.com/questions/1217466/is-there-a-good-reason-i-see-varchar255-used-so-often-as-opposed-to-another-l)
* [null値はどのようにパフォーマンスに影響するのか](http://stackoverflow.com/questions/1017239/how-do-null-values-affect-performance-in-a-database-search)
* [Slow query log](http://dev.mysql.com/doc/refman/5.7/en/slow-query-log.html)

View File

@ -926,7 +926,7 @@ SQL 调优是一个范围很广的话题,有很多相关的[书](https://www.a
- 使用 `TEXT` 类型存储大块的文本,例如博客正文。`TEXT` 还允许布尔搜索。使用 `TEXT` 字段需要在磁盘上存储一个用于定位文本块的指针。
- 使用 `INT` 类型存储高达 2^32 或 40 亿的较大数字。
- 使用 `DECIMAL` 类型存储货币可以避免浮点数表示错误。
- 避免使用 `BLOBS` 存储对象,存储存放对象的位置。
- 避免使用 `BLOBS` 存储实际对象,而是用来存储存放对象的位置。
- `VARCHAR(255)` 是以 8 位数字存储的最大字符数,在某些关系型数据库中,最大限度地利用字节。
- 在适用场景中设置 `NOT NULL` 约束来[提高搜索性能](http://stackoverflow.com/questions/1017239/how-do-null-values-affect-performance-in-a-database-search)。

View File

@ -463,7 +463,7 @@ AP is a good choice if the business needs allow for [eventual consistency](#even
### Source(s) and further reading
* [CAP theorem revisited](http://robertgreiner.com/2014/08/cap-theorem-revisited/)
* [A plain english introduction to CAP theorem](http://ksat.me/a-plain-english-introduction-to-cap-theorem/)
* [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)
## Consistency patterns
@ -593,7 +593,7 @@ 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](http://g33kinfo.com/info/archives/2657)
* [Weighted round robin](https://www.g33kinfo.com/info/round-robin-vs-weighted-round-robin-lb)
* Prevent traffic from going to servers under maintenance
* Balance between varying cluster sizes
* A/B testing
@ -682,7 +682,7 @@ Load balancers can route traffic based on various metrics, including:
* Random
* Least loaded
* Session/cookies
* [Round robin or weighted round robin](http://g33kinfo.com/info/archives/2657)
* [Round robin or weighted round robin](https://www.g33kinfo.com/info/round-robin-vs-weighted-round-robin-lb)
* [Layer 4](#layer-4-load-balancing)
* [Layer 7](#layer-7-load-balancing)
@ -1566,6 +1566,7 @@ Security is a broad topic. Unless you have considerable experience, a security
### Source(s) and further reading
* [API security checklist](https://github.com/shieldfy/API-Security-Checklist)
* [Security guide for developers](https://github.com/FallibleInc/security-guide-for-developers)
* [OWASP top ten](https://www.owasp.org/index.php/OWASP_Top_Ten_Cheat_Sheet)

View File

@ -66,7 +66,7 @@ class Director(Employee):
super(Operator, self).__init__(employee_id, name, Rank.DIRECTOR)
def escalate_call(self):
raise NotImplemented('Directors must be able to handle any call')
raise NotImplementedError('Directors must be able to handle any call')
class CallState(Enum):