Re: Recommended resource type and settings for J2EE/Glassfish connection pool

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: Recommended resource type and settings for J2EE/Glassfish connection pool
Дата
Msg-id 4D9D2772.5080501@postnewspapers.com.au
обсуждение исходный текст
Ответ на Recommended resource type and settings for J2EE/Glassfish connection pool  ("John Lister" <john.lister-ps@kickstone.com>)
Список pgsql-jdbc
On 07/04/11 05:51, John Lister wrote:
> Hi, what is the recommended/supported/best resource type to use with a
> J2EE server eg Glassfish for the connection pool? I'm currently using
> javax.sql.ConnectionPoolDataSource with PGSimpleDataSource as the class,
> however I would have thought an XADataSource would be better?

Do you need XA? If you're not doing distributed transactions and using a
distributed transaction manager, the simple data source should be more
than fine.

I'd avoid using the dumb pooling datasource built into the JDBC driver.
You're doing the right thing by using your container's pooling.

I'm using a glassfish-resources.xml like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application
Server 3.1 Resource Definitions//EN"
"http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
    <!-- Remember to deploy the PostgreSQL JDBC driver to the
application server! -->
    <jdbc-connection-pool
        name="classads-database-pool"
        datasource-classname="org.postgresql.ds.PGSimpleDataSource"
res-type="javax.sql.DataSource"
        max-pool-size="8"  steady-pool-size="2">
            <property name="User" value="xxxx"/>
            <property name="Password" value="xxxx"/>
            <property name="databaseName" value="xxxx"/>
    </jdbc-connection-pool>
    <jdbc-resource enabled="true" jndi-name="jdbc/classads-database"
object-type="user" pool-name="classads-database-pool"/>
</resources>

which is being deployed using 'asadmin add-resources'.

> Also, what settings/parameters would anyone recommend either to the
> connection pool or the driver itself such as statement caching?

Don't stress about it until it becomes a problem. You can tune those
things based on performance measurements once your app is complete
enough that you can profile and load-test it. Trying to do so blind is
probably just premature "optimization".

--
Craig Ringer

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Lew
Дата:
Сообщение: Re: Memory leak ?
Следующее
От: Guillaume Cottenceau
Дата:
Сообщение: Re: Memory leak ?