【问题标题】:Google cloud CDN, performance testing using apache benchmark谷歌云CDN,使用apache benchmark的性能测试
【发布时间】:2020-04-22 19:08:01
【问题描述】:

我一直在从部署在 Google App Engine 上的 NodeJS 应用程序中提供静态文件,现在我已经设置了启用 CDN 的 Google Cloud 负载均衡器 (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。

【问题讨论】:

    标签: google-app-engine google-cloud-platform apachebench google-cdn


    【解决方案1】:

    听起来您的文件没有被缓存。 Cloud CDN 仅缓存满足cloud.google.com/cdn/docs/caching#cacheability 中列出的条件的响应。您可以使用cloud.google.com/cdn/docs/troubleshooting#responses-not-cached 的故障排除步骤来确定具体问题。如果这没有帮助,如果你分享一个特定的 URL,我很乐意看看。

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

    【讨论】:

    • 对不起,我已经成功地更新了对象 cache-control: public, max-age=2592000 的元数据,现在应该一切都好了吗?
    • 我看到您提到的 URL 现在返回一个 Cache-Control: public,max-age=3600 标头,当我重复请求该文件时,一个 Age 标头表明响应是从缓存中提供的。希望新的 Cache-Control 标头能够提高性能。
    • 谢谢@elving 我会将您的答案标记为已接受,但是您知道测试 CDN 性能的更好方法吗?
    • 您可以在不启用和启用 Cloud CDN 的情况下对其进行测试。这将允许您比较结果。市场上有许多不同的工具可以执行此类测试,您可以按照此处说明的示例进行操作:geekflare.com/google-cloud-cdn-test
    猜你喜欢
    • 2018-12-11
    • 2020-09-10
    • 2022-12-17
    • 1970-01-01
    • 2014-09-09
    • 1970-01-01
    • 1970-01-01
    • 2020-12-31
    • 1970-01-01
    相关资源
    最近更新 更多