Обсуждение: Pooled connections idle timeout

Поиск
Список
Период
Сортировка

Pooled connections idle timeout

От
Daniele Depetrini
Дата:
Hi All,

I'm running JDBC 8.3-603 drivers against PG server 8.3.3. I'm using
JDBC3.0 API with connection pooling. Here my pool init code:

        pool = new Jdbc3PoolingDataSource();
        pool.setDataSourceName("DB");
        pool.setServerName(servername);
        pool.setDatabaseName(db);
        pool.setUser(user);
        pool.setPassword(password);
        pool.setPortNumber(port);
        pool.setMaxConnections(maxConn);

Connections are opened and closed via conn=pool.getConnection() /
conn.close().

I've noted that once a connection get opened since needed, it's never
really closed, application and database stay connected up to restart.
Since I'm writing a java server application, my application will
eventually stay up for a long time and spike of traffics can open a lot
of connectoins to PG that will never be released, even in low traffic time.

Is there any auto-idle-close mechanism, either client or server level?

Thanks in advance,

Daniele.

Re: Pooled connections idle timeout

От
Daniele Depetrini
Дата:
Hi Again,

Any ideas?

Daniele.

Daniele Depetrini wrote:
> Hi All,
>
> I'm running JDBC 8.3-603 drivers against PG server 8.3.3. I'm using
> JDBC3.0 API with connection pooling. Here my pool init code:
>
>        pool = new Jdbc3PoolingDataSource();
>        pool.setDataSourceName("DB");
>        pool.setServerName(servername);
>        pool.setDatabaseName(db);
>        pool.setUser(user);
>        pool.setPassword(password);
>        pool.setPortNumber(port);
>        pool.setMaxConnections(maxConn);
>
> Connections are opened and closed via conn=pool.getConnection() /
> conn.close().
>
> I've noted that once a connection get opened since needed, it's never
> really closed, application and database stay connected up to restart.
> Since I'm writing a java server application, my application will
> eventually stay up for a long time and spike of traffics can open a
> lot of connectoins to PG that will never be released, even in low
> traffic time.
>
> Is there any auto-idle-close mechanism, either client or server level?
>
> Thanks in advance,
>
> Daniele.
>


Re: Pooled connections idle timeout

От
Oliver Jowett
Дата:
Daniele Depetrini wrote:
> Hi Again,
>
> Any ideas?

There is no auto-idle-close mechanism in the pool implementation
provided by the driver.

The connection pool shipped with the driver is very basic. If it doesn't
do what you need it to, you probably want to use a 3rd party connection
pool (e.g. dbcp). I don't think there's much point in building any sort
of fully-featured connection pool to ship with the driver - there are
plenty of other implementations already out there.

-O


Re: Pooled connections idle timeout

От
Daniele Depetrini
Дата:
Oliver Jowett wrote:
> Daniele Depetrini wrote:
>> Hi Again,
>>
>> Any ideas?
>
> There is no auto-idle-close mechanism in the pool implementation
> provided by the driver.
>
> The connection pool shipped with the driver is very basic. If it
> doesn't do what you need it to, you probably want to use a 3rd party
> connection pool (e.g. dbcp). I don't think there's much point in
> building any sort of fully-featured connection pool to ship with the
> driver - there are plenty of other implementations already out there.
>
> -O
>
>
Thanks for the answer. Actually according to my testing up to now is
working "well enough". It's not clear to me if prepared statements
pooling is implemented: in positive case will be much better to use
internal pooling instead of an external one, what do you think?

Daniele.