目次

HTTPの処理時間を計測



Webの処理

Blocking Webサーバーへの接続までの待ち時間。
DNS Lookup ドメインのDNSルックアップ。
Connection サーバーとの接続にかかった時間。
SSL SSLハンドシェイクにかかった時間。
Sending 送信にかかった時間。
Waiting 最初の応答を受け取るまでの待ち時間。
Receiving 応答開始から終了までの時間。

[DNS Lookup]に時間がかかっている場合、DNSプリフェッチを検討できる。
[Sending]や[Receiving]に時間がかかっている場合は、サーバーの物理配置の変更、CDNの検討、GZip圧縮の検討などが考えられる。
[Waiting]に時間がかかっている場合は、Webサーバー側の処理をチューニングすることを検討する必要がある

DNSプリフェッチ
<link rel="dns-prefetch" href="http://www.example.com/" />


Chromeの開発者ツールでのHTTP処理計測方法

Understanding Resource Timing  |  Tools for Web Developers

Resouce Scheduling

リクエストの順番を決定するためのスケジューリングにかかった時間

Queueing


Connection

StartStalled
DNS Lookup
Initial connection
SSL


Request/Response

TCPコネクションを作成したあとに、リクエストを送信してレスポンスの受信が完了するまでに時間

Request sent
Waiting(TTFP)
Content Download


参考




Firefoxの開発者ツール




httpingで、サイトのレスポンス計測

AWS CloudFrontを使っているとなぜか失敗する。。

#http
httping -sc 1 http://example.com/

#https(-l)
httping -lsc 1 https://example.com/




curlで、サイトのレスポンス計測

#レスポンスのみ計測
curl -kL 'https://example.com/' -o /dev/null -w "%{time_total}" 2> /dev/null
0.543

#ステータスも表示
curl -kL 'https://examle.com/' -o /dev/null -w "%{http_code}\t%{time_total}" 2> /dev/null
200  0.543

CSVで色々な情報を保存

参考curlでパフォーマンス測定 | DevelopersIO

curl  https://dev.classmethod.jp -o /dev/null -s -w @- << EOF
%{http_code},
%{size_download},
%{size_upload},
%{speed_download},
%{speed_upload},
%{time_namelookup},
%{time_connect},
%{time_appconnect},
%{time_pretransfer},
%{time_starttransfer},
%{time_total}\n
EOF
curl  https://dev.classmethod.jp -o /dev/null -s -w @- << EOF
size_download: %{size_download}\n
size_upload: %{size_upload}\n
speed_download: %{speed_download}\n
speed_upload: %{speed_upload}\n
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_starttransfer: %{time_starttransfer}\n
time_total: %{time_total}\n
EOF




参考




関連ページ