Amazon S3使ってみた

今更ながら使ってみた。
Amazon Simple Storage Service

サーバのDiskが週に1Gとか日に1Gとか普通に埋まっていくのでなんとかしたい。

概念的に増やしたい!願ったり感じたり信じたりすると増えるみたいのが欲しい。
容量とか気にしなくて良いし、物理的に増設していくのも疲れるからね。

実際に使ってみる

S3Foxを使ってブラウザで管理。S3Foxでファイルの追加とかもできるけど、めんどくさいのでそこはCUIで!

Amazon S3用のコマンドラインツールs3cmd

s3cmd --configure
# ...いろいろ設定...

s3cmd ls
s3cmd ls s3://hoge
s3cmd put test.csv s3://hoge

こんなURLでアクセスできる。

http://hoge.s3.amazonaws.com/test.csv

以下をTrueにしておくと誰でも閲覧可能に

$ vim .s3cfg 
acl_public = True

さくさく動いて楽しいかも。

ApacheBenchとってみた

他でも計測している人がいましたが一応。1.15Mのファイルを"ab -n 100 -c 10"で計測

$ ab -n 100 -c 10 http://hoge.s3.amazonaws.com/test.csv
:
Document Length:        1214170 bytes

Concurrency Level:      10
Time taken for tests:   76.210336 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      121456000 bytes
HTML transferred:       121417000 bytes
Requests per second:    1.31 [#/sec] (mean)
Time per request:       7621.033 [ms] (mean)
Time per request:       762.103 [ms] (mean, across all concurrent requests)
Transfer rate:          1556.34 [Kbytes/sec] received
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:      138  153  13.4    162     172
Processing:  2112 7149 1347.2   7362    9166
Waiting:      146  167  16.2    171     207
Total:       2284 7303 1351.6   7502    9336

Amazon CloudFrontも使ってみました。同様に計測
CloudFront

$ ab -n 100 -c 10 http://xxxxxx.cloudfront.net/text.csv
:
Document Length:        1214170 bytes

Concurrency Level:      10
Time taken for tests:   24.979753 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      121474600 bytes
HTML transferred:       121417000 bytes
Requests per second:    4.00 [#/sec] (mean)
Time per request:       2497.975 [ms] (mean)
Time per request:       249.798 [ms] (mean, across all concurrent requests)
Transfer rate:          4748.93 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       23   72 300.8     41    3046
Processing:   442 2354 2155.8   1244    8813
Waiting:       24   57  59.1     43     349
Total:        467 2427 2202.8   1270    8836

時間や混みぐあいで変わってくるようですが、どうでしょう。