2014-12-07 164 views
0

對於亞馬遜S3存儲桶中的圖像,我開始體驗到不尋常的長響應時間(15s)。大部分時間用於等待。我在Heroku上運行。來自亞馬遜S3存儲桶的響應時間很長

這是阿帕奇基準結果:

Server Software:  AmazonS3 
Server Hostname:  bucket-name.s3.amazonaws.com 
Server Port:   80 

Document Path:   /4e846e6fb34c9490_unnamed.png 
Document Length:  118768 bytes 

Concurrency Level:  1 
Time taken for tests: 81.125 seconds 
Complete requests:  10 
Failed requests:  0 
Total transferred:  1191510 bytes 
HTML transferred:  1187680 bytes 
Requests per second: 0.12 [#/sec] (mean) 
Time per request:  8112.487 [ms] (mean) 
Time per request:  8112.487 [ms] (mean, across all concurrent requests) 
Transfer rate:   14.34 [Kbytes/sec] received 

Connection Times (ms) 
       min mean[+/-sd] median max 
Connect:  8 10 2.6  10  17 
Processing: 567 8102 7884.7 15572 15597 
Waiting:  294 7807 7901.0 15297 15311 
Total:  577 8112 7885.7 15581 15614 

Percentage of the requests served within a certain time (ms) 
    50% 15581 
    66% 15586 
    75% 15587 
    80% 15598 
    90% 15614 
    95% 15614 
    98% 15614 
    99% 15614 
100% 15614 (longest request) 

而且請求頭

Remote Address:54.231.15.17:80 
Request URL:http://bucket-name.s3.amazonaws.com/8118c4f0a203c368_roadmapimage.png 
Request Method:GET 
Status Code:200 OK 
Request Headers 
Accept:image/webp,*/*;q=0.8 
Accept-Encoding:gzip,deflate,sdch 
Accept-Language:en-US,en;q=0.8,he;q=0.6 
Cache-Control:no-cache 
Connection:keep-alive 
Host:bucket-name.s3.amazonaws.com 
Pragma:no-cache 
Referer:http://app-name.herokuapp.com/public/prism/7814? token=48890cb264&[email protected]&fn=lili&ln=test922 
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)  Chrome/38.0.2125.111 Safari/537.36 
Response Headers 
Accept-Ranges:bytes 
Content-Length:577016 
Content-Type:image/png 
Date:Sun, 07 Dec 2014 13:23:11 GMT 
ETag:"3709113ba6efc237617eda7e64afac89" 
Last-Modified:Sat, 06 Dec 2014 00:52:29 GMT 
Server:AmazonS3 
x-amz-id-2:UeaGp+Ahxb2M4XQTFCZ3HHSYNend6RvO1QowbUzMJtyd82NyS7yrp86mydu23mYI 
x-amz-request-id:70FD6E3158B45C6B 
+0

嘗試指定完整的端點URL,http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region – Anatoly 2014-12-12 23:02:44

回答

0

與亞馬遜的支持下無盡的會談結束後,沒有一個真正的解決方案的任何進步,許多失望的客戶,解決方法是添加一個CDN,其原點指向S3存儲桶。它極大地改善了延遲。

這不是問題的直接解決方案,但它是反正靜態資產的正確方法。