SSD的IO性能優于HDD,特别是随機IO。現在用的PC裡就有一塊普通硬碟(WD3200AAJS)和一塊SSD(OCZ-VERTEX4),下面實際測一下,它們在作為資料庫存儲時的表現。
一,測試環境
CPU:Intel Core2 DuoCPU E7500 @2.93GHz
MEM:2G DDR3
OS: Win XP
DB:PostgreSQL 9.1.6
二,性能資料
WD3200AAJS:

OCZ-VERTEX4:
這台PC比較老,還是IDE接口,嚴重限制了OCZ-VERTEX4的潛能,但性能比起WD3200AAJS已經相當優越了。
三,pgbench測試資料
使用PostgreSQL的預設配置進行測試。結果顯示,在最考驗随機寫入的測試(transaction type: TPC-B,scaling factor: 300)中,WD3200AAJS的tps為44,OCZ-VERTEX4的tps為775。
C:\Documents and Settings\chj>pgbench -c 50 -j 10 -t 100 -S pgdb100
starting vacuum...end.
transaction type: SELECT only
scaling factor: 100
query mode: simple
number of clients: 50
number of threads: 10
number of transactions per client: 100
number of transactions actually processed: 5000/5000
tps = 2319.326503 (including connections establishing)
tps = 6457.962531 (excluding connections establishing)
C:\Documents and Settings\chj>pgbench -c 50 -j 10 -t 100 pgdb100
transaction type: TPC-B (sort of)
tps = 178.538523 (including connections establishing)
tps = 186.534720 (excluding connections establishing)
scaling factor: 300
tps = 72.010603 (including connections establishing)
tps = 75.560511 (excluding connections establishing)
tps = 43.564647 (including connections establishing)
tps = 44.129713 (excluding connections establishing)
C:\Documents and Settings\chj>pgbench -p 9100 -c 50 -j 10 -t 100 -S pgdb1
scaling factor: 1
tps = 2305.247430 (including connections establishing)
tps = 7798.504410 (excluding connections establishing)
C:\Documents and Settings\chj>pgbench -p 9100 -c 50 -j 10 -t 100 pgdb1
tps = 565.058589 (including connections establishing)
tps = 666.951735 (excluding connections establishing)
C:\Documents and Settings\chj>pgbench -p 9100 -c 50 -j 10 -t 100 -S pgdb300
tps = 1989.756480 (including connections establishing)
tps = 5504.493891 (excluding connections establishing)
C:\Documents and Settings\chj>pgbench -p 9100 -c 50 -j 10 -t 100 pgdb300
tps = 613.481048 (including connections establishing)
tps = 775.337927 (excluding connections establishing)
C:\Documents and Settings\chj>pgbench -p 9100 -c 50 -j 10 -t 1000 -S pgdb300
number of transactions per client: 1000
number of transactions actually processed: 50000/50000
tps = 3481.141102 (including connections establishing)
tps = 4090.565401 (excluding connections establishing)
跑下面這個測試時,CPU 占用100%,瓶頸已是CPU了。
C:\Documents and Settings\chj>pgbench -p 9100 -c 50 -j 10 -t 1000 -S pgdb1
tps = 5727.081326 (including connections establishing)
tps = 7352.381685 (excluding connections establishing)