pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Recommended resource type and settings for J2EE/Glassfish connection pool
2+ messages / 2 participants
[nested] [flat]

* Recommended resource type and settings for J2EE/Glassfish connection pool
@ 2011-04-06 21:51 John Lister <john.lister-ps@kickstone.com>
  2011-04-07 02:54 ` Re: Recommended resource type and settings for J2EE/Glassfish connection pool Craig Ringer <craig@postnewspapers.com.au>
  0 siblings, 1 reply; 2+ messages in thread

From: John Lister @ 2011-04-06 21:51 UTC (permalink / raw)
  To: pgsql-jdbc

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?

I seem to remember a while ago trying it but having quite a few problems so gave up, but want to look at this again from a performance point of view.


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

Thanks

John
--

Got needs? Get Goblin'! - http://www.pricegoblin.co.uk/

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Recommended resource type and settings for J2EE/Glassfish connection pool
  2011-04-06 21:51 Recommended resource type and settings for J2EE/Glassfish connection pool John Lister <john.lister-ps@kickstone.com>
@ 2011-04-07 02:54 ` Craig Ringer <craig@postnewspapers.com.au>
  0 siblings, 0 replies; 2+ messages in thread

From: Craig Ringer @ 2011-04-07 02:54 UTC (permalink / raw)
  To: John Lister <john.lister-ps@kickstone.com>; +Cc: 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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2011-04-07 02:54 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-04-06 21:51 Recommended resource type and settings for J2EE/Glassfish connection pool John Lister <john.lister-ps@kickstone.com>
2011-04-07 02:54 ` Craig Ringer <craig@postnewspapers.com.au>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox