[Pgpool-general] pgpool-II load balancing question

Tatsuo Ishii ishii at sraoss.co.jp
Thu Dec 9 22:46:44 UTC 2010


> our set up is a set of three webservers connecting to our pgpool
> machine which turns around to three DB servers.
> 
> the DB servers are Postgresql 9 set up in streaming replication mode,
> as a result we don't do the replication via pgpool. in the end we are
> looking to have one master for writes and two read only hot standbys.
> 
> we have set the pgpool to use all three servers but we only see
> connections to one the master.
> 
> is this a ramification of having a very very light load during our
> testing phase (aka the master is fast enough that pgpool never looks
> to another machine, or should SELECTS be sent via round robin or
> similar mechanism?  Is this a result of connection pooling versus load
> balancing?

The algorithm used for chosing the load balance node is based on
random number. So you may not see the load is balanced abosolutely
equal among DB servers in the short term(2 or 3 SELECTs). Whether the
master is fast or not is irrelevant.

The load balanced node is chosen at connection time from client to
pgpool.  So if you are testing only using 1 session, you don't see the
effect. You need to use multiple concurrent sessions to observe the
load balancing effect.

Also there are some conditions which do not alow load
balancing. Typical one is the SELECT is inside a transaction and
DMLs/DDLs(INSERT, UPDATE, DELETE, CREATE etc.) are in the same
transaction.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp


More information about the Pgpool-general mailing list