-->
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.  [ 2 posts ] 
Author Message
 Post subject: Performance tuning using ehcache(second level)--urgent!!!!
PostPosted: Wed Aug 11, 2010 7:39 am 
Newbie

Joined: Wed Aug 11, 2010 7:24 am
Posts: 1
Hi All,

My application is using Spring MVC with hibernate, where in they have a page which reads the excel file uploaded by the user and inserts records in the database

Requirement now is that its taking lot of time for the upload which needs to be reduced.

- Ehcache (Secondary level) has been implemented

- Criteria is being used instead of HQL.

- They are using HSSF wokrbook API to read the excel(anyways reading data from excel file is not giving much overhead, instead its the database insert)

It would be really of very great help if you could suggest me some way where we can increase the performance.

Hibernate configurations that we are using is like below

hibernate.cfg.xml


<hibernate-configuration>
<session-factory name="/hibernate/HibernateFactory">
<property name="show_sql">True</property>
<property name="connection.driver_class"></property>
<property name="dialect"></property>
<property name="connection.url"></property>
<property name="connection.username"></property>
<property name="connection.password"></property>


Spring-servlet.xml


<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="hibernateProperties">
<props>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.connection.isolation">1</prop>
<prop key="hibernate.connection.datasource"></prop>
<prop key="hibernate.current_session_context_class">thread</prop>
<prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory
</prop>
<prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider
</prop>
<prop key="net.sf.ehcache.configurationResourceName">com/chase/rfs/art/hibernate/ehcache.xml
</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.generate_statistics">true</prop>
</props>
</property>



Can u pls tell me if any configuration changes can increase the performance..

using the property <property name="hibernate.jdbc.batch_size" value="1000"/> be helpful??


kindly help me!!!

Thanks,
Geetha


Top
 Profile  
 
 Post subject: Re: Performance tuning using ehcache(second level)--urgent!!!!
PostPosted: Wed Aug 11, 2010 10:19 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Before changing parameters,
I suggest to analyze first where the regarding application thread is currently spending most time while doing the upload.

I simple way to do it is to produce several java-stack-traces while the application is busy.
This can be done i.e. by calling kill -3 <pid> (under linux) or by using jconsole.
Then take a look at the stacktraces, find out which is the busy thread (doing the upload)
and see in which parts of code it is executing the most.
-if the thread is almost always waiting on response of the database, then probably your 2nd level cache is not properly configured
-if the thread is almost always executing the same lines of code, then try to understand why it is happening.
Is the code most time executing hibernate code or your own code?
Is the code most time executing in flush or commit, or in executing user-queries you are calling explicitly?
...
There are so many scenarios possible, that it is impossible to give the right parameter without knowing what actually happening.
(Also a doctor must first probe the patient before prescribing a proper remedy ;-) )


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.