-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: c3p0 configuration
PostPosted: Mon Jul 05, 2004 3:48 pm 
Beginner
Beginner

Joined: Tue Jan 06, 2004 4:51 pm
Posts: 48
Hi,

I'm running hibernate and I'm attempting to turn on the c3p0 pooling. I have in my hibernate.properties:

Code:
hibernate.c3p0.maxPoolSize=50
hibernate.c3p0.minPoolSize=3
hibernate.c3p0.maxStatements=200
hibernate.c3p0.validate=false
hibernate.c3p0.numHelperThreads=5


but if I run a jmeter test with 10 users logging in, entering a date and then logging out of the web application, the web application hangs at some point when it tries to access a database connection. I figure 50 threads should certainly be enough to accomodate 10 users!
What am I doing wrong? How can I get hibernate to tell me what my c3p0 or pooling settings are?

I am using c3p0 0.8.4.5.

Thanks,
Don.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 05, 2004 4:11 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
public static final String C3P0_ACQUIRE_INCREMENT "hibernate.c3p0.acquire_increment"
public static final String C3P0_IDLE_TEST_PERIOD "hibernate.c3p0.idle_test_period"
public static final String C3P0_MAX_SIZE "hibernate.c3p0.max_size"
public static final String C3P0_MAX_STATEMENTS "hibernate.c3p0.max_statements"
public static final String C3P0_MIN_SIZE "hibernate.c3p0.min_size"
public static final String C3P0_TIMEOUT "hibernate.c3p0.timeout"
public static final String C3P0_VALIDATE_CONNECTION "hibernate.c3p0.validate"


as detailed in the cfg.environment javadoc

don't use validate, it is deprecated (very expensive), use idle_test_period

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 05, 2004 5:29 pm 
Beginner
Beginner

Joined: Tue Jan 06, 2004 4:51 pm
Posts: 48
Hi,

thanks for the reply! I thought that I had to switch the properties to camelcase with the new version of c3p0 but I was wrong.

What is a good setting for idle_test_period?

thanks,


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 05, 2004 6:07 pm 
Beginner
Beginner

Joined: Tue Jan 06, 2004 4:51 pm
Posts: 48
Code:
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@1352367 [ connectionPoolDataSource -> com.mchange.v2.c3p0.W
rapperConnectionPoolDataSource@10bbd42 [ acquireIncrement -> 5, autoCommitOnClose -> false, connectionTesterClassName -> com.m
change.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, idleCon
nectionTestPeriod -> -1, initialPoolSize -> 3, maxIdleTime -> 0, maxPoolSize -> 15, maxStatements -> 0, minPoolSize -> 5, nest
edDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@1a76eff [ description -> null, driverClass -> org.postgresql.Drive
r, factoryClassLocation -> null


I see this, even though my properties now looks like:

Code:
hibernate.connection.datasource=java:comp/env/jdbc/pooledDS
hibernate.c3p0.max_size=20
hibernate.c3p0.min_size=3
hibernate.c3p0.max_statements=200
#hibernate.c3p0.validate=false
#hibernate.c3p0.numHelperThreads=5
hibernate.c3p0.idle_test_period=500
hibernate.cglib.use_reflection_optimizer=true
hibernate.show_sql=false


(and of course, it's still hanging the application at 8 users). Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 05, 2004 8:46 pm 
Regular
Regular

Joined: Tue Sep 30, 2003 11:27 am
Posts: 60
Location: Columbus, OH, USA
I use an XML file for my Hibernate/C3P0 config - here are my settings. Seems to work, but I admit, I haven't run JMeter tests to prove it yet.

Code:
        <!-- Minimum size of C3P0 connection pool  -->
        <property name="hibernate.c3p0.min_size">2</property>
      
        <!-- Maximum size of C3P0 connection pool  -->
        <property name="hibernate.c3p0.max_size">20</property>
      
        <!-- Maximum size of C3P0 statement cache  -->
        <property name="hibernate.c3p0.max_statements">10</property>
      
        <!-- Number of connections acquired when C3P0 pool is exhausted  -->
      <property name="hibernate.c3p0.acquire_increment">2</property>
      
        <!-- Idle time (seconds) before a C3P0 pooled connection is validated  -->
        <property name="hibernate.c3p0.idle_test_period">300</property>
      
        <!-- Maximum idle time (seconds) for a C3P0 connection pool  -->
        <property name="hibernate.c3p0.timeout">300</property>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.