发现一个基于 Go 写的 http 检测工具(httpstats),可以比较直观的看到一个完整的 http 的处理周期和耗时(It’s like curl -v, with colours)
Github 地址:https://github.com/davecheney/httpstat
安装
1
| go get github.com/davecheney/httpstat
|
httpstat 测试
头条和 JD 的服务端处理这块都较为迅速,WebServer 这块,头条这边用到Tengine
,JD 用的JDWS
,都充分利用了缓存这块,而且都命中了。
Via: cache6.cn588[38,0]
、Via: BJ-Y-NX-102(HIT), http/1.1 GZ-CT-1-JCS-29 ( [cRs f ])
头条
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
| $ httpstat -L http://toutiao.com\?no-cache\=2
Connected to 123.58.9.80:80
HTTP/1.1 301 Moved Permanently
Server: nginx
Content-Length: 178
Content-Type: text/html
Date: Wed, 31 Jul 2019 02:48:50 GMT
Location: http://www.toutiao.com/?no-cache=2
Vary: Accept-Encoding
X-Tt-Timestamp: 1564541330.759
Connection: keep-alive
DNS Lookup TCP Connection Server Processing Content Transfer
[ 5ms | 45ms | 48ms | 0ms ]
| | | |
namelookup:5ms | | |
connect:50ms | |
starttransfer:98ms |
total:98ms
Connected to 14.119.114.92:80
HTTP/1.1 301 Moved Permanently
Server: Tengine
Content-Length: 178
Content-Type: text/html
Date: Wed, 31 Jul 2019 02:48:50 GMT
Eagleid: 0e77721a15645413307961693e
Location: https://www.toutiao.com/?no-cache=2
Timing-Allow-Origin: *
Vary: Accept-Encoding
Via: cache6.cn588[38,0]
X-Tt-Timestamp: 1564541330.815
Connection: keep-alive
DNS Lookup TCP Connection Server Processing Content Transfer
[ 1ms | 7ms | 59ms | 0ms ]
| | | |
namelookup:1ms | | |
connect:9ms | |
starttransfer:68ms |
total:69ms
Connected to 14.119.114.92:443
HTTP/2.0 200 OK
Server: Tengine
Content-Type: text/html; charset=utf-8
Date: Wed, 31 Jul 2019 02:48:51 GMT
Eagleid: 0e77721c15645413311441809e
Server-Timing: inner;dur=0.004, inner; dur=4
Set-Cookie: tt_webid=6719653820131247629; Max-Age=7776000
Timing-Allow-Origin: *
Vary: Accept-Encoding,Accept-Encoding,Accept-Encoding
Via: cache8.cn588[45,0]
X-Ss-Set-Cookie: tt_webid=6719653820131247629; Max-Age=7776000
X-Tt-Timestamp: 1564541331.169
Body discarded
DNS Lookup TCP Connection TLS Handshake Server Processing Content Transfer
[ 1ms | 6ms | 276ms | 56ms | 0ms ]
| | | | |
namelookup:1ms | | | |
connect:8ms | | |
pretransfer:286ms | |
starttransfer:343ms |
total:343ms
|
JD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
| $ httpstat -L http://jd.com\?no-cache\=1
Connected to 120.52.148.118:80
HTTP/1.1 302 Moved Temporarily
Server: jfe
Content-Length: 165
Content-Type: text/html
Date: Wed, 31 Jul 2019 02:46:25 GMT
Location: http://www.jd.com
Connection: keep-alive
DNS Lookup TCP Connection Server Processing Content Transfer
[ 16ms | 39ms | 41ms | 0ms ]
| | | |
namelookup:16ms | | |
connect:56ms | |
starttransfer:97ms |
total:97ms
Connected to 183.56.147.1:80
HTTP/1.1 302 Moved Temporarily
Server: JDWS/2.0
Content-Length: 157
Content-Type: text/html
Date: Wed, 31 Jul 2019 02:46:25 GMT
Location: https://www.jd.com/
Strict-Transport-Security: max-age=7776000
Connection: keep-alive
DNS Lookup TCP Connection Server Processing Content Transfer
[ 1ms | 6ms | 7ms | 0ms ]
| | | |
namelookup:1ms | | |
connect:8ms | |
starttransfer:15ms |
total:15ms
Connected to 183.56.147.1:443
HTTP/2.0 200 OK
Server: JDWS/2.0
Age: 4
Cache-Control: max-age=30
Content-Type: text/html; charset=utf-8
Date: Wed, 31 Jul 2019 02:46:26 GMT
Expires: Wed, 31 Jul 2019 02:46:49 GMT
Ser: 6.155
Strict-Transport-Security: max-age=7776000
Vary: Accept-Encoding
Via: BJ-Y-NX-102(HIT), http/1.1 GZ-CT-1-JCS-29 ( [cRs f ])
Body discarded
DNS Lookup TCP Connection TLS Handshake Server Processing Content Transfer
[ 1ms | 7ms | 229ms | 15ms | 1ms ]
| | | | |
namelookup:1ms | | | |
connect:8ms | | |
pretransfer:240ms | |
starttransfer:255ms |
total:256ms
|
Tkstorm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
| $ httpstat -k -L http://tkstorm.com\?no-cache\=1
Connected to 119.23.74.167:80
HTTP/1.1 301 Moved Permanently
Server: nginx
Content-Length: 178
Content-Type: text/html
Date: Wed, 31 Jul 2019 02:57:15 GMT
Location: https://tkstorm.com/?no-cache=1
Connection: keep-alive
DNS Lookup TCP Connection Server Processing Content Transfer
[ 3ms | 10ms | 24ms | 0ms ]
| | | |
namelookup:3ms | | |
connect:14ms | |
starttransfer:38ms |
total:38ms
Connected to 119.23.74.167:443
HTTP/2.0 200 OK
Server: nginx
Content-Type: text/html; charset=utf-8
Date: Wed, 31 Jul 2019 02:57:15 GMT
Etag: W/"5d39752c-a26d"
Last-Modified: Thu, 25 Jul 2019 09:23:56 GMT
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Accept-Encoding
Body discarded
DNS Lookup TCP Connection TLS Handshake Server Processing Content Transfer
[ 3ms | 10ms | 34ms | 17ms | 0ms ]
| | | | |
namelookup:3ms | | | |
connect:14ms | | |
pretransfer:51ms | |
starttransfer:68ms |
total:69ms
|