[pgpool-general-jp: 1364] pgpool-IIのパフォーマンスについて

Masaaki Nishio tohma777 @ gmail.com
2015年 3月 25日 (水) 22:32:21 JST


クヌギと申します。
現在pgpoolの利用を検討しており、検証を行っております。

検証において、pgbenchを使用して計測を行ったのですが、
pgpoolを経由した場合、postgresqlへ直接した方が数値として
良い結果が出ている状況です。

pgpoolを経由させる方が、パフォーマンスがでるものと予想していいましたが、
その通りとはいきませんでした。

設定等を確認して、調整を行っていますが、ネットを検索して
パラメータの指定を変更して確認していますが、状況が改善されませんでした。

このような状況の場合、どの設定を変更するのが有効かご教示いただければと
思い、投稿いたしました。

検証環境は、以下の仮想サーバ3台で検証しています。

・CentOS 6.6 x86_64
・Memory 1GB
・PostgreSQL 9.3.6
・pgpool-II 3.4.1

PostgreSQLは3台のストリーミングレプリケーション構成となっています。

PostgreSQLの設定で変更した箇所は以下になります。

・postgresql.conf
=============================================
listen_addresses = '*'
port = 5433
max_connections = 100
shared_buffers = 384MB
work_mem = 4MB
maintenance_work_mem = 64MB
wal_level = hot_standby
synchronous_commit = local
checkpoint_segments = 12
checkpoint_timeout = 15min
checkpoint_completion_target = 0.3
max_wal_senders = 3
synchronous_standby_names = 'slave1,slave2'
hot_standby = on
random_page_cost = 2.0
effective_cache_size = 512MB
autovacuum_naptime = 10min
autovacuum_vacuum_threshold = 1000
autovacuum_analyze_threshold = 1000
deadlock_timeout = 100s
=============================================

pgpoolの設定は以下のようになっています。
なお、マスタは、backend_hostname0になります。
=============================================
・pgpool.conf
listen_addresses = '*'
port = 9979
socket_dir = '/tmp'
pcp_port = 9898
pcp_socket_dir = '/tmp'
backend_hostname0 = '192.168.10.57'
backend_port0 = 5433
backend_weight0 = 0
backend_data_directory0 = '/var/lib/pgsql/9.3/data'
backend_flag0 = 'DISALLOW_TO_FAILOVER'
backend_hostname1 = '192.168.10.89'
backend_port1 = 5433
backend_weight1 = 1
backend_data_directory1 = '/var/lib/pgsql/9.3/data'
backend_flag1 = 'ALLOW_TO_FAILOVER'
backend_hostname2 = '192.168.10.67'
backend_port2 = 5433
backend_weight2 = 1
backend_data_directory2 = '/var/lib/pgsql/9.3/data'
backend_flag2 = 'ALLOW_TO_FAILOVER'
enable_pool_hba = off
pool_passwd = ''
authentication_timeout = 60
client_min_messages = error
log_min_messages = error
ssl = off
num_init_children = 32
max_pool = 4
child_life_time = 300
child_max_connections = 0
connection_life_time = 0
client_idle_limit = 0
log_destination = 'stderr'
print_timestamp = on
log_connections = off
log_hostname = off
log_statement = off
log_per_node_statement = off
log_standby_delay = 'if_over_threshold'
syslog_facility = 'LOCAL0'
syslog_ident = 'pgpool'
debug_level = 0
pid_file_name = '/var/run/pgpool/pgpool.pid'
logdir = '/tmp'
connection_cache = on
reset_query_list = 'ABORT; DISCARD ALL'
replication_mode = off
replicate_select = off
insert_lock = off
lobj_lock_table = ''
replication_stop_on_mismatch = off
failover_if_affected_tuples_mismatch = off
load_balance_mode = on
ignore_leading_white_space = on
white_function_list = ''
black_function_list = 'currval,lastval,nextval,setval'
master_slave_mode = on
master_slave_sub_mode = 'stream'
sr_check_period = 10
sr_check_user = 'repl_user'
sr_check_password = 'repl_user'
delay_threshold = 10000
follow_master_command = ''
parallel_mode = off
pgpool2_hostname = ''
health_check_period = 0
health_check_timeout = 20
health_check_user = 'hogehoge'
health_check_password = 'fugafuga'
health_check_max_retries = 0
health_check_retry_delay = 1
failover_command = ''
failback_command = ''
fail_over_on_backend_error = on
search_primary_node_timeout = 10
recovery_user = 'nobody'
recovery_password = ''
recovery_1st_stage_command = ''
recovery_2nd_stage_command = ''
recovery_timeout = 90
client_idle_limit_in_recovery = 0
use_watchdog = off
trusted_servers = ''
ping_path = '/bin'
wd_hostname = ''
wd_port = 9000
wd_authkey = ''
delegate_IP = ''
ifconfig_path = '/sbin'
if_up_cmd = 'ifconfig eth0:0 inet $_IP_$ netmask 255.255.255.0'
if_down_cmd = 'ifconfig eth0:0 down'
arping_path = '/usr/sbin'           # arping command path
arping_cmd = 'arping -U $_IP_$ -w 1'
clear_memqcache_on_escalation = on
wd_escalation_command = ''
wd_lifecheck_method = 'heartbeat'
wd_interval = 10
wd_heartbeat_port = 9694
wd_heartbeat_keepalive = 2
wd_heartbeat_deadtime = 30
heartbeat_destination0 = 'host0_ip1'
heartbeat_destination_port0 = 9694
heartbeat_device0 = ''
wd_life_point = 3
wd_lifecheck_query = 'SELECT 1'
wd_lifecheck_dbname = 'template1'
wd_lifecheck_user = 'nobody'
wd_lifecheck_password = ''
relcache_expire = 0
relcache_size = 256
check_temp_table = on
memory_cache_enabled = off
memqcache_method = 'shmem'
memqcache_memcached_host = 'localhost'
memqcache_memcached_port = 11211
memqcache_total_size = 67108864
memqcache_max_num_cache = 1000000
memqcache_expire = 0
memqcache_auto_cache_invalidation = on
memqcache_maxcache = 409600
memqcache_cache_block_size = 1048576
memqcache_oiddir = '/var/log/pgpool/oiddir'
white_memqcache_table_list = ''
black_memqcache_table_list = ''
=============================================

pgbenchにおける結果は以下のようになります。
※各数値は3回の平均値です。

■postgresqlへの実施
・To Master
/usr/pgsql-9.3/bin/pgbench -n -p 5433 -c 10 -t 1000 -h 192.168.10.57 pgbench
tps = 491.6782643 (including connections establishing)
tps = 492.576876 (excluding connections establishing)

■pgpoolへの実施
・To Master
/usr/pgsql-9.3/bin/pgbench -n -p 9979 -c 10 -t 1000 -h 192.168.10.57 pgbench
tps = 346.4907967 (including connections establishing)
tps = 346.8569167 (excluding connections establishing)

・To Slave1
/usr/pgsql-9.3/bin/pgbench -n -p 9979 -c 10 -t 1000 -h 192.168.10.57 pgbench
tps = 377.00388 (including connections establishing)
tps = 377.536235 (excluding connections establishing)

長文で申し訳ありませんが、設定の勘所等ご教示いただければと思います。
よろしくお願いいたします。
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
URL: <http://www.sraoss.jp/pipermail/pgpool-general-jp/attachments/20150325/efc252a5/attachment-0001.html>


pgpool-general-jp メーリングリストの案内