RTTの違い
自宅のサーバからのそれぞれのping。
$ ping slicehost
:
10 packets transmitted, 10 received, 0% packet loss, time 9000ms
rtt min/avg/max/mdev = 167.817/168.212/168.930/0.350 ms
$ ping sakura
:
10 packets transmitted, 10 received, 0% packet loss, time 8995ms
rtt min/avg/max/mdev = 23.060/24.275/25.002/0.637 ms
slicehostの168msに対してsakuraが24ms。
スタティックなページでリクエストを行った場合
自宅からそれぞれrails上のページにアクセスを行う。
$ ab -n10 "http://slice/..."
:
Concurrency Level: 1
Time taken for tests: 10.484864 seconds
Complete requests: 10
Failed requests: 0
Write errors: 0
Total transferred: 681050 bytes
HTML transferred: 678240 bytes
Requests per second: 0.95 [#/sec] (mean)
Time per request: 1048.486 [ms] (mean)
Time per request: 1048.486 [ms] (mean, across all concurrent requests)
Transfer rate: 63.42 [Kbytes/sec] received
$ ab -n10 "http://sakura/..."
:
Concurrency Level: 1
Time taken for tests: 3.87220 seconds
Complete requests: 10
Failed requests: 0
Write errors: 0
Total transferred: 680920 bytes
HTML transferred: 678240 bytes
Requests per second: 3.24 [#/sec] (mean)
Time per request: 308.722 [ms] (mean)
Time per request: 308.722 [ms] (mean, across all concurrent requests)
Transfer rate: 215.08 [Kbytes/sec] received
個別の応答に対してはRTTが小さい方=sakuraが有利。
CPUの違い
slicehost(月額$20)のCPU
$ cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 15
model : 65
model name : Dual-Core AMD Opteron(tm) Processor 2212
stepping : 2
cpu MHz : 2010.300
cache size : 1024 KB
が4発。メモリは256MB。
sakura(月額7,800円)のCPU
$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 22
model name : Intel(R) Celeron(R) CPU 220 @ 1.20GHz
stepping : 1
cpu MHz : 1200.104
cache size : 512 KB
が1発。メモリは1GB。
わざと処理の重いページへリクエストを行った場合
rails上のsqlite3に対してselectを行う処理をpassengerを用いたapache2に向かって行う。
$ ab -n10 "http://slice/..."
:
Concurrency Level: 1
Time taken for tests: 32.187805 seconds
Complete requests: 10
Failed requests: 0
Write errors: 0
Total transferred: 1670090 bytes
HTML transferred: 1664720 bytes
Requests per second: 0.31 [#/sec] (mean)
Time per request: 3218.781 [ms] (mean)
Time per request: 3218.781 [ms] (mean, across all concurrent requests)
Transfer rate: 50.64 [Kbytes/sec] received
$ ab -n10 "http://sakura/..."
:
Concurrency Level: 1
Time taken for tests: 33.390847 seconds
Complete requests: 10
Failed requests: 0
Write errors: 0
Total transferred: 1669850 bytes
HTML transferred: 1664720 bytes
Requests per second: 0.30 [#/sec] (mean)
Time per request: 3339.085 [ms] (mean)
Time per request: 3339.085 [ms] (mean, across all concurrent requests)
Transfer rate: 48.82 [Kbytes/sec] received
3倍の差がなくなっている。
次は10並列でリクエストを行ってみる。
$ ab -n10 -c10 "http://slice/..."
:
不能
$ ab -n10 -c10 "http://sakura/..."
:
Concurrency Level: 10
Time taken for tests: 29.537597 seconds
Complete requests: 10
Failed requests: 0
Write errors: 0
Total transferred: 1669856 bytes
HTML transferred: 1664720 bytes
Requests per second: 0.34 [#/sec] (mean)
Time per request: 29537.598 [ms] (mean)
Time per request: 2953.760 [ms] (mean, across all concurrent requests)
Transfer rate: 55.18 [Kbytes/sec] received
sakuraは耐え切るがslicehostはダウン。
デフォルトのpassengerではダメかもしれない。