[pgpool-hackers: 2897] Re: Pgpool-II 3.8: allow to specify load balance weight ratio for load balance parameters

Bo Peng pengbo at sraoss.co.jp
Mon Jul 30 11:49:12 JST 2018


Hi,

I added a new feature to allow to specify load balance weight ratio for 
database_redirect_preference_list and app_name_redirect_preference_list 
parameters. Attached is the first patch.

You can specify the list of "database-name:node id(ratio)" pairs to 
send SELECT queries to a particular backend node for a particular 
database connection at a specified load balance ratio. 
This load balance ratio specifies a value between 0 and 1, 
and the default is 1.0. 

For example, by specifying "test:1(0.5)", 
Pgpool-II will redirect 50% SELECT queries to the backend node of ID 1 
for the connection to "test" database. And the other 50% SELECT queries
will be sent to other backend nodes.

Example: 

If you spacify like below:

   database_redirect_preference_list = 'postgres:primary,mydb[01]:1(0.3),mydb2:standby'

It means,

- Route all SELECT queries on postgres database to the primary backend node.

- Route 30% SELECT queries on mydb0 or on mydb1 databases to backend node of ID. 
  The other 70% SELECT queries will be sent to other backend nodes.

- Route all SELECT queries on mydb2 database to standby backend nodes. 


The notion of app_name_redirect_preference_list is same as the database_redirect_preference_list. 


On Thu, 14 Dec 2017 14:08:03 +0900 (JST)
Tatsuo Ishii <ishii at sraoss.co.jp> wrote:

> > Currently we can specify load balance condition by using,
> > database_redirect_preference_list, and
> > app_name_redirect_preference_list like:
> > 
> > postgres:primary
> > 
> > This means, if connected database is postgres, every SELECTs will be
> > redirected to primary.
> > 
> > It would be nice if we could specify load balance ratio like:
> > 
> > postgres:primary(0.3)
> > 
> > which redirects 30% of SELECTs to primary (that is, other 70% of
> > SELECTs will be redirected to the load balance node). If the primary
> > node is also the load balance node, 100% of SELCTs will be redirected
> > to the primary.
> > 
> > Other example is:
> > 
> > postgres:primary(0.0)
> > 
> > which never redirects SELECTs to the primary. This is useful if user
> > never wants to redirect SELECTs on the primary. Actually we cannot do
> > this for now if a primary node changes time to time.
> 
> Sorry I was wrong. This is possible today too by
> "postgres:standby". What we cannot do today is
> "postgres:primary(0.3)".
> 
> > postgres:mydb[0-4]:1(0.3)
> > 
> > which redirects 30% of SELECTs to node 1 (that is, other 70% of
> > SELECTs will be redirected to the load balance node). If node 1 is
> > also the load balance node, 100% of SELCTs will be redirected to node
> > 1.
> > 
> > I suppose the new specification overrides the current "weight"
> > parameters for each node.
> > 
> > Comments and suggestions are welcome.
> > --
> > Tatsuo Ishii
> > SRA OSS, Inc. Japan
> > English: http://www.sraoss.co.jp/index_en.php
> > Japanese:http://www.sraoss.co.jp
> _______________________________________________
> pgpool-hackers mailing list
> pgpool-hackers at pgpool.net
> http://www.pgpool.net/mailman/listinfo/pgpool-hackers
> 


-- 
Bo Peng <pengbo at sraoss.co.jp>
SRA OSS, Inc. Japan
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: load_balance_ratio_v1.diff
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20180730/507a01de/attachment-0001.ksh>


More information about the pgpool-hackers mailing list