[pgpool-general: 3259] Backend selection algorithm

Cal Heldenbrand cal at fbsdata.com
Thu Nov 6 04:02:41 JST 2014

Hi everyone,

In playing with some timeout settings with some real-world live traffic, I
noticed that pgpool keeps a lot of server-side idle connections open.  I
started with a child_life_time of 30 seconds, and it quickly consumed up
all of my num_init_children setting (32) on the postgres server.  I'd like
to minimize the number of connections left open (and idle) on the postgres

When I dropped the child_life_time down to 5 seconds, it reduced the idle
connections significantly.  While that effectively solves my problem, I'm
wondering what algorithm is used to select a server pool slot when a new
client connects.  As I was watching it, it seems like an LRU algorithm,
picking the server side slot with the largest idle time.  If that's the
case, I think I would prefer it to pick the server side slot with the
*smallest* idle time.  The pool should then shrink to the minimal number of
server-side connection slots required to handle the current client-side
load.  Then to account for burst activity, the idle time could be upped to
keep a small amount of extra slots for burst capacity.

The way it seems now, I have to shorten the idle timeout to something very
short in order to keep from overrunning my connection limits on the
postgres server.

Does any of this seem correct, or am I way off base here?

Thank you!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.sraoss.jp/pipermail/pgpool-general/attachments/20141105/95df3415/attachment.html>

More information about the pgpool-general mailing list