pgpool2.git / summary / log / commit / refs

commit    a16a07f608edbba634b1983ed201d2f083ff13f7
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Thu Dec 19 02:06:28 2013 +0000

    Add mention about listen queue and how to increase the backlog in the num_init_children section.


doc/pgpool-en.html | 33 ++++++++++++++++++++++++++++++++- doc/pgpool-ja.html | 29 ++++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/doc/pgpool-en.html b/doc/pgpool-en.html index 7c4cd4ae5..e11935fa4 100644 --- a/doc/pgpool-en.html +++ b/doc/pgpool-en.html @@ -7,7 +7,7 @@ </head> <!-- hhmts start --> -Last modified: Sun Dec 1 10:46:44 JST 2013 +Last modified: Thu Dec 19 11:10:39 JST 2013 <!-- hhmts end --> <body bgcolor="#ffffff"> @@ -605,6 +605,37 @@ comment and will be ignored.</p> If more than num_init_children clients try to connect to pgpool-II, they are blocked (not rejected) until a connection to any pgpool-II process is closed. Up to 2*num_init_children can be queued. + </p> + <p> + The queued is inside the kernel called "listen queue". The length of the listen queue is called "backlog". + There is an upper limit of the backlog in some systems, and if num_init_children*2 exceeds the number, you need to set the backlong higher. Otherwise, following problems may occur in heavy loaded systems: 1) connecting to pgpool-II fails 2) connecting to pgpool-II is getting slow because of retries in the kernel. + You can check if the listen queue is actually overflowed by using "netstat -s" command. + If you find something like: + </p> + <pre> +535 times the listen queue of a socket overflowed + </pre> + </p> + <p> +then the listen queue is definitely overflowed. + You should increase the backlog in this case (you will be required a super user privilege). + </p> + <p> + <pre> +# sysctl net.core.somaxconn +net.core.somaxconn = 128 +# sysctl -w net.core.somaxconn = 256 + </pre> + </p> + <p> +You could add following to /etc/sysctl.conf instead. + </p> + <p> + <pre> +net.core.somaxconn = 256 + </pre> + </p> + <p> Number of connections to each PostgreSQL is roughly max_pool*num_init_children</p> <p>Some hints in addition to above:</p> diff --git a/doc/pgpool-ja.html b/doc/pgpool-ja.html index 26c4d6a7f..2307ab927 100644 --- a/doc/pgpool-ja.html +++ b/doc/pgpool-ja.html @@ -8,7 +8,7 @@ <body> <!-- hhmts start --> -Last modified: Sun Dec 1 10:46:32 JST 2013 +Last modified: Thu Dec 19 11:10:52 JST 2013 <!-- hhmts end --> <body bgcolor="#ffffff"> @@ -613,6 +613,33 @@ pgpool.confでは空白行や#で始まる行はコメントと見なされま これを超えた場合は、そのクライアントは、pgpool-IIのどれからのプロセスへのフロントエンドの接続が終了するまで 待たされます(PostgreSQLと違ってエラーになりません)。 待たされる数の上限は、2 * num_init_children です。 + 待ち行列は、OS内部に作られ、「listenキュー」と呼ばれます。listenキューの長さは「バックログ」と呼ばれます。 + システムによってはバックログの上限が設定されており、2 * num_init_children がこれを越える場合はシステム側の設定変更が必要になります。 + さもないと高負荷時にlistenキューが溢れ、pgpool-IIへの接続が失敗したり、システム内で行われるリトライにより著しく性能が低下することがあります。 + listenキューが溢れているかどうかは、"netstat -s"で確認できます。"TcpExt"のパートで、 + </p> + <p> + <pre> +535 times the listen queue of a socket overflowed + </pre> + </p> + <p> + のようなメッセージが出ていればlistenキューが溢れています。listenキュー溢れを防ぐためにバックログを大きくするには、Linuxでは以下のようにします(root権限が必要です)。 + </p> + <p> + <pre> +# sysctl net.core.somaxconn +net.core.somaxconn = 128 +# sysctl -w net.core.somaxconn = 256 + </pre> + </p> + <p> + もちろん、/etc/sysctl.confに以下のように書いても構いません。 + </p> + <p> + <pre> +net.core.somaxconn = 256 + </pre> </p> <p> 基本的に後述のmax_pool * num_init_children分だけPostgreSQLへのコネクションが張られますが、 [parent: 9acc1fecbd87]