-->
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.  [ 1 post ] 
Author Message
 Post subject: Performance issues with Second-Level Cache(Jboss Tree Cache)
PostPosted: Wed Aug 08, 2007 10:34 am 
Newbie

Joined: Thu Jun 14, 2007 5:28 pm
Posts: 7
Hello,

Iam using Hibernate with Jboss Tree Cache for Second-level Caching. The entity we are caching right now has 99% reads. When we did the performance testing, the numbers did not look good.

First Issue: The DB time when doing the old way through PL/SQL is taking around ~35 ms. When using hibernate, it takes around 70ms when retrieving from cache. ( I do not see any sqls executed.)

Second Issue: When many threads try to access, it gets worse in Hibernate. Some transactions going beyond 150 ms.

Following are the details of my application:

Hibernate version: 3.1
JBoss Cache version: 1.2.1


Mapping documents:
Hibernate.cfg.xml:
<!-- Cache properties -->
<property name="hibernate.cache.provider_class">org.hibernate.cache.TreeCacheProvider</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.use_query_cache">true</property>

Priv.hbm.xml:
<class name="com.test.PrivDTO" table="PRIV">
<cache usage="transactional"/>

<id name="privilegeId" type="long" column="privilege_id">
<generator class="sequence">
<param name="sequence">ts2owner.temp_id_seq</param>
</generator>
</id>
<property name="privilegeKey">
<column name="privilege_key" />
</property>
<property name="privilegeDescription">
<column name="privilege_description" />
</property>

<set name="userPrivs" cascade="none" lazy="true" inverse="true">
<cache usage="transactional"/>
<key column="privilege_id"/>
<one-to-many class="com.test.UserPrivDTO"/>
</set>
</class>

JBoss Cache props:
<region name="/com/test/PrivDTO">
<attribute name="maxNodes">500</attribute>
<attribute name="timeToIdleSeconds">3600</attribute>
</region>


Code snippets:
// Using from Clause
String hqlQuery = "from PrivDTO as priv where priv.userPrivs.roleId=?";
Query query = session.createQuery(hqlQuery);
query.setLong(0, roleId.longValue());
query.setCacheable(true);
List list = query.list();
for (Iterator it = list.iterator(); it.hasNext();) {
PrivDTO priv = (PrivDTO) it.next();
privs.add(priv);
}



DB: Oracle 8

We are executing more than one query though, which is the same as what pl/sql is doing.. The max number of rows we are getting is around 100. So its not huge amount of data.

Right now we are not using transactions for reads. But I tried using transactions and the numbers are worse..

Really appreciate any help.


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

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.