Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Increase load and decrease performance while replace DBCP to Tomcat JDBC-pool

Tags:

People also ask

What is the default value of Defaultautocommit attribute of Commons DBCP or Tomcat JDBC pool?

(boolean) If autoCommit==false then the pool can complete the transaction by calling commit on the connection as it is returned to the pool If rollbackOnReturn==true then this attribute is ignored. Default value is false .

How does Tomcat JDBC connection pool work?

Tomcat jdbc pool implements the ability retrieve a connection asynchronously, without adding additional threads to the library itself. Tomcat jdbc pool is a Tomcat module, it depends on Tomcat JULI, a simplified logging framework used in Tomcat. Retrieve the underlying connection using the javax. sql.

Which feature of Tomcat connection pool is used for asynchronous connection retrieval?

The Tomcat JDBC connection pool supports asynchronous connection retrieval without adding additional threads to the pool library. It does this by adding a method to the data source called Future<Connection> getConnectionAsync() .

What is JDBC connection pool size?

The connection pool configuration settings are: Initial and Minimum Pool Size: Minimum and initial number of connections maintained in the pool (default is 8) Maximum Pool Size: Maximum number of connections that can be created to satisfy client requests (default is 32)


After problems with connection leak and deadlocks in DBCP we made a decision to replace it with Tomcat JDBC-pool. Of course migration was really simple.

But after deploy it on a production environment I noticed, that load on a server with running two Tomcats increase from 4-4.5 to 5.5. We didn't do anything more, except change of pool. Moreover, performance measured with JMeter decrease by about 5%.

I spent some time to tune pool parameters, but without visible effects. I pasted my current config (from <GlobalNamingResources> in server.xml) below:

<Resource name="jdbc/xxxxxx"
          auth="Container"
          type="javax.sql.DataSource"
          factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
          initialSize="10"
          maxActive="100"
          minIdle="10"
          maxIdle="50"
          maxWait="10000" 
          testOnBorrow="true"
          testOnReturn="false"
          testOnConnect="false"
          testWhileIdle="false"
          validationQuery="SELECT 1 from dual"
          validationInterval="30000"
          suspectTimeout="60"
          timeBetweenEvictionRunsMillis="30000"
          removeAbandonedTimeout="60"
          removeAbandoned="true"
          logAbandoned="true"
          abandonWhenPercentageFull="50"
          minEvictableIdleTimeMillis="60000"
          jmxEnabled="true"
          username="xxxxx"
          password="xxxxx"
          driverClassName="oracle.jdbc.OracleDriver"
          url="jdbc:oracle:oci:xxxxx"/>

FairQueue and PoolSweeperEnabled are true

In Spring applicationContext-jdbc.xml I have only:

  <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="resourceRef">
      <value>true</value>
    </property>
    <property name="jndiName">
      <value>java:comp/env/jdbc/PortalDB</value>
    </property>
  </bean>

What am I doing wrong? I thought, that JDBC_pool should be faster than DBCP out of the box.