HI,
I am facing a problem of slow performance when I am using hibernate with c3p0 connection pooling.
Hibernate Version : 3
MySQL Version : 5.0.27
C3p0 Version : 0.9.0
ehcache Version :1.2.3
Hibernate Config files:
Code:
<hibernate-configuration>
<session-factory>
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.timeout">300</property>
<property name="hibernate.c3p0.max_statements">0</property>
<property name="hibernate.c3p0.acquire_increment">2</property>
<property name="hibernate.c3p0.validate">false</property>
<property name="show_sql">false</property>
<property name="format_sql">false</property>
<property name="use_sql_comments">false</property>
<property name="connection.pool_size">1</property>
<property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
<mapping resource="CommonSessionData.hbm.xml"/>
<propertyname="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<mapping resource="CommonSessionData.hbm.xml"/>
</session-factory>
</hibernate-configuration>
// Mapping for CommonSessionData
<hibernate-mapping>
<class
name="com.ortiva.eventlistener.mappings.CommonSessionData"
table="Sessions">
<cache usage="read-write"/>
<!--Other parameters have been mapped to table column-->
</class>
</hibernate-mapping>
//Config param for EHCACHE
<ehcache>
<diskStore path="java.io.tmpdir"/>
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>
<cache name="com.ortiva.eventlistener.mappings.CommonSessionData"
maxElementsInMemory="1000"
eternal="true"
overflowToDisk="false"
/>
<cache name="com.ortiva.eventlistener.mappings.GatewayEventData"
maxElementsInMemory="2000"
eternal="true"
overflowToDisk="false"
/>
</ehcache>
We have a java code that opens a Session from SessionFactory and Searches database if CommonSessionData object exists by comparing a varchar field which is primary field. If it finds then updates with some values otherwise inserts that record into database.
Now I am facing problem when I am running the code with many files from where we are creating CommonSessionData objects.Input files starts queuing in the input directory.So please help me . [b]Its an urgent as it is a part of the project that I am currently doing.[/b]
Thanks & regards
Manisha Nandi