[GENERAL] keepalive problem with libpg connection

2009-08-11 Thread Juan Backson
Hi,

I am writing my own connection pool for libpq's connection.

My goal is to try to reduce the amount of time spent in opening and closing
socket.   However, I see that Postgres would close my connection after every
so often.

What is the best solution for that? Should I regularly send some Select 1
to keep the connection alive or is there a better way to write a connection
pool for libpq?


Any suggestion will be greatly appreciated.

JB


Re: [GENERAL] keepalive problem with libpg connection

2009-08-11 Thread Merlin Moncure
On Tue, Aug 11, 2009 at 3:56 AM, Juan Backsonjuanback...@gmail.com wrote:
 Hi,

 I am writing my own connection pool for libpq's connection.

 My goal is to try to reduce the amount of time spent in opening and closing
 socket.   However, I see that Postgres would close my connection after every
 so often.

it's not postgres, most likely someone in the middle is closing
inactive connections, typically after 3-5 minutes.  check out the
keepalive settings in postgresql.conf to handle this on the tcp level
(better than throwing  a select 1).

merlin

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general