32. パフォーマンスの重要性
• UX
• Jakob Nielsen - Response Times: The 3 Important Limits
“1.0 second is about the limit for the user's flow of
thought to stay uninterrupted”
• KPI
• Google: Using site speed in web search ranking
• Aberdeen Group: study showed that a one second delay
in page load time equals 11% fewer page views, a 16%
decrease in customer satisfaction, and 7% loss in
conversions.
http://www.nngroup.com/articles/response-times-3-important-limits/
http://googlewebmastercentral.blogspot.jp/2010/04/using-site-speed-in-web-search-ranking.html
http://www.aberdeen.com/research/5136/ra-performance-web-application/content.aspx
50. MySQL SlowLog解析
# mysqlのコンソールにて
> set global slow_query_log = 1;
> set global long_query_time = 0;
> set global slow_query_log_file = "/tmp/slow.log";
# ベンチマーク実行
$ pt-query-digest /tmp/slow.log > /tmp/digest.txt
$ rm /tmp/slow.log
# 戻すときは
$ service mysqld restart
58. Remix: Latency Numbers Every Programmer Should Know(2014)
http://yuroyoro.net/latency.html
59. コンテキストスイッチング
CPU CPU CPU CPU
process process process process process process process
process process process process process process process
process process process process process process process
OSによりスケジュール実行
60. コンテキストスイッチング
CPU CPU CPU CPU
process process
process
process process process process
process process process process process process process
process process process process process process process
OSによりスケジュール実行
61. コンテキストスイッチング
CPU CPU CPU CPU
process process process process process process process
process process process process process
process
process
process process process process process process process
OSによりスケジュール実行
68. Nginx vs. h2o
リクエスト
process process
process
リクエスト
thread thread
thread
h2oはプロセスではなくスレッド。スレッドの方がコンテキスト
スイッチのコストが低い。スレッド間の情報の共有がしやすい
複数のworkerプロセスを
起動し大量のアクセスを
捌く
74. MySQL の B+Tree
SECONDARY KEY
primary keyじゃないkey
リーフノードに
PRIMARYKEYが含まれ、
データはCLUSTEREDINDEX
から取得
id id id id id id id id
is_private
created_at
older newer older newer
80. MySQLのOFFSET処理
id title user ... . id title user ... . id title user ... . id title user ... .
id title user ... . id title user ... . id title user ... . id title user ... .
id title user ... . id title user ... . id title user ... . id title user ... .
id title user ... .
id title user ... . id title user ... . id title user ... . id title user ... .
id title user ... .
1 2 3 4
5 6 7 8
9 10 11 12
13
10000
10001 10002 10003 10004
81. MySQLのOFFSET処理
id title user ... . id title user ... . id title user ... . id title user ... .
id title user ... . id title user ... . id title user ... . id title user ... .
id title user ... . id title user ... . id title user ... . id title user ... .
id title user ... .
id title user ... . id title user ... . id title user ... . id title user ... .
id title user ... .
1 2 3 4
5 6 7 8
9 10 11 12
13
10000
10001 10002 10003 10004
頑張ってソート
必要な個数まで到達
82. MySQLのOFFSET処理
id title user ... . id title user ... . id title user ... . id title user ... .
id title user ... . id title user ... . id title user ... . id title user ... .
id title user ... . id title user ... . id title user ... . id title user ... .
id title user ... .
id title user ... . id title user ... . id title user ... . id title user ... .
id title user ... .
1 2 3 4
5 6 7 8
9 10 11 12
13
10000
10001 10002 10003 10004
頑張ってソート
必要な個数まで到達
廃棄