Difference between pages "Relationship between max pool, num init children, and max connections" and "Documentation"

From pgpool Wiki
(Difference between pages)
Jump to: navigation, search
 
(User contributed documentation)
 
Line 1: Line 1:
Gurjeet Singh (last updated: 22 August 2012)
+
== Official documentation ==
 +
* '''pgpool-II'''
 +
** [http://www.pgpool.net/docs/latest/pgpool-en.html pgpool-II manual (English)]
 +
** [http://www.pgpool.net/docs/latest/pgpool-ja.html pgpool-II manual (Japanese)]
 +
** [http://www.pgpool.net/docs/latest/pgpool-zh_cn.html pgpool-II manual(Simplified Chinese)]
 +
** [http://www.pgpool.net/docs/latest/pgpool-fr.html pgpool-II manual (French)]
 +
** [http://www.pgpool.net/docs/latest/tutorial-en.html pgpool-II tutorial (English)]
 +
** [http://www.pgpool.net/docs/latest/tutorial-ja.html pgpool-II tutorial (Japanese)]
 +
** [http://www.pgpool.net/docs/latest/tutorial-zh_cn.html pgpool-II tutorial (Simplified Chinese)]
  
max_pool parameter configures how many connections to cache _per
+
* '''pgpoolAdmin'''
child_. So if num_init_children is configured to 100, and max_pool is
+
** [http://www.pgpool.net/pgpoolAdmin/doc/index_en.html pgpoolAdmin manual (English)]
configured to 3, then pgpool can potentially open 300 (=3*100) connections
+
** [http://www.pgpool.net/pgpoolAdmin/doc/index_ja.html pgpoolAdmin manual (Japanese)]
to the backend database.
 
  
A child process opens a new backend connection only if the requested
+
== User contributed documentation ==
[user,database] pair is not already in the cache. So if the application
+
* '''Documentation'''
uses only one user to connect to only one database, say [pguser1,pgdb1],
+
** [http://www.pgpool.net/pgpool-web/contrib_docs/pgpool-II_for_beginners.pdf Gerd Koenig's "pgpool-II for beginners"] (English)
then each child will continue to reuse the first connection and will never
+
** [http://lets.postgresql.jp/documents/technical/pgpool/1 What is pgpool-II] (Japanese)
open a second connection, so in effect pgpool will open no more than 100
+
** [http://lets.postgresql.jp/documents/technical/pgpool/2 Creating a replication system using pgpool-II] (Japanese)
backend connections even though max_pool is set to 3.
+
** [http://www.sraoss.co.jp/event_seminar/2010/20100702-03char10.pdf Making master/slave systems work better with pgpool-II] (English, PDF)
 +
** [[Relationship_between_max_pool,_num_init_children,_and_max_connections|Relationship between max_pool, num_init_children, and max_connections]](English, 2012/8/25)
  
But if the application uses more than one pair of [user,database]
+
* '''Tutorials of Streaming Replication with pgpool-II'''
connection parameters, then each child will cache the connection it might
+
** Simple Streaming replication setting with pgpool-II
already have for another pair, and open a new backend connection for the
+
*** For pgpool-II 3.1 and PostgreSQL 9.1: [http://www.pgpool.net/pgpool-web/contrib_docs/simple_sr_setting/index.html English (2012/01/31) ]  [http://www.pgpool.net/pgpool-web/contrib_docs/simple_sr_setting/index-ja.html Japanese (2012/6/1) ]
requested pair.
+
*** For pgpool-II 3.0 and PostgreSQL 9.0: [http://www.pgpool.net/pgpool-web/contrib_docs/simple_sr_setting_3.0/index.html English] [http://www.pgpool.net/pgpool-web/contrib_docs/simple_sr_setting_3.0/index-ja.html Japanese]
 +
** multiple server version
 +
*** For pgpool-II 3.1 and PostgreSQL 9.1: [http://www.pgpool.net/pgpool-web/contrib_docs/simple_sr_setting2/index.html English (2012/01/31)] [http://www.pgpool.net/pgpool-web/contrib_docs/simple_sr_setting2_3.0/index-ja.html Japanese (2012/6/1)]
 +
*** For pgpool-II 3.0 and PostgreSQL 9.0: [http://www.pgpool.net/pgpool-web/contrib_docs/simple_sr_setting2/index.html English] [http://www.pgpool.net/pgpool-web/contrib_docs/simple_sr_setting2_3.0/index-ja.html Japanese]
  
For eg., if the application now uses these 4 pairs: [user1,db1]
+
* '''Tutorials of pgpool-II 3.2'''
[user1,db2] [user2,db1] [user2,db2] to connect to pgpool, then each child
+
** On memory query cache: [http://www.pgpool.net/pgpool-web/contrib_docs/memqcache/en.html English (2012/07/20)] [http://www.pgpool.net/pgpool-web/contrib_docs/memqcache/ja.html Japanese (2012/07/20)]
process can cache up to 3 connections for the first 3 different pairs it
+
** Watchdog:
receives connection requests for. But as soon as it receives a request for
+
*** Basic: [http://www.pgpool.net/pgpool-web/contrib_docs/watchdog/en.html English (2012/07/20)] [http://www.pgpool.net/pgpool-web/contrib_docs/watchdog/ja.html Japanese (2012/07/20)]
the 4th pair that it does not yet have a connection for, then it will
+
*** master-slave mode: [http://www.pgpool.net/pgpool-web/contrib_docs/watchdog_master_slave/en.html English (2012/10/22)] [http://www.pgpool.net/pgpool-web/contrib_docs/watchdog_master_slave/ja.html Japanese (2012/10/15)]
disconnect the oldest connection in the cache and open a new connection for
 
the 4th pair.
 
  
As we already know that there's no guarantee as to which child process
+
== Developer's documentation ==
will handle an incoming connection request, max_pool tries to improve the
+
* [http://www.pgpool.net/pgpool-web/pgpoolAdmin-add-directives.txt How to add configurfation directives to pgpoolAdmin]
performance a little bit by caching connections of different pairs, in the
+
* [http://www.pgpool.net/pgpool-web/contrib_docs/ClusterMeeting2012.pdf 3rd Postgres Cluster Hackers Summit, pgCon 2012 "pgpool-II Development Status Updates"]
hopes that an incoming connection request might match one of the
 
connections cached by the child process. But this also causes an explosion
 
in the number of connections that pgpool would request from the database.
 
 
 
So, in order to guarantee that the application connection requests are
 
never rejected, and that the connection requests wait until a database
 
connection is available, the following condition should be met:
 
 
 
max_pool*num_init_children <= (max_connections - superuser_reserved_connections)
 
 
 
If the application uses superuser connections (which is not
 
recommended), then the condition is reduced to:
 
 
 
max_pool*num_init_children <= max_connections
 
 
 
Setting max_pool to 1 will guarantee that the number of database
 
connections opened by pgpool child processes never exceeds the
 
num_init_children value. If for performance reasons, as explained above,
 
you do wish to set max_pool to more than 1, then max_connections will also
 
have to be increased accordingly so that application connection requests do
 
not get denied.
 

Revision as of 01:11, 13 December 2012

Official documentation

User contributed documentation

Developer's documentation