PHPのフォーマット(serialize, json, msgpack)と圧縮の速度と圧縮後のサイズの考察

これをすこし発展させたものを書きました。もはやこちらの内容は古いものです。
こちらを参照してください。


どのぐらい違うものかと調べたくなったので。。。

1から10万までの連番の整数の文字列のarrayをserializeしたもの、jsonにしたもの、msgpackにしたものを圧縮したのに掛かった時間(10回計測してその平均)と、どの程度圧縮されたかを示しました。

PHPには、gzcompress、gzdeflate、gzencodeとありますがこれらは内部のアルゴリズムは全て同じで、おそらく圧縮後のフォーマット(たとえば圧縮効率がどれぐらいとかchecksumなど)が異なるだけだと思います。

ついでにlzf_compressも試してみました。

総評としては、圧縮率と圧縮速度を考えて、msgpack + gzcompress (level: 1)が良さそうですね。圧縮率だけ考えると、serialized arrayのgzcompress (level: 5 ~ 8)が一番ですが、↑の3倍の時間が掛かっています。

もっとも、この手の単純な大量計算はPHPでやるものではないでしょうけれど。Cで書けば速度はこの1/10にはなるのではないでしょうか。

注意点として、lzf_compressメソッドを使うために、sudo pecl install lzfとして、php.iniにextension=lzf.soを書き加えてください。msgpackもそれが必要でなおかつ、$ pecl install channel://pecl.php.net/msgpack-0.5.5 が必要です。

マシン環境ですが、
– Celeron G540
– 8GBDRAM * 2
– Ubuntu 12.04 Server AMD64 (Linux Kernel 3.2.0-44-generic)
– PHP 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli) (built: Mar 11 2013 14:31:48)
です。

結果:

$ php comparison.php 
Format and Compression Comparison in PHP
	preparing an array with 1000000 elements... (length :17777798)

***** Serialized Array compression *****
	algos: gzcompress, lzf_compress
		- gzcompress (level: 0):            0.09324 [sec], length: 17780514
		- gzcompress (level: 1):            0.19323 [sec], length: 3947366
		- gzcompress (level: 2):            0.22423 [sec], length: 3925097
		- gzcompress (level: 3):            0.35222 [sec], length: 3857219
		- gzcompress (level: 4):            0.29440 [sec], length: 1923394
		- gzcompress (level: 5):            0.31053 [sec], length: 1437421
		- gzcompress (level: 6):            0.70175 [sec], length: 1437447
		- gzcompress (level: 7):            1.44658 [sec], length: 1437426
		- gzcompress (level: 8):            6.92879 [sec], length: 1437422
		- gzcompress (level: 9):            20.95299 [sec], length: 1437424
		- lzf_compress:                     0.02713 [sec], length: 5190546

***** JSON compression *****
	algos: gzcompress, lzf_compress
		- gzcompress (level: 0):            0.03458 [sec], length: 6889953
		- gzcompress (level: 1):            0.10100 [sec], length: 2193396
		- gzcompress (level: 2):            0.11473 [sec], length: 2119096
		- gzcompress (level: 3):            0.18489 [sec], length: 1714361
		- gzcompress (level: 4):            0.15276 [sec], length: 2149816
		- gzcompress (level: 5):            0.27074 [sec], length: 2110256
		- gzcompress (level: 6):            0.38511 [sec], length: 2114881
		- gzcompress (level: 7):            0.45583 [sec], length: 2114870
		- gzcompress (level: 8):            0.56130 [sec], length: 2115066
		- gzcompress (level: 9):            0.56164 [sec], length: 2115066
		- lzf_compress:                     0.01735 [sec], length: 3886227

***** msgpack compression *****
	algos: gzcompress, lzf_compress
		- gzcompress (level: 0):            0.02396 [sec], length: 4869299
		- gzcompress (level: 1):            0.10216 [sec], length: 1553360
		- gzcompress (level: 2):            0.11604 [sec], length: 2135224
		- gzcompress (level: 3):            0.17005 [sec], length: 2136888
		- gzcompress (level: 4):            0.13453 [sec], length: 2130423
		- gzcompress (level: 5):            0.25608 [sec], length: 2130374
		- gzcompress (level: 6):            0.74529 [sec], length: 2130347
		- gzcompress (level: 7):            1.35402 [sec], length: 2130301
		- gzcompress (level: 8):            3.41562 [sec], length: 2130289
		- gzcompress (level: 9):            10.65018 [sec], length: 2130289
		- lzf_compress:                     0.01736 [sec], length: 3944350

ソースコード
<?php

echo "Format and Compression Comparison in PHP\n";

$max_array_element = 100 * 10000;
$repeat = 3;
$arry = array();
for ($i = 1; $i <= $max_array_element; $i++) {
	$arry[] = $i;
}
$target = serialize($arry);
echo "\tpreparing an array with " . $max_array_element . " elements... (length :" . strlen($target) . ")\n";

echo "\n***** Serialized Array compression *****\n";
echo "\talgos: gzcompress, lzf_compress\n";

for ($j = 0; $j <= 9; $j++) {
	$start = microtime(true);
	for ($i = 0; $i < $repeat; $i++) {
		$compressed = gzcompress($target, $j);
	}
	printf("\t\t- gzcompress (level: " . $j . "):            %.5f [sec], length: %d\n", (double) (microtime(true) - $start) / (double) $repeat, strlen(($compressed)));
}

$start = microtime(true);
for ($i = 0; $i < $repeat; $i++) {
	$compressed = lzf_compress($target);
}
printf("\t\t- lzf_compress:                     %.5f [sec], length: %d\n", (double) (microtime(true) - $start) / (double) $repeat, strlen(($compressed)));

echo "\n***** JSON compression *****\n";
$target = json_encode($arry);
echo "\talgos: gzcompress, lzf_compress\n";

for ($j = 0; $j <= 9; $j++) {
        $start = microtime(true);
        for ($i = 0; $i < $repeat; $i++) {
                $compressed = gzcompress($target, $j);
        }
        printf("\t\t- gzcompress (level: " . $j . "):            %.5f [sec], length: %d\n", (double) (microtime(true) - $start) / (double) $repeat, strlen(($compressed)));
}

$start = microtime(true);
for ($i = 0; $i < $repeat; $i++) {
        $compressed = lzf_compress($target);
}
printf("\t\t- lzf_compress:                     %.5f [sec], length: %d\n", (double) (microtime(true) - $start) / (double) $repeat, strlen(($compressed)));


echo "\n***** msgpack compression *****\n";
$target = msgpack_serialize($arry);
echo "\talgos: gzcompress, lzf_compress\n";

for ($j = 0; $j <= 9; $j++) {
        $start = microtime(true);
        for ($i = 0; $i < $repeat; $i++) {
                $compressed = gzcompress($target, $j);
        }
        printf("\t\t- gzcompress (level: " . $j . "):            %.5f [sec], length: %d\n", (double) (microtime(true) - $start) / (double) $repeat, strlen(($compressed)));
}

$start = microtime(true);
for ($i = 0; $i < $repeat; $i++) {
        $compressed = lzf_compress($target);
}
printf("\t\t- lzf_compress:                     %.5f [sec], length: %d\n", (double) (microtime(true) - $start) / (double) $repeat, strlen(($compressed)));
?>

敷き布団にカビが生えていたので布団を購入

東京生活2年目に入りましたが、敷き布団を敷きっぱなしにしていたら裏地にカビが生えていました。。。
布団をたたんだり干したりするのには合理性があるようですorz
寝て起きたら布団を椅子に立てかけるなどする必要がありますね。。。

それに最近頭痛と体調不良が続いており、カビ布団が原因ではないかと思い、購入することにしました。

ベッドのマットレスはあまり変えたりする印象がありませんが、上記の事を考慮すると、カビているものが多いのでは。



これを買いました。5980円+送料で、まだ届いていないのであとでレビューします。

追記@2013年6月2日

届きました。非常に厚いです。iPhone4(5ではありません)の長い方と同じぐらい?
以前のカビぶとんはビニール袋に入れて自宅に放置です。どうやって捨てるのでしょう。。。
寝心地は良かったです。送料込み6800円(関東)を考えて満足です。
前回のカビぶとんの反省を踏まえ、カビが生えないよう、起きたら立てかけて空気の通りを良くしておくようにしています。

Debianな環境でPHPでMongoDBにアクセスするための環境作り

http://alexborisov.org/setting-up-mongodb-and-php-on-debianubuntu/

↑この通りやったらうまくいきました。まとめると、

sudo apt-get install php5 php5-dev php5-cli php-pear
sudo pecl install mongo

# ↓この両方に、extension=mongo.so を追加。
vi /etc/php5/apache2/php.ini
vi /etc/php5/cli/php.ini

/etc/init.d/apache2 restart

ですね。peclを使うのがもっとも良いのかは分かりません。

Ubuntu 12.04 Server AMD64をVNCサーバーにする

先日8コアCPUが9980円で売っていて我慢できず買ってしまったので、VirtualBoxでVMでも作って並列計算の評価でもしてみようかと、VNCサーバーを立てようと思ったわけです。VirtualBoxは基本的にGUI、そしてマシンをいちいちモニタに接続するのは面倒なのでVNCを検討しました。ちなみにコマンドラインで使えるVagrantはなんかネットワークの設定がいまいち感あるので、実直にVirtualBoxを使います。

# vncserver用ユーザーを作ります。自宅鯖ならrootでもいいと思いますが。
$ sudo adduser vncuser
$ su vncuser

# ↓ or, tasksel と打って、Ubuntu Desktop を選択
$ sudo aptitude install gnome-core

# vncserverをインストール
$ sudo aptitude install vnc4server

# vncserverの設定です。↓を打つとパスワード等求められます。
$ vncserver

# ↓設定ファイルを編集します。↓を使えば、VNCクライアントからGUIが開くと思います(私の環境では開きます)。
$ vi .vnc/xstartup
-----
#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER

# VNCで繋いだとき、"Could not acquire name on session bus"と出るときの対策↓
unset DBUS_SESSION_BUS_ADDRESS

#exec /etc/X11/xinit/xinitrc
gnome-session --session=gnome-classic &

# ↑でだめなら↑をコメントアウトしてから、↓を有効にしてみてください。
# gnome-session --session=ubuntu-2d &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
#x-terminal-emulator -geometry 1280x1024+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
-----

# vncserverのstop。「:1」は、1番目のデスクトップという意味のようです。
$ vncserver -kill :1

# vncserverの起動
$ vncserver
(or vncserver :5 ←5番目のデスクトップで起動)

# iptables等で、5901を開けます。2番目のデスクトップであれば5902を開けます。

# boot時に自動的に起動するよう設定します。
$ vi /etc/init.d/vncserver
-----
#!/bin/sh -e
### BEGIN INIT INFO
# Provides:          vncserver
# Required-Start:    networking
# Default-Start:     S
# Default-Stop:      0 6
### END INIT INFO

PATH="$PATH:/usr/X11R6/bin/"

# The Username:Group that will run VNC
export USER="vncuser"
#${RUNAS}

# The display that VNC will use
DISPLAY="1"

# Color depth (between 8 and 32)
DEPTH="16"

# The Desktop geometry to use.
#GEOMETRY="<WIDTH>x<HEIGHT>"
#GEOMETRY="800x600"
GEOMETRY="1024x768"
#GEOMETRY="1280x1024"

# The name that the VNC Desktop will have.
NAME="my-vnc-server"

OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"

. /lib/lsb/init-functions

case "$1" in
start)
log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
;;

stop)
log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
;;

restart)
$0 stop
$0 start
;;
esac

exit 0
-----

$ sudo chmod 777 /etc/init.d/vncserver
$ sudo update-rc.d vncserver defaults

VNCクライアントから
「vnc://192.168.1.2:5901」
などとして起動します。

ところでvncserverとvnc4serverというコマンドがあり、どちらでも動くのですが、違いが分かりません。
ちらっと調べてみましたが、md5sumは一緒ですね。一緒のコマンドをたくさん見せないで欲しいですね。たとえばlsコマンドが、ls1, ls2, ls3,… ls1872209317892319281098308 などと合ったら嫌じゃないですか。選択肢の多さはUIを損ねる場合がほとんどなのですがね。
root@ratta:/usr/bin# md5sum ./vnc4server 
b57c46161c4e0a2a6c5f016a7fbf7259  ./vnc4server

root@ratta:/usr/bin# md5sum ./vncserver 
b57c46161c4e0a2a6c5f016a7fbf7259  ./vncserver

root@ratta:/usr/bin# ls -l ./vnc4server 
-rwxr-xr-x 1 root root 19402 Feb  6  2012 ./vnc4server

root@ratta:/usr/bin# ls -l ./vncserver 
lrwxrwxrwx 1 root root 27 May 11 22:19 ./vncserver -> /etc/alternatives/vncserver

いろいろなマシンをひたすらUnixBench!

何はともあれUnixbenchというわけでいろいろなマシンを測定して行きたいと思います。そのうち表にする予定です。

インストール方法

# Ubuntu版
$ sudo apt-get install libx11-dev libgl1-mesa-dev libxext-dev perl perl-modules make gcc
$ wget http://byte-unixbench.googlecode.com/files/UnixBench5.1.3.tgz
$ tar zxvf UnixBench5.1.3.tgz
$ cd UnixBench/
$ ./Run

# コア数だけ走らせる場合 (↓は論理8コアの場合)
$ ./Run -c 8

富士通安鯖
# スペック
- Opteron 3280
- DDR3-1600 8GB * 2
- Seagate HDD (250GB)
- Ubuntu 12.04 Server AMD64
- ベンチマーク中の消費電力: 50 ~ 100W

========================================================================
   BYTE UNIX Benchmarks (Version 5.1.3)

   System: koratta: GNU/Linux
   OS: GNU/Linux -- 3.5.0-28-generic -- #48~precise1-Ubuntu SMP Wed Apr 24 21:42:24 UTC 2013
   Machine: x86_64 (x86_64)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   CPU 0: AMD Opteron(tm) Processor 3280  (4800.3 bogomips)
          Hyper-Threading, x86-64, MMX, AMD MMX, Physical Address Ext, SYSENTER/SYSEXIT, AMD virtualization, SYSCALL/SYSRET
   CPU 1: AMD Opteron(tm) Processor 3280  (4800.3 bogomips)
          Hyper-Threading, x86-64, MMX, AMD MMX, Physical Address Ext, SYSENTER/SYSEXIT, AMD virtualization, SYSCALL/SYSRET
   CPU 2: AMD Opteron(tm) Processor 3280  (4800.3 bogomips)
          Hyper-Threading, x86-64, MMX, AMD MMX, Physical Address Ext, SYSENTER/SYSEXIT, AMD virtualization, SYSCALL/SYSRET
   CPU 3: AMD Opteron(tm) Processor 3280  (4800.3 bogomips)
          Hyper-Threading, x86-64, MMX, AMD MMX, Physical Address Ext, SYSENTER/SYSEXIT, AMD virtualization, SYSCALL/SYSRET
   CPU 4: AMD Opteron(tm) Processor 3280  (4800.3 bogomips)
          Hyper-Threading, x86-64, MMX, AMD MMX, Physical Address Ext, SYSENTER/SYSEXIT, AMD virtualization, SYSCALL/SYSRET
   CPU 5: AMD Opteron(tm) Processor 3280  (4800.3 bogomips)
          Hyper-Threading, x86-64, MMX, AMD MMX, Physical Address Ext, SYSENTER/SYSEXIT, AMD virtualization, SYSCALL/SYSRET
   CPU 6: AMD Opteron(tm) Processor 3280  (4800.3 bogomips)
          Hyper-Threading, x86-64, MMX, AMD MMX, Physical Address Ext, SYSENTER/SYSEXIT, AMD virtualization, SYSCALL/SYSRET
   CPU 7: AMD Opteron(tm) Processor 3280  (4800.3 bogomips)
          Hyper-Threading, x86-64, MMX, AMD MMX, Physical Address Ext, SYSENTER/SYSEXIT, AMD virtualization, SYSCALL/SYSRET
   03:09:50 up 8 min,  2 users,  load average: 0.09, 0.09, 0.06; runlevel 2

------------------------------------------------------------------------
Benchmark Run: Sat May 04 2013 03:09:50 - 03:38:02
8 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       23588261.7 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     3422.1 MWIPS (9.4 s, 7 samples)
Execl Throughput                               1003.5 lps   (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        499148.0 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          150065.6 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       1094465.4 KBps  (30.0 s, 2 samples)
Pipe Throughput                             1039061.3 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                  38372.2 lps   (10.0 s, 7 samples)
Process Creation                               2730.5 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   3239.4 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   2383.6 lpm   (60.0 s, 2 samples)
System Call Overhead                        1596258.2 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   23588261.7   2021.3
Double-Precision Whetstone                       55.0       3422.1    622.2
Execl Throughput                                 43.0       1003.5    233.4
File Copy 1024 bufsize 2000 maxblocks          3960.0     499148.0   1260.5
File Copy 256 bufsize 500 maxblocks            1655.0     150065.6    906.7
File Copy 4096 bufsize 8000 maxblocks          5800.0    1094465.4   1887.0
Pipe Throughput                               12440.0    1039061.3    835.3
Pipe-based Context Switching                   4000.0      38372.2     95.9
Process Creation                                126.0       2730.5    216.7
Shell Scripts (1 concurrent)                     42.4       3239.4    764.0
Shell Scripts (8 concurrent)                      6.0       2383.6   3972.6
System Call Overhead                          15000.0    1596258.2   1064.2
                                                                   ========
System Benchmarks Index Score                                         757.2

------------------------------------------------------------------------
Benchmark Run: Sat May 04 2013 03:38:02 - 04:06:18
8 CPUs in system; running 8 parallel copies of tests

Dhrystone 2 using register variables      108673107.0 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                    21298.7 MWIPS (8.6 s, 7 samples)
Execl Throughput                              14565.8 lps   (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        266857.4 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks           74602.3 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks        832326.7 KBps  (30.0 s, 2 samples)
Pipe Throughput                             4746083.5 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 784386.1 lps   (10.0 s, 7 samples)
Process Creation                              34255.4 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                  27554.4 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   3800.0 lpm   (60.0 s, 2 samples)
System Call Overhead                         866417.9 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0  108673107.0   9312.2
Double-Precision Whetstone                       55.0      21298.7   3872.5
Execl Throughput                                 43.0      14565.8   3387.4
File Copy 1024 bufsize 2000 maxblocks          3960.0     266857.4    673.9
File Copy 256 bufsize 500 maxblocks            1655.0      74602.3    450.8
File Copy 4096 bufsize 8000 maxblocks          5800.0     832326.7   1435.0
Pipe Throughput                               12440.0    4746083.5   3815.2
Pipe-based Context Switching                   4000.0     784386.1   1961.0
Process Creation                                126.0      34255.4   2718.7
Shell Scripts (1 concurrent)                     42.4      27554.4   6498.7
Shell Scripts (8 concurrent)                      6.0       3800.0   6333.4
System Call Overhead                          15000.0     866417.9    577.6
                                                                   ========
System Benchmarks Index Score                                        2331.1

ラボにあるi7-3820鯖
# スペック
- i7-3820
- DDR3-1600 8GB * 4 (4channelのはず)
- 480GB SSD
- Ubuntu 12.04 Server AMD64

========================================================================
   BYTE UNIX Benchmarks (Version 5.1.3)

   System: elab-i7-3820: GNU/Linux
   OS: GNU/Linux -- 3.5.0-23-generic -- #35~precise1-Ubuntu SMP Fri Jan 25 17:13:26 UTC 2013
   Machine: x86_64 (x86_64)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   CPU 0: Intel(R) Core(TM) i7-3820 CPU @ 3.60GHz (6400.6 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   CPU 1: Intel(R) Core(TM) i7-3820 CPU @ 3.60GHz (6400.6 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   CPU 2: Intel(R) Core(TM) i7-3820 CPU @ 3.60GHz (6400.6 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   CPU 3: Intel(R) Core(TM) i7-3820 CPU @ 3.60GHz (6400.6 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   CPU 4: Intel(R) Core(TM) i7-3820 CPU @ 3.60GHz (6400.6 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   CPU 5: Intel(R) Core(TM) i7-3820 CPU @ 3.60GHz (6400.6 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   CPU 6: Intel(R) Core(TM) i7-3820 CPU @ 3.60GHz (6400.6 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   CPU 7: Intel(R) Core(TM) i7-3820 CPU @ 3.60GHz (6400.6 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   20:07:37 up 42 min,  2 users,  load average: 0.35, 0.43, 0.34; runlevel 2

------------------------------------------------------------------------

Benchmark Run: Tue May 07 2013 20:07:37 - 20:36:28
8 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       45917361.3 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     3386.6 MWIPS (14.8 s, 7 samples)
Execl Throughput                               1597.5 lps   (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks       1605545.3 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          443519.9 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       3350493.6 KBps  (30.0 s, 2 samples)
Pipe Throughput                             2702435.2 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                  47747.8 lps   (10.0 s, 7 samples)
Process Creation                               5231.9 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   4707.1 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   5679.1 lpm   (60.0 s, 2 samples)
System Call Overhead                        5174236.0 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   45917361.3   3934.6
Double-Precision Whetstone                       55.0       3386.6    615.8
Execl Throughput                                 43.0       1597.5    371.5
File Copy 1024 bufsize 2000 maxblocks          3960.0    1605545.3   4054.4
File Copy 256 bufsize 500 maxblocks            1655.0     443519.9   2679.9
File Copy 4096 bufsize 8000 maxblocks          5800.0    3350493.6   5776.7
Pipe Throughput                               12440.0    2702435.2   2172.4
Pipe-based Context Switching                   4000.0      47747.8    119.4
Process Creation                                126.0       5231.9    415.2
Shell Scripts (1 concurrent)                     42.4       4707.1   1110.2
Shell Scripts (8 concurrent)                      6.0       5679.1   9465.2
System Call Overhead                          15000.0    5174236.0   3449.5
                                                                   ========
System Benchmarks Index Score                                        1567.8

------------------------------------------------------------------------
Benchmark Run: Tue May 07 2013 20:36:28 - 21:04:34
8 CPUs in system; running 8 parallel copies of tests

Dhrystone 2 using register variables      192402968.2 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                    35025.3 MWIPS (10.1 s, 7 samples)
Execl Throughput                              35202.9 lps   (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks       1717323.4 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          449259.6 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       3939931.5 KBps  (30.0 s, 2 samples)
Pipe Throughput                            13087484.9 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                2284579.6 lps   (10.0 s, 7 samples)
Process Creation                              95776.5 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                  60777.3 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   8157.3 lpm   (60.0 s, 2 samples)
System Call Overhead                       10979273.4 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0  192402968.2  16487.0
Double-Precision Whetstone                       55.0      35025.3   6368.2
Execl Throughput                                 43.0      35202.9   8186.7
File Copy 1024 bufsize 2000 maxblocks          3960.0    1717323.4   4336.7
File Copy 256 bufsize 500 maxblocks            1655.0     449259.6   2714.6
File Copy 4096 bufsize 8000 maxblocks          5800.0    3939931.5   6793.0
Pipe Throughput                               12440.0   13087484.9  10520.5
Pipe-based Context Switching                   4000.0    2284579.6   5711.4
Process Creation                                126.0      95776.5   7601.3
Shell Scripts (1 concurrent)                     42.4      60777.3  14334.3
Shell Scripts (8 concurrent)                      6.0       8157.3  13595.4
System Call Overhead                          15000.0   10979273.4   7319.5
                                                                   ========
System Benchmarks Index Score                                        7719.6

# 感想
i7-3820は、Opteron 3280と比較すると、Singleで2倍、Multiで3倍程度の差が出ていますね。
さすがi7という感じです。

AM3マシン
- Sempron 145
- DDR3-1600 4GB * 2
- HDD 1TB (Hitachi HDT72101)
- Ubuntu 12.04 Server AMD64

# uname -a
Linux ratta 3.2.0-41-generic #66-Ubuntu SMP Thu Apr 25 03:27:11 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

# dd if=/dev/zero of=/dev/null bs=100K count=100000
100000+0 records in
100000+0 records out
10240000000 bytes (10 GB) copied, 1.52631 s, 6.7 GB/s

# dd if=/dev/zero of=deleteme bs=32M count=100
100+0 records in
100+0 records out
3355443200 bytes (3.4 GB) copied, 30.4661 s, 110 MB/s

@2013-05-29
通称鼻毛鯖、でやってみました。
- Celeron G540
- 8GB * 2 DRAM
- c206チップセット
- 500GBHDD
- Ubuntu 12.04 AMD64 Server

# uname -a
Linux pikachu 3.2.0-44-generic #69-Ubuntu SMP Thu May 16 17:35:01 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

# cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.2 LTS"

# dd if=/dev/zero of=/dev/null bs=100K count=100000
100000+0 records in
100000+0 records out
20480000000 bytes (20 GB) copied, 1.32821 s, 15.4 GB/s

# dd if=/dev/zero of=deleteme bs=32M count=1000
1000+0 records in
1000+0 records out
33554432000 bytes (34 GB) copied, 229.981 s, 146 MB/s

# ./Run
========================================================================
   BYTE UNIX Benchmarks (Version 5.1.3)

   System: pikachu: GNU/Linux
   OS: GNU/Linux -- 3.2.0-44-generic -- #69-Ubuntu SMP Thu May 16 17:35:01 UTC 2013
   Machine: x86_64 (x86_64)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   CPU 0: Intel(R) Celeron(R) CPU G540 @ 2.50GHz (4988.4 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   CPU 1: Intel(R) Celeron(R) CPU G540 @ 2.50GHz (4988.4 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   07:40:05 up 0 min,  1 user,  load average: 0.04, 0.01, 0.01; runlevel 2

------------------------------------------------------------------------
Benchmark Run: Wed May 29 2013 07:40:05 - 08:08:20
2 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       28901598.5 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     3152.7 MWIPS (10.0 s, 7 samples)
Execl Throughput                               2464.5 lps   (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        892632.8 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          283914.9 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       2312702.7 KBps  (30.0 s, 2 samples)
Pipe Throughput                             1833565.7 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 108612.8 lps   (10.0 s, 7 samples)
Process Creation                               8960.3 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   5995.2 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   1798.4 lpm   (60.0 s, 2 samples)
System Call Overhead                        3243409.1 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   28901598.5   2476.6
Double-Precision Whetstone                       55.0       3152.7    573.2
Execl Throughput                                 43.0       2464.5    573.1
File Copy 1024 bufsize 2000 maxblocks          3960.0     892632.8   2254.1
File Copy 256 bufsize 500 maxblocks            1655.0     283914.9   1715.5
File Copy 4096 bufsize 8000 maxblocks          5800.0    2312702.7   3987.4
Pipe Throughput                               12440.0    1833565.7   1473.9
Pipe-based Context Switching                   4000.0     108612.8    271.5
Process Creation                                126.0       8960.3    711.1
Shell Scripts (1 concurrent)                     42.4       5995.2   1414.0
Shell Scripts (8 concurrent)                      6.0       1798.4   2997.3
System Call Overhead                          15000.0    3243409.1   2162.3
                                                                   ========
System Benchmarks Index Score                                        1337.3

------------------------------------------------------------------------
Benchmark Run: Wed May 29 2013 08:08:20 - 08:36:36
2 CPUs in system; running 2 parallel copies of tests

Dhrystone 2 using register variables       57566542.3 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     6303.0 MWIPS (10.0 s, 7 samples)
Execl Throughput                               8556.3 lps   (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks       1194989.1 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          337696.0 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       3173010.0 KBps  (30.0 s, 2 samples)
Pipe Throughput                             3639121.4 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 625365.2 lps   (10.0 s, 7 samples)
Process Creation                              27208.2 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                  13502.8 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   1833.7 lpm   (60.0 s, 2 samples)
System Call Overhead                        5071688.5 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   57566542.3   4932.9
Double-Precision Whetstone                       55.0       6303.0   1146.0
Execl Throughput                                 43.0       8556.3   1989.8
File Copy 1024 bufsize 2000 maxblocks          3960.0    1194989.1   3017.6
File Copy 256 bufsize 500 maxblocks            1655.0     337696.0   2040.5
File Copy 4096 bufsize 8000 maxblocks          5800.0    3173010.0   5470.7
Pipe Throughput                               12440.0    3639121.4   2925.3
Pipe-based Context Switching                   4000.0     625365.2   1563.4
Process Creation                                126.0      27208.2   2159.4
Shell Scripts (1 concurrent)                     42.4      13502.8   3184.6
Shell Scripts (8 concurrent)                      6.0       1833.7   3056.1
System Call Overhead                          15000.0    5071688.5   3381.1
                                                                   ========
System Benchmarks Index Score                                        2655.8

薄毛鯖に、中古で購入したi5-3470Sを入れたもの↓
– 薄毛鯖
– i5-3470S
– 2GB*2
– 500GB HDD
– G540: 2655.8、 i7-3820: 7719 points の中間ぐらいのスコア(5608)
– 平常時は約22.5W、ピーク時60W程度
========================================================================
   BYTE UNIX Benchmarks (Version 5.1.3)

   System: sakura-ubuntu: GNU/Linux
   OS: GNU/Linux -- 4.4.0-62-generic -- #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017
   Machine: x86_64 (x86_64)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   CPU 0: Intel(R) Core(TM) i5-3470S CPU @ 2.90GHz (5786.9 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   CPU 1: Intel(R) Core(TM) i5-3470S CPU @ 2.90GHz (5786.9 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   CPU 2: Intel(R) Core(TM) i5-3470S CPU @ 2.90GHz (5786.9 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   CPU 3: Intel(R) Core(TM) i5-3470S CPU @ 2.90GHz (5786.9 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   20:54:44 up  1:07,  1 user,  load average: 0.64, 1.12, 1.96; runlevel 2017-02-05

------------------------------------------------------------------------
Benchmark Run: 日  2月 05 2017 20:54:44 - 21:22:55
4 CPUs in system; running 4 parallel copies of tests

Dhrystone 2 using register variables      142311789.1 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                    15526.1 MWIPS (9.9 s, 7 samples)
Execl Throughput                              22357.9 lps   (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks       1456629.5 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          379472.8 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       4155745.2 KBps  (30.0 s, 2 samples)
Pipe Throughput                            10293781.0 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                1510369.2 lps   (10.0 s, 7 samples)
Process Creation                              59771.8 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                  38956.6 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   4818.8 lpm   (60.0 s, 2 samples)
System Call Overhead                       12284722.6 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0  142311789.1  12194.7
Double-Precision Whetstone                       55.0      15526.1   2822.9
Execl Throughput                                 43.0      22357.9   5199.5
File Copy 1024 bufsize 2000 maxblocks          3960.0    1456629.5   3678.4
File Copy 256 bufsize 500 maxblocks            1655.0     379472.8   2292.9
File Copy 4096 bufsize 8000 maxblocks          5800.0    4155745.2   7165.1
Pipe Throughput                               12440.0   10293781.0   8274.7
Pipe-based Context Switching                   4000.0    1510369.2   3775.9
Process Creation                                126.0      59771.8   4743.8
Shell Scripts (1 concurrent)                     42.4      38956.6   9187.9
Shell Scripts (8 concurrent)                      6.0       4818.8   8031.3
System Call Overhead                          15000.0   12284722.6   8189.8
                                                                   ========
System Benchmarks Index Score                                        5608.6