调试阿里云 CDN 同步延迟

结论

cdn 节点和源上相同文件的 etag 或 lm 是相同的。

http header response

https://kb.cnblogs.com/page/92320/

2019/7/23 14:00:43 请求源 101.200.199.142 cdnapp.ydtg.com.cn

Date 原始服务器消息发出的时间

1
2
3
4
5
6
7
8
9
10
11
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 23 Jul 2019 06:00:42 GMT
Content-Type: application/octet-stream
Content-Length: 1200940
Last-Modified: Tue, 23 Jul 2019 00:58:00 GMT
Connection: keep-alive
ETag: "5d365b98-12532c"
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Accept-Ranges: bytes

2019/7/23 14:10:43 请求 61.240.154.102 cdnapp.ydtg.com.cn

Age 从原始服务器到代理缓存形成的估算时间(以秒计,非负) // 大致为当前时间 - Date

http://www.webym.net/jiaocheng/1007.html Age 的描述错误

X-Swift-SaveTime 代表开始在cdn上缓存的时间 // 验证是否与 Date 相等:在 X-Cache: HIT TCP_MEM_HIT 或 X-Cache: MISS TCP_REFRESH_MISS 时相同
X-Swift-CacheTime 是cdn默认缓存时间,以秒为单位,过了这个时间该缓存就失效了 //30分钟左右?

http://www.sosoba.org/thread-271841-1-1.html?mod=viewthread&tid=271841&extra=page%253D1&page=1

X-Cache 命中字段:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
HTTP/1.1 200 OK
Server: Tengine
Content-Type: application/octet-stream
Content-Length: 1200940
Connection: keep-alive
Date: Tue, 23 Jul 2019 05:52:14 GMT
Last-Modified: Tue, 23 Jul 2019 00:58:00 GMT
ETag: "5d365b98-12532c"
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Accept-Ranges: bytes
Ali-Swift-Global-Savetime: 1563861134
Via: cache36.l2cn1818[23,200-0,M], cache14.l2cn1818[39,0], kunlun7.cn1481[0,200-0,H], kunlun7.cn1481[1,0]
Age: 1080
X-Cache: HIT TCP_MEM_HIT dirn:-2:-2
X-Swift-SaveTime: Tue, 23 Jul 2019 05:52:14 GMT
X-Swift-CacheTime: 1765
Timing-Allow-Origin: *
EagleId: 3df09a1b15638622147584175e

2019/7/23 14:25:49 请求 27.221.30.10 cdnapp.ydtg.com.cn

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
HTTP/1.1 200 OK
Server: Tengine
Content-Type: application/octet-stream
Content-Length: 1200940
Connection: keep-alive
Date: Tue, 23 Jul 2019 06:25:24 GMT
Last-Modified: Tue, 23 Jul 2019 00:58:00 GMT
ETag: "5d365b98-12532c"
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Accept-Ranges: bytes
Ali-Swift-Global-Savetime: 1563861134
Via: cache36.l2cn1818[24,200-0,H], cache25.l2cn1818[37,0], kunlun9.cn345[84,200-0,M], kunlun9.cn345[99,0]
Age: 0
X-Cache: MISS TCP_REFRESH_MISS dirn:2:14047659
X-Swift-SaveTime: Tue, 23 Jul 2019 06:25:24 GMT
X-Swift-CacheTime: 1964
Timing-Allow-Origin: *
EagleId: 1bdd1e1d15638631240594521e

==================================

27.221.30.10 cdnapp.ydtg.com.cn

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
HTTP/1.1 200 OK
Server: Tengine
Content-Type: application/octet-stream
Content-Length: 7
Connection: keep-alive
Date: Tue, 23 Jul 2019 06:28:19 GMT
Last-Modified: Tue, 23 Jul 2019 02:28:58 GMT
ETag: "5d3670ea-7"
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Accept-Ranges: bytes
Ali-Swift-Global-Savetime: 1563848991
Via: cache17.l2cn1818[25,200-0,H], cache13.l2cn1818[26,0], kunlun9.cn345[72,200-0,M], kunlun10.cn345[74,0]
Age: 0
X-Cache: MISS TCP_REFRESH_MISS dirn:0:44785189
X-Swift-SaveTime: Tue, 23 Jul 2019 06:28:19 GMT
X-Swift-CacheTime: 1436
Timing-Allow-Origin: *
EagleId: 1bdd1e1e15638632998093847e

101.200.199.142 cdnapp.ydtg.com.cn

1
2
3
4
5
6
7
8
9
10
11
12
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 23 Jul 2019 06:31:02 GMT
Content-Type: application/octet-stream
Content-Length: 7
Last-Modified: Tue, 23 Jul 2019 02:28:58 GMT
Connection: keep-alive
ETag: "5d3670ea-7"
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Accept-Ranges: bytes

61.240.154.102 cdnapp.ydtg.com.cn

当 X-Cache: HIT TCP_REFRESH_HIT 时,Date 和 X-Swift-SaveTime 不再相同

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
HTTP/1.1 200 OK
Server: Tengine
Content-Type: application/octet-stream
Content-Length: 7
Connection: keep-alive
Date: Tue, 23 Jul 2019 06:28:19 GMT
Last-Modified: Tue, 23 Jul 2019 02:28:58 GMT
ETag: "5d3670ea-7"
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Accept-Ranges: bytes
Via: cache17.l2cn1818[0,304-0,H], cache23.l2cn1818[1,0], kunlun10.cn1481[33,200-0,H], kunlun10.cn1481[42,0]
Ali-Swift-Global-Savetime: 1563848991
Age: 379
X-Cache: HIT TCP_REFRESH_HIT dirn:5:50364804
X-Swift-SaveTime: Tue, 23 Jul 2019 06:34:38 GMT
X-Swift-CacheTime: 1474
Timing-Allow-Origin: *
EagleId: 3df09a1e15638636786971064e

2019/7/23 14:43:27 61.240.154.102 cdnapp.ydtg.com.cn

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
HTTP/1.1 200 OK
Server: Tengine
Content-Type: application/octet-stream
Content-Length: 7
Connection: keep-alive
Date: Tue, 23 Jul 2019 06:28:19 GMT
Last-Modified: Tue, 23 Jul 2019 02:28:58 GMT
ETag: "5d3670ea-7"
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Accept-Ranges: bytes
Via: cache17.l2cn1818[0,304-0,H], cache23.l2cn1818[1,0], kunlun10.cn1481[0,200-0,H], kunlun9.cn1481[1,0]
Ali-Swift-Global-Savetime: 1563848991
Age: 892
X-Cache: HIT TCP_MEM_HIT dirn:5:50364804
X-Swift-SaveTime: Tue, 23 Jul 2019 06:34:38 GMT
X-Swift-CacheTime: 1474
Timing-Allow-Origin: *
EagleId: 3df09a1d15638641915385880e

2019/7/23 15:10:58 61.240.154.102 cdnapp.ydtg.com.cn

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
HTTP/1.1 200 OK
Server: Tengine
Content-Type: application/octet-stream
Content-Length: 7
Connection: keep-alive
Date: Tue, 23 Jul 2019 07:10:42 GMT
Last-Modified: Tue, 23 Jul 2019 02:28:58 GMT
ETag: "5d3670ea-7"
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Accept-Ranges: bytes
Via: cache9.l2cn354[25,304-0,H], cache3.l2cn354[25,0], kunlun10.cn1481[107,200-0,H], kunlun8.cn1481[108,0]
Ali-Swift-Global-Savetime: 1563848991
Age: 0
X-Cache: HIT TCP_REFRESH_HIT dirn:5:50364804
X-Swift-SaveTime: Tue, 23 Jul 2019 07:10:42 GMT
X-Swift-CacheTime: 1690
Timing-Allow-Origin: *
EagleId: 3df09a1c15638658425441368e

2019/7/23 15:12:47