docker/Container VM on Google Compute EngineでPostgresqlのベンチマークを実施。
主にディスク容量と性能の傾向を確認したかったため、PostgreSQLの設定はDocker Hubの公式postgresイメージのまま、fsyncなどの同期書込はON、shared_buffersのRAMはどちらのインスタンスも128MBの固定設定です。
pgbenchのオプションは下記コマンドのとおり同時接続100、各100トランザクションで負荷をかけています。
root@e60c69431508:/# pgbench -hpg -Upostgres test -c 100 -t 100
starting vacuum…end.
transaction type: TPC-B (sort of)
scaling factor: 1
query mode: simple
number of clients: 100
number of threads: 1
number of transactions per client: 100
number of transactions actually processed: 10000/10000
latency average: 0.000 ms
所感
詳細な結果はケース別に次項以降にまとめました。
全体的な傾向をまとめると、もっともI/O性能の低いboot disk 10GBと標準ディスク500GBを追加したケースではWrite/Readとも差が出ない結果となりました。
インスタンスの比較では、n1-standard-1とf1-microでは書き込みで4〜5倍程度の差が出た一方、読み込みではインスタンス間の差が出ませんでした。
データ量にもよりますが、Read主体のワークロードではf-microでもそれなりに性能が出る印象です。
おそらくWriteの負荷上昇に伴ってボトルネックが表面化してくるシナリオが有力で、インスタンスのスケールアップによって性能増強を図れることが確認できました。
一方で、HDDベースの標準persistent diskの容量追加は性能向上に効果がなさそうです。
書き込み
f1-micro (Mem: 0.6GB) / boot disk 10GB
tps = 80.841250 (including connections establishing)
tps = 83.149923 (including connections establishing)
tps = 82.109601 (including connections establishing)
tps = 83.125874 (including connections establishing)
f1-micro / 500GB
tps = 75.616331 (including connections establishing)
tps = 78.950646 (including connections establishing)
tps = 76.546447 (including connections establishing)
n1-standard-1 (Mem: 3.75GB) / boot disk
tps = 372.459940 (including connections establishing)
tps = 372.944099 (including connections establishing)
tps = 382.998644 (including connections establishing)
tps = 384.216893 (including connections establishing)
n1-standard-1 / 500GB
tps = 376.897808 (including connections establishing)
tps = 384.871191 (including connections establishing)
tps = 354.138272 (including connections establishing)
読み込み(-Sオプション付き)
f1-micro / boot disk
tps = 3742.257270 (including connections establishing)
tps = 3921.910064 (including connections establishing)
tps = 4236.988315 (including connections establishing)
tps = 4142.150314 (including connections establishing)
f1-micro / 500GB
tps = 3866.146283 (including connections establishing)
tps = 1088.733880 (including connections establishing)
tps = 4000.420844 (including connections establishing)
tps = 4095.775617 (including connections establishing)
n1-standard-1 / boot disk
tps = 3846.881795 (including connections establishing)
tps = 4196.148104 (including connections establishing)
tps = 4251.252419 (including connections establishing)
tps = 4163.677493 (including connections establishing)
n1-standard-1 / 500GB
tps = 3865.812992 (including connections establishing)
tps = 4158.239302 (including connections establishing)
tps = 3912.187049 (including connections establishing)
Chuma Takahiro