You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kiren Pillay <ki...@gmail.com> on 2013/04/16 17:18:14 UTC

Fwd: Tomcat Jdbc Pool - NumActive vs actual Established Connections

Hi All,

I am using the tomcat-jdpc-pool from within my spring application. I am
noticing a discrepancy between the numActive/numIdle values that the pool
reports versus the actual number of established connections to the database.

For example, the pool reports 0 active and 4 idle connections while my
netstat shows 5 connections established. Is this the correct behaviour?

Below is a trace from within my app where host super.odbc=172.22.12.84. As
you can see from the time stamps, the numbers do not add up in terms of
idle connections.

My config is shown at the bottom:
I am using the jars:
tomcat-juli-7.0.39.jar & tomcat-jdbc-7.0.39.jar

2013-04-16 16:04:38,695 DEBUG   super.odbc: active:0 idle: 4  max:50
pamsdev: active:0 idle: 20  max:50        sa: active:0 idle: 17  max:50
2013-04-16 16:04:43,696 DEBUG   super.odbc: active:0 idle: 4  max:50
pamsdev: active:0 idle: 20  max:50        sa: active:0 idle: 17  max:50
2013-04-16 16:04:48,697 DEBUG   super.odbc: active:0 idle: 4  max:50
pamsdev: active:0 idle: 20  max:50        sa: active:0 idle: 17  max:50
2013-04-16 16:04:53,698 DEBUG   super.odbc: active:0 idle: 4  max:50
pamsdev: active:0 idle: 20  max:50        sa: active:0 idle: 17  max:50
2013-04-16 16:04:58,699 DEBUG   super.odbc: active:0 idle: 5  max:50
pamsdev: active:0 idle: 20  max:50        sa: active:0 idle: 17  max:50
2013-04-16 16:05:03,699 DEBUG   super.odbc: active:0 idle: 5  max:50
pamsdev: active:0 idle: 20  max:50        sa: active:0 idle: 17  max:50


NETSTAT trace:

Apr 16 16:04:38  172.22.12.84 = 5  172.22.12.85 = 0  10.115.250.9 = 0
172.22.12.42 = 28  10.115.250.8 = 0
Apr 16 16:04:43  172.22.12.84 = 5  172.22.12.85 = 0  10.115.250.9 = 0
172.22.12.42 = 28  10.115.250.8 = 0
Apr 16 16:04:48  172.22.12.84 = 5  172.22.12.85 = 0  10.115.250.9 = 0
172.22.12.42 = 23  10.115.250.8 = 0
Apr 16 16:04:53  172.22.12.84 = 5  172.22.12.85 = 0  10.115.250.9 = 0
172.22.12.42 = 23  10.115.250.8 = 0
Apr 16 16:04:58  172.22.12.84 = 5  172.22.12.85 = 0  10.115.250.9 = 0
172.22.12.42 = 24  10.115.250.8 = 0
Apr 16 16:05:03  172.22.12.84 = 5  172.22.12.85 = 0  10.115.250.9 = 0
172.22.12.42 = 24  10.115.250.8 = 0

ppfe.database.url=jdbc\:t4sqlmx\://ppfe-za-qa-db\:18650
ppfe.database.driverClassName=com.tandem.t4jdbc.SQLMXDriver
ppfe.database.username=xxx
ppfe.database.password=xxx
ppfe.database.catalog=xxx
ppfe.database.schema=xx

ppfe.database.initialPoolSize=10
ppfe.database.maxPoolSize=50

ppfe.database.defaultTransactionIsolation=1
ppfe.database.maxStatements=7000


ppfe.database.maxIdle=5
ppfe.database.minIdle=5
ppfe.database.maxWait=10000

ppfe.database.testConnectionOnCheckout=false
ppfe.database.testConnectionOnCheckin=false
ppfe.database.testWhileIdle=true
ppfe.database.timeBetweenEvictionRunsMillis=60000
ppfe.database.numTestsPerEvictionRun=3

ppfe.database.minEvictableIdleTimeMillis=60000
ppfe.database.logAbandoned=true
ppfe.database.removeAbandoned=true
ppfe.database.poolPreparedStatements=true

ppfe.database.maxConnectionAge=300000

#Defines the query that will be executed for all connection tests
ppfe.database.preferredTestQuery=select count(*) from NODUS BROWSE ACCESS

ppfe.database.debugUnreturnedConnectionStackTraces=true
ppfe.database.unreturnedConnectionTimeout=60
ppfe.database.checkoutTimeout=3

Re: Fwd: Tomcat Jdbc Pool - NumActive vs actual Established Connections

Posted by kirenpillay <ki...@gmail.com>.
I've figured out the problem. The Driver had a built in Datasource which was
doing its own pooling management, hence keeping connections open even though
the tomcat-pool saw them as closed. In effect I had a datasource pool within
a datasource. Removing the connection attribute solved the problem.

Regards
Kiren



--
View this message in context: http://tomcat.10.x6.nabble.com/Fwd-Tomcat-Jdbc-Pool-NumActive-vs-actual-Established-Connections-tp4997798p4997849.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Fwd: Tomcat Jdbc Pool - NumActive vs actual Established Connections

Posted by kirenpillay <ki...@gmail.com>.
Hi

I am using this within tomcat-6.0.36.B.RELEASE contained in STS tcServer.

Here is my spring config as well.

	<bean id="ppfeDataSource" class="org.apache.tomcat.jdbc.pool.DataSource"
		destroy-method="close">
		<property name="driverClassName" value="${ppfe.database.driverClassName}"
/>
		<property name="url" value="${ppfe.database.url}" />
		<property name="username" value="${ppfe.database.username}" />
		<property name="password" value="${ppfe.database.password}" />

		<property name="initialSize" value="${ppfe.database.initialPoolSize}" />
		<property name="maxActive" value="${ppfe.database.maxPoolSize}" />
		<property name="minIdle" value="${ppfe.database.minIdle}" />
		<property name="maxIdle" value="${ppfe.database.maxIdle}" />
		<property name="maxWait" value="${ppfe.database.maxWait}"></property>
		
		
		<property name="validationQuery"
value="${ppfe.database.preferredTestQuery}" />
		<property name="testOnBorrow"
value="${ppfe.database.testConnectionOnCheckout}" />
		<property name="testOnReturn"
value="${ppfe.database.testConnectionOnCheckin}" />
		<property name="testWhileIdle" value="${ppfe.database.testWhileIdle}" />

		<property name="timeBetweenEvictionRunsMillis"
			value="${ppfe.database.timeBetweenEvictionRunsMillis}" />
		<property name="numTestsPerEvictionRun"
value="${ppfe.database.numTestsPerEvictionRun}" />
		<property name="minEvictableIdleTimeMillis"
value="${ppfe.database.minEvictableIdleTimeMillis}" />

		<property name="removeAbandoned" value="${ppfe.database.removeAbandoned}"
/>
		<property name="removeAbandonedTimeout"
value="${ppfe.database.removeAbandonedTimeout}" />
		<property name="logAbandoned" value="${ppfe.database.logAbandoned}" />
		<property name="maxAge" value="${ppfe.database.maxAge}" />
		<property name="logValidationErrors"
value="${ppfe.database.logValidationErrors}" />

		<property name="connectionProperties"
		
value="maxStatements=6000;maxPoolSize=${ppfe.database.maxPoolSize};catalog=${ppfe.database.catalog};schema=${ppfe.database.schema};T4LogLevel=${ppfe.database.logLevel};T4LogFile=${ppfe.database.logFile}"
/>
        <property name="jdbcInterceptors"
value="StatementFinalizer"></property>
		
	</bean>

	

	
	<tx:annotation-driven transaction-manager="txManager" />

	
	<bean id="txManager"
		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		
		<property name="dataSource" ref="ppfeDataSource" />
	</bean>

	<bean id="ppfeSessionFactory"
	
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
		<property name="dataSource" ref="ppfeDataSource" />
		<property name="mappingResources">
			<list>
				<value>za/co/vodacom/ppfe/data/airtime/airtimeXferLog.hbm.xml
				</value>
	-----
		</property>
		<property name="hibernateProperties">
			<value>
				hibernate.dialect=org.hibernate.dialect.SqlmxDialect
				hibernate.show_sql=false
				hibernate.format_sql=false
				hibernate.jdbc.batch_size=0
			</value>
		</property>
	</bean>

	<bean id="ppfeTransactionManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="ppfeSessionFactory" />
	</bean>

Regards 



--
View this message in context: http://tomcat.10.x6.nabble.com/Fwd-Tomcat-Jdbc-Pool-NumActive-vs-actual-Established-Connections-tp4997798p4997845.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat Jdbc Pool - NumActive vs actual Established Connections

Posted by Jose MarĂ­a Zaragoza <de...@gmail.com>.
2013/4/16 Kiren Pillay <ki...@gmail.com>

> Hi All,
>
> I am using the tomcat-jdpc-pool from within my spring application. I am
> noticing a discrepancy between the numActive/numIdle values that the pool
> reports versus the actual number of established connections to the
> database.
>
> For example, the pool reports 0 active and 4 idle connections while my
> netstat shows 5 connections established. Is this the correct behaviour?
>
>
Hello:

You could run netstat command to show socket TCP status and PID

Regards