Google 云 CDN,使用 apache 基准进行性能测试

Google cloud CDN, performance testing using apache benchmark

我一直在从部署在 Google App Engine 上的 NodeJS 应用程序提供静态文件,我现在设置了一个启用了 CDN 的 Google 云负载平衡器 (GCLB) 并移动了我的静态文件到后端使用的云存储桶中。

整个过程运行良好,但问题是使用 Apache Benchmark 测试时性能没有提高。

正在测试 1000 个请求,并发级别为 100:

Document Length:        748366 bytes

Concurrency Level:      100
Time taken for tests:   37.069 seconds
Complete requests:      1000
Failed requests:        1
   (Connect: 0, Receive: 0, Length: 1, Exceptions: 0)
Total transferred:      748686041 bytes
HTML transferred:       747940252 bytes
Requests per second:    26.98 [#/sec] (mean)
Time per request:       3706.873 [ms] (mean)
Time per request:       37.069 [ms] (mean, across all concurrent requests)
Transfer rate:          19723.87 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0  446 748.1    261    9033
Processing:   397 2920 2407.1   2252   17769
Waiting:       31   85 109.7     56    1595
Total:        444 3366 2578.2   2665   18986

Percentage of the requests served within a certain time (ms)
  50%   2665
  66%   3702
  75%   4410
  80%   4937
  90%   6504
  95%   8125
  98%  10853
  99%  13447
 100%  18986 (longest request)

正在测试 1000 个请求,并发级别为 10:

Document Length:        748366 bytes

Concurrency Level:      10
Time taken for tests:   35.386 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      749112083 bytes
HTML transferred:       748366000 bytes
Requests per second:    28.26 [#/sec] (mean)
Time per request:       353.863 [ms] (mean)
Time per request:       35.386 [ms] (mean, across all concurrent requests)
Transfer rate:          20673.37 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       20   74  96.3     41     757
Processing:    98  278 159.5    240    2165
Waiting:       30   59  67.0     49    1915
Total:        135  352 196.6    290    2201

Percentage of the requests served within a certain time (ms)
  50%    290
  66%    334
  75%    381
  80%    442
  90%    577
  95%    742
  98%    935
  99%   1152
 100%   2201 (longest request)

我预计并发级别不会显着增加处理请求所花费的时间。也许我以某种方式误读了这些结果?

需要注意的另一个(相关)问题是 CDN 缓存命中在 Google LB UI.

中显示为 0

听起来您的文件没有被缓存。 Cloud CDN 仅缓存满足 cloud.google.com/cdn/docs/caching#cacheability. You can use the troubleshooting steps at cloud.google.com/cdn/docs/troubleshooting#responses-not-cached 中列出的条件的响应以识别特定问题。如果这没有帮助,如果您分享具体的 URL,我很乐意看一看。

您可能知道,ab 并不是评估 CDN 性能的最现实的方法,您会 运行 在遇到云中的任何瓶颈之前很久就在本地计算机上遇到瓶颈CDN 本身。如果您使用 ab,请确保指定 -k 选项。如果不这样做,您可以 运行 离开临时端口。