Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ac806e46cb | ||
|
301b9d88e4 | ||
|
8e9c89129b | ||
|
fc563ca297 | ||
|
3b2264e5e8 | ||
|
e50f26960d | ||
|
eaa447cc39 | ||
|
3ea0b15b50 | ||
|
fdba2a2586 |
22
README-ja.md
22
README-ja.md
@ -902,31 +902,31 @@ SQLチューニングは広範な知識を必要とする分野で多くの [本
|
|||||||
|
|
||||||
##### スキーマを絞る
|
##### スキーマを絞る
|
||||||
|
|
||||||
* より早い接続を得るために、連続したブロックの中のディスクにMySQLをダンプする。
|
* MySQLはアクセス速度向上のため、ディスク上の連続したブロックへデータを格納しています。
|
||||||
* 長さの決まったフィールドに対しては `VARCHAR` よりも `CHAR` を使うようにしましょう。
|
* 長さの決まったフィールドに対しては `VARCHAR` よりも `CHAR` を使うようにしましょう。
|
||||||
* `CHAR` の方が効率的に速くランダムにデータにアクセスできます。 一方、 `VARCHAR` では次のデータに移る前にデータの末尾を検知しなければならないために速度が犠牲になります。
|
* `CHAR` の方が効率的に速くランダムにデータにアクセスできます。 一方、 `VARCHAR` では次のデータに移る前にデータの末尾を検知しなければならないために速度が犠牲になります。
|
||||||
* ブログ投稿などの大きなテキスト `TEXT` を使いましょう。 `TEXT` ではブーリアン型の検索も可能です。 `TEXT` フィールドを使うことは、テキストブロックを配置するのに用いたポインターをディスク上に保存することになります。
|
* ブログの投稿など、大きなテキストには TEXT を使いましょう。 TEXT ではブーリアン型の検索も可能です。 TEXT フィールドには、テキストブロックが配置されている、ディスク上の場所へのポインターが保存されます。
|
||||||
* 2の32乗や40億を超えてくる数に関しては `INT` を使いましょう
|
* 2の32乗や40億以下を超えない程度の大きな数には INT を使いましょう。
|
||||||
* 通貨に関しては小数点表示上のエラーを避けるために `DECIMAL` を使いましょう。
|
* 通貨に関しては小数点表示上のエラーを避けるために `DECIMAL` を使いましょう。
|
||||||
* 大きな `BLOBS` を保存するのは避けましょう。どこからそのオブジェクトを取ってくることができるかの情報を保存しましょう。
|
* 大きな `BLOBS` を保存するのは避けましょう。どこからそのオブジェクトを取ってくることができるかの情報を保存しましょう。
|
||||||
* `VARCHAR(255)` は8ビットで数えることができる中で最大の文字数ですが、このフィールドがしばしばRDBMSの中で大きな容量を食います。
|
* `VARCHAR(255)` は8ビットで数えられる最大の文字数です。一部のDBMSでは、1バイトの利用効率を最大化するためにこの文字数がよく使われます。
|
||||||
* [検索性能を向上させる](http://stackoverflow.com/questions/1017239/how-do-null-values-affect-performance-in-a-database-search) ことが可能な箇所については `NOT NULL` 制約を設定しましょう
|
* [検索性能向上のため](http://stackoverflow.com/questions/1017239/how-do-null-values-affect-performance-in-a-database-search) 、可能であれば `NOT NULL` 制約を設定しましょう。
|
||||||
|
|
||||||
##### インデックスを効果的に用いる
|
##### インデックスを効果的に用いる
|
||||||
|
|
||||||
* クエリ(`SELECT`、 `GROUP BY`、 `ORDER BY`、 `JOIN`) を用いて取得する列はインデックスを用いると速度を向上できる。
|
* クエリ(`SELECT`、 `GROUP BY`、 `ORDER BY`、 `JOIN`) の対象となる列にインデックスを使うことで速度を向上できるかもしれません。
|
||||||
* インデックスは通常、対数的にデータを検索、挿入、削除する際に用いる[B-tree](https://en.wikipedia.org/wiki/B-tree)として表現されています。
|
* インデックスは通常、平衡探索木である[B木](https://en.wikipedia.org/wiki/B-tree)の形で表されます。B木によりデータは常にソートされた状態になります。また検索、順次アクセス、挿入、削除を対数時間で行えます。
|
||||||
* インデックスを配置することはデータをメモリーに残すことにつながりより容量を必要とします。
|
* インデックスを配置することはデータをメモリーに残すことにつながりより容量を必要とします。
|
||||||
* インデックスの更新も必要になるため書き込みも遅くなります。
|
* インデックスの更新も必要になるため書き込みも遅くなります。
|
||||||
* 大きなデータを読み込む際には、インデックスを切ってからデータをロードして再びインデックスをビルドした方が速いことがあります。
|
* 大量のデータをロードする際には、インデックスを切ってからデータをロードして再びインデックスをビルドした方が速いことがあります。
|
||||||
|
|
||||||
##### 高負荷なジョインを避ける
|
##### 高負荷なジョインを避ける
|
||||||
|
|
||||||
* パフォーマンスが必要なところには[非正規化](#非正規化)を適用する
|
* パフォーマンス上必要なところには[非正規化](#非正規化)を適用する
|
||||||
|
|
||||||
##### テーブルのパーティション
|
##### テーブルのパーティション
|
||||||
|
|
||||||
* メモリー内に保つために、分離されたテーブルを分割してそれぞれにホットスポットを設定する。
|
* テーブルを分割し、ホットスポットを独立したテーブルに分離してメモリーに乗せられるようにする。
|
||||||
|
|
||||||
##### クエリキャッシュを調整する
|
##### クエリキャッシュを調整する
|
||||||
|
|
||||||
@ -935,7 +935,7 @@ SQLチューニングは広範な知識を必要とする分野で多くの [本
|
|||||||
##### その他の参考資料、ページ: SQLチューニング
|
##### その他の参考資料、ページ: SQLチューニング
|
||||||
|
|
||||||
* [MySQLクエリを最適化するためのTips](http://20bits.com/article/10-tips-for-optimizing-mysql-queries-that-dont-suck)
|
* [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)
|
* [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)
|
* [Slow query log](http://dev.mysql.com/doc/refman/5.7/en/slow-query-log.html)
|
||||||
|
|
||||||
|
@ -926,7 +926,7 @@ SQL 调优是一个范围很广的话题,有很多相关的[书](https://www.a
|
|||||||
- 使用 `TEXT` 类型存储大块的文本,例如博客正文。`TEXT` 还允许布尔搜索。使用 `TEXT` 字段需要在磁盘上存储一个用于定位文本块的指针。
|
- 使用 `TEXT` 类型存储大块的文本,例如博客正文。`TEXT` 还允许布尔搜索。使用 `TEXT` 字段需要在磁盘上存储一个用于定位文本块的指针。
|
||||||
- 使用 `INT` 类型存储高达 2^32 或 40 亿的较大数字。
|
- 使用 `INT` 类型存储高达 2^32 或 40 亿的较大数字。
|
||||||
- 使用 `DECIMAL` 类型存储货币可以避免浮点数表示错误。
|
- 使用 `DECIMAL` 类型存储货币可以避免浮点数表示错误。
|
||||||
- 避免使用 `BLOBS` 存储对象,存储存放对象的位置。
|
- 避免使用 `BLOBS` 存储实际对象,而是用来存储存放对象的位置。
|
||||||
- `VARCHAR(255)` 是以 8 位数字存储的最大字符数,在某些关系型数据库中,最大限度地利用字节。
|
- `VARCHAR(255)` 是以 8 位数字存储的最大字符数,在某些关系型数据库中,最大限度地利用字节。
|
||||||
- 在适用场景中设置 `NOT NULL` 约束来[提高搜索性能](http://stackoverflow.com/questions/1017239/how-do-null-values-affect-performance-in-a-database-search)。
|
- 在适用场景中设置 `NOT NULL` 约束来[提高搜索性能](http://stackoverflow.com/questions/1017239/how-do-null-values-affect-performance-in-a-database-search)。
|
||||||
|
|
||||||
|
@ -463,7 +463,7 @@ AP is a good choice if the business needs allow for [eventual consistency](#even
|
|||||||
### Source(s) and further reading
|
### Source(s) and further reading
|
||||||
|
|
||||||
* [CAP theorem revisited](http://robertgreiner.com/2014/08/cap-theorem-revisited/)
|
* [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)
|
* [CAP FAQ](https://github.com/henryr/cap-faq)
|
||||||
|
|
||||||
## Consistency patterns
|
## 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:
|
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
|
* Prevent traffic from going to servers under maintenance
|
||||||
* Balance between varying cluster sizes
|
* Balance between varying cluster sizes
|
||||||
* A/B testing
|
* A/B testing
|
||||||
@ -682,7 +682,7 @@ Load balancers can route traffic based on various metrics, including:
|
|||||||
* Random
|
* Random
|
||||||
* Least loaded
|
* Least loaded
|
||||||
* Session/cookies
|
* 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 4](#layer-4-load-balancing)
|
||||||
* [Layer 7](#layer-7-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
|
### 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)
|
* [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)
|
* [OWASP top ten](https://www.owasp.org/index.php/OWASP_Top_Ten_Cheat_Sheet)
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ class Director(Employee):
|
|||||||
super(Operator, self).__init__(employee_id, name, Rank.DIRECTOR)
|
super(Operator, self).__init__(employee_id, name, Rank.DIRECTOR)
|
||||||
|
|
||||||
def escalate_call(self):
|
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):
|
class CallState(Enum):
|
||||||
|
Loading…
Reference in New Issue
Block a user