Install nginx and php-fpm on Ubuntu

最初に

Ubuntu の nginx はバージョンが古いのですが、PPAで最新の安定版が公式に提供されているので、それを使ったインストールの紹介です。Ubuntu 10.04以上で使えます。またnginxがphp-fpm(というよりPHP5一式)も提供してるので、それも一緒に入れます。

add-apt-repository

ppaを追加する際に add-apt-repository という便利な python のスクリプトがあるので、入ってない場合はそれを入れます。

apt-get install -y python-software-properties

nginx & php-fpm ppa 追加

ppaを追加します。

add-apt-repository ppa:nginx/stable
add-apt-repository ppa:nginx/php5

ここで stable となっている所を development とすることで開発版がインストールされるようになります。 ex) ppa:nginx/development

nginx & php-fpm インストール

apt-get update
apt-get -y install nginx php5-common php5-fpm php-apc

nginx & php-fpm 設定ファイルの場所など

設定ファイルなどは以下の path にインストールされます。

nginx -- /etc/nginx
php-fpm -- /etc/php5/fpm

サーバの起動などは以下の方法で

service nginx {start|stop|restart|reload|force-reload|status|configtest}
service php5-fpm {start|stop|graceful-stop|restart|reload|force-reload}

benchmark of sakura cloud

とっても久しぶりなpostですが、昨日オープンしたさくらのクラウドで取ったベンチマークのまとめです。

まずはCPUから

# cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 44
model name      : Intel(R) Xeon(R) CPU           X5675  @ 3.07GHz
stepping        : 2
cpu MHz         : 3066.282
cache size      : 4096 KB
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx lm constant_tsc up rep_good pni ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm
bogomips        : 6132.56
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

何故かキャッシュサイズが 4096KB

次UnixBenchmarck [site]

========================================================================
   BYTE UNIX Benchmarks (Version 5.1.3)
   System: deny: GNU/Linux
   OS: GNU/Linux -- 2.6.32-33-server -- #72-Ubuntu SMP Fri Jul 29 21:21:55 UTC 2011
   Machine: x86_64 (unknown)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   CPU 0: Intel(R) Xeon(R) CPU X5675 @ 3.07GHz (6132.6 bogomips)
          x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
   17:58:49 up 25 min,  1 user,  load average: 0.67, 0.27, 0.10; runlevel 2
------------------------------------------------------------------------
Benchmark Run: Tue Nov 15 2011 17:58:49 - 18:26:54
1 CPU in system; running 1 parallel copy of tests
Dhrystone 2 using register variables       32161880.3 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     3699.0 MWIPS (9.9 s, 7 samples)
Execl Throughput                               4523.6 lps   (29.6 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks       1103600.9 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          299983.7 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       1968613.5 KBps  (30.0 s, 2 samples)
Pipe Throughput                             2296526.9 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 385379.9 lps   (10.0 s, 7 samples)
Process Creation                              13593.4 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   6283.6 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    816.9 lpm   (60.0 s, 2 samples)
System Call Overhead                        4312489.4 lps   (10.0 s, 7 samples)
System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   32161880.3   2755.9
Double-Precision Whetstone                       55.0       3699.0    672.6
Execl Throughput                                 43.0       4523.6   1052.0
File Copy 1024 bufsize 2000 maxblocks          3960.0    1103600.9   2786.9
File Copy 256 bufsize 500 maxblocks            1655.0     299983.7   1812.6
File Copy 4096 bufsize 8000 maxblocks          5800.0    1968613.5   3394.2
Pipe Throughput                               12440.0    2296526.9   1846.1
Pipe-based Context Switching                   4000.0     385379.9    963.4
Process Creation                                126.0      13593.4   1078.8
Shell Scripts (1 concurrent)                     42.4       6283.6   1482.0
Shell Scripts (8 concurrent)                      6.0        816.9   1361.4
System Call Overhead                          15000.0    4312489.4   2875.0
                                                                   ========
System Benchmarks Index Score                                        1637.7

CPU1コアでこの数字だけど、実はさくらのVPSの1Gと(さくらのVPSの1Gプランの方はコア数が2なせいもあって)ほぼ同じスコアになります。詳細は後述。

sysbench

Operations performed:  6000 Read, 4000 Write, 12800 Other = 22800 Total
Read 93.75Mb  Written 62.5Mb  Total transferred 156.25Mb  (29.244Mb/sec)
 1871.60 Requests/sec executed
Test execution summary:
    total time:                          5.3430s
    total number of events:              10000
    total time taken by event execution: 0.3105
    per-request statistics:
         min:                                  0.00ms
         avg:                                  0.03ms
         max:                                  0.89ms
         approx.  95 percentile:               0.19ms
Threads fairness:
    events (avg/stddev):           10000.0000/0.00
    execution time (avg/stddev):   0.3105/0.00

fio

# fio -filename=/tmp/fiotest -rw=randwrite -bs=1m -numjobs=4 -runtime=10 -size=2G -name=fiotest
fiotest: (g=0): rw=randwrite, bs=1M-1M/1M-1M, ioengine=sync, iodepth=1
...
fiotest: (g=0): rw=randwrite, bs=1M-1M/1M-1M, ioengine=sync, iodepth=1
Starting 4 processes
fiotest: Laying out IO file(s) (1 file(s) / 2048MB)
fiotest: Laying out IO file(s) (1 file(s) / 2048MB)
fiotest: Laying out IO file(s) (1 file(s) / 2048MB)
fiotest: Laying out IO file(s) (1 file(s) / 2048MB)
Jobs: 4 (f=4): [wwww] [100.0% done] [0K/191M /s] [0/187 iops] [eta 00m:00s]
fiotest: (groupid=0, jobs=1): err= 0: pid=31820
  write: io=519168KB, bw=51880KB/s, iops=50, runt= 10007msec
    clat (usec): min=276, max=150442, avg=4519.42, stdev=12369.41
    bw (KB/s) : min=19147, max=235875, per=27.15%, avg=56625.75, stdev=50321.24
  cpu          : usr=0.00%, sys=3.00%, ctx=410, majf=0, minf=34
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued r/w: total=0/507, short=0/0
     lat (usec): 500=30.57%, 750=43.59%, 1000=6.71%
     lat (msec): 2=1.18%, 4=1.18%, 10=3.55%, 20=4.34%, 50=7.50%
     lat (msec): 100=1.18%, 250=0.20%
fiotest: (groupid=0, jobs=1): err= 0: pid=31821
  write: io=520192KB, bw=51658KB/s, iops=50, runt= 10070msec
    clat (usec): min=248, max=249016, avg=4751.07, stdev=14294.25
    bw (KB/s) : min= 7196, max=260096, per=26.86%, avg=56010.82, stdev=54404.52
  cpu          : usr=0.00%, sys=2.98%, ctx=418, majf=0, minf=35
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued r/w: total=0/508, short=0/0
     lat (usec): 250=0.20%, 500=31.30%, 750=43.11%, 1000=5.91%
     lat (msec): 2=0.59%, 4=1.18%, 10=4.13%, 20=2.95%, 50=10.24%
     lat (msec): 100=0.20%, 250=0.20%
fiotest: (groupid=0, jobs=1): err= 0: pid=31822
  write: io=515072KB, bw=51492KB/s, iops=50, runt= 10003msec
    clat (usec): min=259, max=920252, avg=6329.97, stdev=42884.56
    bw (KB/s) : min=15903, max=242366, per=26.81%, avg=55917.94, stdev=53425.02
  cpu          : usr=0.00%, sys=3.00%, ctx=409, majf=0, minf=35
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued r/w: total=0/503, short=0/0
     lat (usec): 500=28.23%, 750=42.94%, 1000=9.54%
     lat (msec): 2=1.19%, 4=0.99%, 10=4.17%, 20=4.17%, 50=7.55%
     lat (msec): 100=0.60%, 250=0.40%, 1000=0.20%
fiotest: (groupid=0, jobs=1): err= 0: pid=31823
  write: io=545792KB, bw=54232KB/s, iops=52, runt= 10064msec
    clat (usec): min=272, max=97136, avg=5865.52, stdev=13435.91
    bw (KB/s) : min=13398, max=201542, per=28.70%, avg=59858.29, stdev=44334.45
  cpu          : usr=0.00%, sys=3.08%, ctx=455, majf=0, minf=35
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued r/w: total=0/533, short=0/0
     lat (usec): 500=31.14%, 750=37.90%, 1000=9.76%
     lat (msec): 2=1.88%, 4=0.75%, 10=3.00%, 20=1.31%, 50=12.38%
     lat (msec): 100=1.88%
Run status group 0 (all jobs):
  WRITE: io=2051MB, aggrb=208562KB/s, minb=52727KB/s, maxb=55533KB/s, mint=10003msec, maxt=10070msec
Disk stats (read/write):
  sda: ios=0/2971, merge=0/391798, ticks=0/1284890, in_queue=1373000, util=98.84%

fioのiopsは143出たという報告あり。→ http://twitter.com/u1/status/136410200168071168

以上がさくらのクラウドのプラン1(メモリ2GB)で取ったベンチマーク。OSはUbuntu10.04.03

比較対象として。linodeの(メモリ768MB CPU4コア)のプラン

まずはUnixBench

========================================================================
   BYTE UNIX Benchmarks (Version 5.1.3)
   System: li378-145: GNU/Linux
   OS: GNU/Linux -- 3.0.4-x86_64-linode21 -- #1 SMP Thu Sep 1 21:28:01 EDT 2011
   Machine: x86_64 (unknown)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   CPU 0: Intel(R) Xeon(R) CPU L5520 @ 2.27GHz (4522.0 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
   CPU 1: Intel(R) Xeon(R) CPU L5520 @ 2.27GHz (4522.0 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
   CPU 2: Intel(R) Xeon(R) CPU L5520 @ 2.27GHz (4522.0 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
   CPU 3: Intel(R) Xeon(R) CPU L5520 @ 2.27GHz (4522.0 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
   04:39:46 up 7 min,  1 user,  load average: 0.69, 0.32, 0.13; runlevel 2
------------------------------------------------------------------------
Benchmark Run: Tue Nov 15 2011 04:39:46 - 05:07:58
4 CPUs in system; running 1 parallel copy of tests
Dhrystone 2 using register variables       20652738.2 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     2655.0 MWIPS (9.9 s, 7 samples)
Execl Throughput                                943.2 lps   (29.7 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        238251.6 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks           64021.0 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks        707924.4 KBps  (30.0 s, 2 samples)
Pipe Throughput                              361265.1 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                  32187.8 lps   (10.0 s, 7 samples)
Process Creation                               1866.9 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   2761.0 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    846.8 lpm   (60.1 s, 2 samples)
System Call Overhead                         398931.6 lps   (10.0 s, 7 samples)
System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   20652738.2   1769.7
Double-Precision Whetstone                       55.0       2655.0    482.7
Execl Throughput                                 43.0        943.2    219.4
File Copy 1024 bufsize 2000 maxblocks          3960.0     238251.6    601.6
File Copy 256 bufsize 500 maxblocks            1655.0      64021.0    386.8
File Copy 4096 bufsize 8000 maxblocks          5800.0     707924.4   1220.6
Pipe Throughput                               12440.0     361265.1    290.4
Pipe-based Context Switching                   4000.0      32187.8     80.5
Process Creation                                126.0       1866.9    148.2
Shell Scripts (1 concurrent)                     42.4       2761.0    651.2
Shell Scripts (8 concurrent)                      6.0        846.8   1411.3
System Call Overhead                          15000.0     398931.6    266.0
                                                                   ========
System Benchmarks Index Score                                         434.3
------------------------------------------------------------------------
Benchmark Run: Tue Nov 15 2011 05:07:58 - 05:36:15
4 CPUs in system; running 4 parallel copies of tests
Dhrystone 2 using register variables       76103552.5 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                    10565.2 MWIPS (9.9 s, 7 samples)
Execl Throughput                               3538.4 lps   (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        325993.1 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks           84263.0 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       1068742.0 KBps  (30.0 s, 2 samples)
Pipe Throughput                             1392137.2 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 206986.2 lps   (10.0 s, 7 samples)
Process Creation                               6835.4 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   7140.5 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    934.2 lpm   (60.1 s, 2 samples)
System Call Overhead                        1455179.6 lps   (10.0 s, 7 samples)
System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   76103552.5   6521.3
Double-Precision Whetstone                       55.0      10565.2   1920.9
Execl Throughput                                 43.0       3538.4    822.9
File Copy 1024 bufsize 2000 maxblocks          3960.0     325993.1    823.2
File Copy 256 bufsize 500 maxblocks            1655.0      84263.0    509.1
File Copy 4096 bufsize 8000 maxblocks          5800.0    1068742.0   1842.7
Pipe Throughput                               12440.0    1392137.2   1119.1
Pipe-based Context Switching                   4000.0     206986.2    517.5
Process Creation                                126.0       6835.4    542.5
Shell Scripts (1 concurrent)                     42.4       7140.5   1684.1
Shell Scripts (8 concurrent)                      6.0        934.2   1557.0
System Call Overhead                          15000.0    1455179.6    970.1
                                                                   ========
System Benchmarks Index Score                                        1166.7

sysbench

Operations performed:  6000 Read, 4000 Write, 12800 Other = 22800 Total
Read 93.75Mb  Written 62.5Mb  Total transferred 156.25Mb  (4.8188Mb/sec)
  308.40 Requests/sec executed
Test execution summary:
    total time:                          32.4252s
    total number of events:              10000
    total time taken by event execution: 31.7999
    per-request statistics:
         min:                                  0.01ms
         avg:                                  3.18ms
         max:                                324.50ms
         approx.  95 percentile:               9.81ms
Threads fairness:
    events (avg/stddev):           10000.0000/0.00
    execution time (avg/stddev):   31.7999/0.00

fio

# fio -filename=/tmp/fiotest -rw=randwrite -bs=1m -numjobs=4 -runtime=10 -size=2G -name=fiotest
fiotest: (g=0): rw=randwrite, bs=1M-1M/1M-1M, ioengine=sync, iodepth=1
...
fiotest: (g=0): rw=randwrite, bs=1M-1M/1M-1M, ioengine=sync, iodepth=1
Starting 4 processes
fiotest: Laying out IO file(s) (1 file(s) / 2048MB)
fiotest: Laying out IO file(s) (1 file(s) / 2048MB)
fiotest: Laying out IO file(s) (1 file(s) / 2048MB)
fiotest: Laying out IO file(s) (1 file(s) / 2048MB)
Jobs: 4 (f=4): [wwww] [100.0% done] [0K/64946K /s] [0/61 iops] [eta 00m:00s]
fiotest: (groupid=0, jobs=1): err= 0: pid=20163
  write: io=194560KB, bw=19363KB/s, iops=18, runt= 10048msec
    clat (usec): min=372, max=546595, avg=23210.35, stdev=83499.02
    bw (KB/s) : min= 1615, max=37838, per=23.85%, avg=18786.33, stdev=11578.50
  cpu          : usr=0.02%, sys=5.90%, ctx=372, majf=0, minf=50
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued r/w: total=0/190, short=0/0
     lat (usec): 500=1.58%, 750=6.32%, 1000=1.58%
     lat (msec): 2=54.21%, 4=25.26%, 10=1.58%, 20=0.53%, 50=0.53%
     lat (msec): 100=1.05%, 250=4.74%, 500=1.58%, 750=1.05%
fiotest: (groupid=0, jobs=1): err= 0: pid=20164
  write: io=261120KB, bw=25980KB/s, iops=25, runt= 10051msec
    clat (usec): min=375, max=524381, avg=16840.41, stdev=67674.65
    bw (KB/s) : min= 1698, max=124121, per=33.53%, avg=26403.20, stdev=29522.64
  cpu          : usr=0.04%, sys=8.09%, ctx=245, majf=0, minf=56
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued r/w: total=0/255, short=0/0
     lat (usec): 500=2.35%, 750=3.92%, 1000=1.96%
     lat (msec): 2=55.29%, 4=25.88%, 10=2.35%, 20=0.78%, 50=1.18%
     lat (msec): 100=0.78%, 250=3.92%, 500=0.78%, 750=0.78%
fiotest: (groupid=0, jobs=1): err= 0: pid=20165
  write: io=120832KB, bw=12022KB/s, iops=11, runt= 10051msec
    clat (usec): min=377, max=848149, avg=20751.66, stdev=88815.04
    bw (KB/s) : min= 1479, max=24576, per=15.31%, avg=12056.00, stdev=7905.31
  cpu          : usr=0.03%, sys=3.75%, ctx=374, majf=0, minf=44
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued r/w: total=0/118, short=0/0
     lat (usec): 500=3.39%, 750=12.71%, 1000=3.39%
     lat (msec): 2=34.75%, 4=28.81%, 10=5.08%, 20=0.85%, 50=4.24%
     lat (msec): 100=0.85%, 250=4.24%, 500=0.85%, 1000=0.85%
fiotest: (groupid=0, jobs=1): err= 0: pid=20166
  write: io=215040KB, bw=21395KB/s, iops=20, runt= 10051msec
    clat (usec): min=392, max=546273, avg=22945.53, stdev=74787.55
    bw (KB/s) : min= 3075, max=48828, per=28.20%, avg=22205.53, stdev=14610.97
  cpu          : usr=0.03%, sys=6.02%, ctx=558, majf=0, minf=49
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued r/w: total=0/210, short=0/0
     lat (usec): 500=1.43%, 750=4.76%, 1000=2.86%
     lat (msec): 2=52.86%, 4=24.29%, 10=2.38%, 20=0.95%, 100=1.90%
     lat (msec): 250=5.71%, 500=2.38%, 750=0.48%
Run status group 0 (all jobs):
  WRITE: io=791552KB, aggrb=78753KB/s, minb=12310KB/s, maxb=26603KB/s, mint=10048msec, maxt=10051msec
Disk stats (read/write):
  xvda: ios=4/15635, merge=0/146469, ticks=927/1353853, in_queue=1355597, util=96.10%

こんな結果になりました。ベンチマークの結果だけからみるとDiskのI/Oはかなり高いです。比較としてLinodeを出してますが、AWSと比較してもかなり差のある内容になってます。
ただ、惜しむらくはCPUとメモリのバランスが悪く、コア数が1個からスタートとなってる関係でおなじさくらのサービスのVPSとのスコア差があまりないことです。比較対象としてさくらのVPSの1GプランでのUbuntu10.04.03で取ったUnixBenchを以下に掲げます。コア単体で見ると差があるのですが、さくらのVPSの1Gプランではコア数が2個あるので、あまり差がなくなっているという実例です。

========================================================================
   BYTE UNIX Benchmarks (Version 5.1.3)
   System: www1265ua: GNU/Linux
   OS: GNU/Linux -- 2.6.32-35-server -- #78-Ubuntu SMP Tue Oct 11 16:26:12 UTC 2011
   Machine: x86_64 (unknown)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   CPU 0: Intel(R) Core(TM)2 Duo CPU T7700 @ 2.40GHz (5320.2 bogomips)
          x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
   CPU 1: Intel(R) Core(TM)2 Duo CPU T7700 @ 2.40GHz (5320.2 bogomips)
          x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
   07:06:58 up 4 min,  1 user,  load average: 0.19, 0.08, 0.02; runlevel 2
------------------------------------------------------------------------
Benchmark Run: Wed Nov 16 2011 07:06:58 - 07:35:06
2 CPUs in system; running 1 parallel copy of tests
Dhrystone 2 using register variables       22323202.2 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     2914.1 MWIPS (9.3 s, 7 samples)
Execl Throughput                               2799.8 lps   (29.8 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        690055.3 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          176939.9 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       1321715.3 KBps  (30.0 s, 2 samples)
Pipe Throughput                             1555110.2 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 225403.2 lps   (10.0 s, 7 samples)
Process Creation                               3744.4 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   3602.4 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    768.7 lpm   (60.1 s, 2 samples)
System Call Overhead                        2898149.9 lps   (10.0 s, 7 samples)
System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   22323202.2   1912.9
Double-Precision Whetstone                       55.0       2914.1    529.8
Execl Throughput                                 43.0       2799.8    651.1
File Copy 1024 bufsize 2000 maxblocks          3960.0     690055.3   1742.6
File Copy 256 bufsize 500 maxblocks            1655.0     176939.9   1069.1
File Copy 4096 bufsize 8000 maxblocks          5800.0    1321715.3   2278.8
Pipe Throughput                               12440.0    1555110.2   1250.1
Pipe-based Context Switching                   4000.0     225403.2    563.5
Process Creation                                126.0       3744.4    297.2
Shell Scripts (1 concurrent)                     42.4       3602.4    849.6
Shell Scripts (8 concurrent)                      6.0        768.7   1281.2
System Call Overhead                          15000.0    2898149.9   1932.1
                                                                   ========
System Benchmarks Index Score                                        1017.6
------------------------------------------------------------------------
Benchmark Run: Wed Nov 16 2011 07:35:06 - 08:03:26
2 CPUs in system; running 2 parallel copies of tests
Dhrystone 2 using register variables       37531494.7 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     5377.5 MWIPS (9.5 s, 7 samples)
Execl Throughput                               4728.0 lps   (29.8 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        627224.0 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          168733.3 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       1619935.4 KBps  (30.0 s, 2 samples)
Pipe Throughput                             2224671.7 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 397639.7 lps   (10.0 s, 7 samples)
Process Creation                              15574.1 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   6185.0 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    885.9 lpm   (60.1 s, 2 samples)
System Call Overhead                        4321788.1 lps   (10.0 s, 7 samples)
System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   37531494.7   3216.1
Double-Precision Whetstone                       55.0       5377.5    977.7
Execl Throughput                                 43.0       4728.0   1099.5
File Copy 1024 bufsize 2000 maxblocks          3960.0     627224.0   1583.9
File Copy 256 bufsize 500 maxblocks            1655.0     168733.3   1019.5
File Copy 4096 bufsize 8000 maxblocks          5800.0    1619935.4   2793.0
Pipe Throughput                               12440.0    2224671.7   1788.3
Pipe-based Context Switching                   4000.0     397639.7    994.1
Process Creation                                126.0      15574.1   1236.0
Shell Scripts (1 concurrent)                     42.4       6185.0   1458.7
Shell Scripts (8 concurrent)                      6.0        885.9   1476.5
System Call Overhead                          15000.0    4321788.1   2881.2
                                                                   ========
System Benchmarks Index Score                                        1563.0

ちなみにこのさくらのVPSの1GプランではDiskが2つに別れて提供されているため、LVMで1つにまとめているので、LVMを使わない設定でインストールするとまた数字が変わるかもしれません

node.js + express + haml install on ubuntu 10.10

少し出遅れてる感バリバリですが、node.jsをUbuntu 10.10@さくらVPSに入れてみた。
node.jsのWebフレームワークのexpressとテンプレート言語hamlで構成してみた。
hamlを選んだ理由は慣れてるから。というそれだけです。

まず必要なもののチェック。
公式によると python 2.4以上とlibssl-devが必要とのことなので、それぞれをチェック。
まず、Python

$ python --version
2.6.6

OK

次にlibssl-dev。これは入れてなかったら sudo apt-get install libssl-dev で入れます。

$ dpkg -l libssl-dev
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
ii  libssl-dev     0.9.8o-1ubuntu SSL development libraries, header files and 

ではインストール。
他の環境を汚染したく無いのもあって、/opt/nodejs 以下にインストールすることにしたので、適宜読み替えて下さい。

$ wget http://nodejs.org/dist/node-v0.4.1.tar.gz
$ tar -zxf node-v0.4.1.tar.gz
$ cd node-v0.4.1
$ ./configure --prefix=/opt/nodejs
$ make
$ sudo make install 

インストールが終わったので、prefixとして指定した /opt/nodejs/bin を環境変数PATHに設定

$ export PATH=/opt/nodejs/bin:$PATH 

パッケージマネージャのnpmをインストール。
※ sudo のみだと環境変数の受け継ぎが出来ないので -i を忘れずに。

$ curl http://npmjs.org/install.sh | sudo -i sh 

次は express とhaml だけど、npmで入れるときにはhamlではなくてhamljsと公式に書いてあるので、その通りに。

$ sudo -i npm install express hamljs 

以上でインストールは終了。

次はすごく簡単なサンプルの作成。
まずサンプル用のディレクトリの作成して、ディレクトリ移動。

$ mkdir -p hello/views
$ cd hello

そして以下のコードを hello.js として作成。

var express = require('express');
var app     = express.createServer();
app.get('/', function(req, res) {
    res.render('index.hamljs', {
        layout: false
    });
});
app.listen(3000);
console.log('running at port 3000');

次はviewテンプレート。views/index.hamljs として作成。

%html
  %head
    %title hello node.js!
  %body
    %hello
      hello node.js

作成後保存したら、そのままのディレクトリで

 $ node hello.js 

とすることで
hello node.js
とだけ書かれたものが表示されるはず。

後、viewテンプレートの拡張子が .hamljs というものになってるけど、それを .haml にしたい場合は以下のコードを hello.js の2行目に追加すればいい。

app.register('.haml', require('hamljs'));

github service hooks on lingr

Webチャットの Lingr で github の service hooks を使って post push 出来るようになったのでそのまとめ。
前提条件として、チャットルームのオーナーに作業してもらう必要があるのと、対象の github の Repository の admin ページへのアクセス権がある事が必要となります。

それでは以下方法。

1.チャットルームオーナーに github という bot を召喚してもらう
 http://lingr.com/room/[Room ID]/manage/github で ‘invite now!’ をクリック
 ※ チャットルーム一覧の detail → manage → github でも飛べます。

2.github の Repository の admin ページで Post-Receive URL を追加
 https://github.com/[User ID]/[Repository ID]/admin で
  Service Hooks → Post-Receive URLs をクリック
 URLに http://lingr.heroku.com/github/[Room ID] を追加して ‘Update Settings’

 他の部屋にも追加したい場合には、適宜RoomIDを変更したURLを追加していくことで対応可能なようです。

この設定を行う事で対象の Repository に変化があった場合には、召喚した github の bot が変更点を発言するようになります。

share link added.

ご多分にもれずというかやっとというか、Tweetするリンク、はてブするリンク、イイネするリンクを加えてみた。
若干見栄えが変かもしれないけれど、そこは追々頑張る方向でw

後他に何か書くことがあったと思ったんだけど、忘れたのでまたの機会に・・・