Google cloud storage 谷歌云存储TTFB随gzip增长

Google cloud storage 谷歌云存储TTFB随gzip增长,google-cloud-storage,google-cloud-platform,Google Cloud Storage,Google Cloud Platform,当我使用gsutil cp-z js、css、html将资产上传到云存储时, 然后他们的TTFB(到第一个字节的时间)从~20ms增加到180ms 这对性能影响很大。为什么会发生这种情况?如何解决 以下是更多示例(如果您想亲自尝试,URL仍然有效): gzip文件的卷曲输出: $ curl -s -v https://storage.googleapis.com/latencytest/test.txt > /dev/null * Trying 2a00:1450:400e:805:

当我使用
gsutil cp-z js、css、html
将资产上传到云存储时, 然后他们的TTFB(到第一个字节的时间)从~20ms增加到180ms

这对性能影响很大。为什么会发生这种情况?如何解决

以下是更多示例(如果您想亲自尝试,URL仍然有效):

gzip文件的卷曲输出:

$ curl -s -v https://storage.googleapis.com/latencytest/test.txt > /dev/null
*   Trying 2a00:1450:400e:805::2010...
* Connected to storage.googleapis.com (2a00:1450:400e:805::2010) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.storage.googleapis.com
* Server certificate: Google Internet Authority G2
* Server certificate: GeoTrust Global CA
> GET /latencytest/test.txt HTTP/1.1
> Host: storage.googleapis.com
> User-Agent: curl/7.43.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< X-GUploader-UploadID: AEnB2UpBZ1SoG2fiD3_qSOmIWWvL86Kd-r21kXOS08UlvMOc90Eco-vd3ol3NnwDrkJKwKk7zav0ePdp9QYXm7lt4NdV39h-VQ
< Date: Tue, 17 Jan 2017 20:44:19 GMT
< Cache-Control: no-transform
< Expires: Wed, 17 Jan 2018 20:44:19 GMT
< Last-Modified: Mon, 16 Jan 2017 13:46:54 GMT
< ETag: "88b49948e59eaad05d60a52001b50d7a"
< x-goog-generation: 1484574414392000
< x-goog-metageneration: 2
< x-goog-stored-content-encoding: gzip
< x-goog-stored-content-length: 145
< Content-Type: text/plain
< Content-Encoding: gzip
< Content-Language: en
< x-goog-hash: crc32c=MlL4Uw==
< x-goog-hash: md5=iLSZSOWeqtBdYKUgAbUNeg==
< x-goog-storage-class: STANDARD
< Accept-Ranges: bytes
< Server: UploadServer
< Alt-Svc: quic=":443"; ma=2592000; v="35,34"
< Transfer-Encoding: chunked
< 
{ [261 bytes data]
* Connection #0 to host storage.googleapis.com left intact
$curl-s-vhttps://storage.googleapis.com/latencytest/test.txt >/dev/null
*正在尝试2a00:1450:400e:805::2010。。。
*已连接到storage.googleapis.com(2a00:1450:400e:805::2010)端口443(#0)
*使用TLS_ECDHE_RSA_和_AES_128_GCM_SHA256的TLS 1.2连接
*服务器证书:*.storage.googleapis.com
*服务器证书:Google Internet Authority G2
*服务器证书:GeoTrust全局CA
>GET/latencytest/test.txt HTTP/1.1
>主持人:storage.googleapis.com
>用户代理:curl/7.43.0
>接受:*/*
> 
正如我们所了解的,
缓存控制:no transform,public
解决了这个问题。

这在您的帖子中并不明确,但我假设下载请求不包含“Accept Encoding:gzip”请求头。这将导致gzip编码被动态删除(这必然会增加延迟).Cf.我不这么认为,请参阅我的最新编辑,其中包含来自Curl的标题。我看到,您设置了缓存控制:无转换(这将阻止gunzipping)。从本地尝试这些URL时,看起来非Gzip版本被分块(传输编码)。我必须多看一看堆栈的哪一部分可以做到这一点。同时,您是否尝试过使用http而不是https进行a/b测试?使用http时,结果与使用httpsOk时的结果相同,我可以在本地复制这一结果。您看到了这一差异,因为原始响应会被缓存(查找Age响应头),但gzip对象没有,因为它正在重写缓存控制指令。请尝试将其设置为“no transform,public”,延迟应与-raw对象的延迟相匹配
$ curl -s -v https://storage.googleapis.com/latencytest/test.txt > /dev/null
*   Trying 2a00:1450:400e:805::2010...
* Connected to storage.googleapis.com (2a00:1450:400e:805::2010) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.storage.googleapis.com
* Server certificate: Google Internet Authority G2
* Server certificate: GeoTrust Global CA
> GET /latencytest/test.txt HTTP/1.1
> Host: storage.googleapis.com
> User-Agent: curl/7.43.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< X-GUploader-UploadID: AEnB2UpBZ1SoG2fiD3_qSOmIWWvL86Kd-r21kXOS08UlvMOc90Eco-vd3ol3NnwDrkJKwKk7zav0ePdp9QYXm7lt4NdV39h-VQ
< Date: Tue, 17 Jan 2017 20:44:19 GMT
< Cache-Control: no-transform
< Expires: Wed, 17 Jan 2018 20:44:19 GMT
< Last-Modified: Mon, 16 Jan 2017 13:46:54 GMT
< ETag: "88b49948e59eaad05d60a52001b50d7a"
< x-goog-generation: 1484574414392000
< x-goog-metageneration: 2
< x-goog-stored-content-encoding: gzip
< x-goog-stored-content-length: 145
< Content-Type: text/plain
< Content-Encoding: gzip
< Content-Language: en
< x-goog-hash: crc32c=MlL4Uw==
< x-goog-hash: md5=iLSZSOWeqtBdYKUgAbUNeg==
< x-goog-storage-class: STANDARD
< Accept-Ranges: bytes
< Server: UploadServer
< Alt-Svc: quic=":443"; ma=2592000; v="35,34"
< Transfer-Encoding: chunked
< 
{ [261 bytes data]
* Connection #0 to host storage.googleapis.com left intact