pgpool
March 15, 2008
replicate by pgpool
>> 構成
pgpool - 192.168.0.50
master - 192.168.0.11
secondary - 192.168.0.16
プライマリキーで取得するSELECTを3回発行するプログラム。
プライマリキーは1〜100000の中からランダムに生成。
データは10万件。
パフォーマンスが変わらずフェイルオーバーできるというのは結構良いかもしれない。
pgpool - 192.168.0.50
master - 192.168.0.11
secondary - 192.168.0.16
$ vi /usr/local/pgpool/etc/pgpool.conf listen_address = '192.168.0.50' port = 5433 backend_host_name = '192.168.0.11' backend_port = 5432 secondary_backend_host_name = '192.168.0.16' secondary_backend_port = 5432 replication_mode = true load_balance_mode = true>> ベンチマーク
プライマリキーで取得するSELECTを3回発行するプログラム。
プライマリキーは1〜100000の中からランダムに生成。
データは10万件。
$ ab -n 500 -c 100 -k http://www.example.com/testapp[ 単一サーバ(192.168.0.11) ]
Requests per second: 247.18 [#/sec] Time per request: 4.046 [ms] Requests per second: 273.41 [#/sec] Time per request: 3.658 [ms] Requests per second: 269.48 [#/sec] Time per request: 3.711 [ms][ load barancing & connection pooling ]
Requests per second: 261.33 [#/sec] Time per request: 3.827 [ms] Requests per second: 261.51 [#/sec] Time per request: 3.824 [ms] Requests per second: 256.63 [#/sec] Time per request: 3.897 [ms]後者の方が気持ち速いが、ほとんど変わらず。コネクションプーリングによるパフォーマンス向上がバランサ(というかpgpool自体)のオーバーヘッドで相殺されている感じ。
パフォーマンスが変わらずフェイルオーバーできるというのは結構良いかもしれない。
February 28, 2008
pgpool - connection pooling
$ tar zxvf pgpool-3.4.1.tar.gz $ cd pgpool-3.4.1 $ ./configure \ --prefix=/usr/local/pgpool \ --with-pgsql=/usr/local/pgsql $ make && make install $ cd /usr/local/pgpool/etc $ cp pgpool.conf.sample pgpool.conf $ vi pgpool.conf listen_address = '192.168.0.50' port = 5433 backend_port = 5432 enable_pool_hba = true num_init_children = 10 max_pool = 20 $ cp pool_hba.conf.sample pool_hba.conf $ vi pool_hba.conf host all all 192.168.0.0/24 trust
$ ../bin/pgpool -n &
--- Benchmark ---
$ ab -n 500 -c 100 -k http://www.example.com/testapp[ PostgreSQL-8.3.0 ]
Requests per second: 127.55 [#/sec] Time per request: 7.840 [ms][ PostgreSQL-8.3.0 (connection pooling) ]
Requests per second: 181.14 [#/sec] Time per request: 5.521 [ms][ MySQL-5.0.41 ]
Requests per second: 186.16 [#/sec] Time per request: 5.372 [ms]