-->
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: L2 cache behaviour(ehcache)
PostPosted: Mon Aug 20, 2012 5:28 am 
Newbie

Joined: Mon Aug 13, 2012 6:31 am
Posts: 3
Hi ,
I am using ehcache 2.6 , hibernate331 ga

Found following behaviour of ehcache wrt maxElementsInMemory :
- If my recCount>maxElmentsInMemory , then it will fire selectQuery for each nonCached Elements. Is it Expected? Or am i missing any configuration?
- Any configuration to fire single query for non-cached items ?
- Total no. of queries fired are almost same of diff. between recCount and maxElementInMemory, Is there a way to fire single query for others , or fire a fresh call to DB?

To configure maxElementsInMemory same as recCount is not possible for my App.


Top
 Profile  
 
 Post subject: Re: L2 cache behaviour(ehcache)
PostPosted: Thu Sep 20, 2012 5:45 am 
Newbie

Joined: Mon Aug 13, 2012 6:31 am
Posts: 3
Details code :
ehcache.xml
<cache name="ProductRelation"
maxEntriesLocalHeap="8"
eternal="true"
overflowToDisk="false"
diskPersistent="false"
/>

hibernate sample code :
Following code in for loop
String qryString = " from ProductRelation where brand in ('A21P') ";
Query qry = SessionManager.currentSession().createQuery(qryString);
qry.setCacheable(true);
return qry.list();

Output:
before caching
ProductRelation TotalSize mem=0 ,disk=0
Cache Name: ProductRelation, size: 0, keylist size: >>0

Hibernate: select productrel0_.DocID as DocID0_, productrel0_.RevisionId as RevisionId0_, productrel0_.Brand as Brand0_, productrel0_.Product as Product0_, productrel0_.All_Product as All5_0_, productrel0_.SKU as SKU0_, productrel0_.ModifiedBy as ModifiedBy0_, productrel0_.DateCreated as DateCrea8_0_, productrel0_.Category as Category0_, productrel0_.Sub_Brand as Sub10_0_, productrel0_.Classification as Classif11_0_, productrel0_.DateModified as DateMod12_0_, productrel0_.CreatedBy as CreatedBy0_, productrel0_.JSONDoc as JSONDoc0_ from ProductRelation productrel0_ where brand in ('A21P')
testGetProdReln Q1 : 1671 ms.
Q1 output Size:10
Hibernate: select productrel0_.DocID as DocID0_0_, productrel0_.RevisionId as RevisionId0_0_, productrel0_.Brand as Brand0_0_, productrel0_.Product as Product0_0_, productrel0_.All_Product as All5_0_0_, productrel0_.SKU as SKU0_0_, productrel0_.ModifiedBy as ModifiedBy0_0_, productrel0_.DateCreated as DateCrea8_0_0_, productrel0_.Category as Category0_0_, productrel0_.Sub_Brand as Sub10_0_0_, productrel0_.Classification as Classif11_0_0_, productrel0_.DateModified as DateMod12_0_0_, productrel0_.CreatedBy as CreatedBy0_0_, productrel0_.JSONDoc as JSONDoc0_0_ from ProductRelation productrel0_ where productrel0_.DocID=?
Hibernate: select productrel0_.DocID as DocID0_0_, productrel0_.RevisionId as RevisionId0_0_, productrel0_.Brand as Brand0_0_, productrel0_.Product as Product0_0_, productrel0_.All_Product as All5_0_0_, productrel0_.SKU as SKU0_0_, productrel0_.ModifiedBy as ModifiedBy0_0_, productrel0_.DateCreated as DateCrea8_0_0_, productrel0_.Category as Category0_0_, productrel0_.Sub_Brand as Sub10_0_0_, productrel0_.Classification as Classif11_0_0_, productrel0_.DateModified as DateMod12_0_0_, productrel0_.CreatedBy as CreatedBy0_0_, productrel0_.JSONDoc as JSONDoc0_0_ from ProductRelation productrel0_ where productrel0_.DocID=?
Hibernate: select productrel0_.DocID as DocID0_0_, productrel0_.RevisionId as RevisionId0_0_, productrel0_.Brand as Brand0_0_, productrel0_.Product as Product0_0_, productrel0_.All_Product as All5_0_0_, productrel0_.SKU as SKU0_0_, productrel0_.ModifiedBy as ModifiedBy0_0_, productrel0_.DateCreated as DateCrea8_0_0_, productrel0_.Category as Category0_0_, productrel0_.Sub_Brand as Sub10_0_0_, productrel0_.Classification as Classif11_0_0_, productrel0_.DateModified as DateMod12_0_0_, productrel0_.CreatedBy as CreatedBy0_0_, productrel0_.JSONDoc as JSONDoc0_0_ from ProductRelation productrel0_ where productrel0_.DocID=?
Hibernate: select productrel0_.DocID as DocID0_0_, productrel0_.RevisionId as RevisionId0_0_, productrel0_.Brand as Brand0_0_, productrel0_.Product as Product0_0_, productrel0_.All_Product as All5_0_0_, productrel0_.SKU as SKU0_0_, productrel0_.ModifiedBy as ModifiedBy0_0_, productrel0_.DateCreated as DateCrea8_0_0_, productrel0_.Category as Category0_0_, productrel0_.Sub_Brand as Sub10_0_0_, productrel0_.Classification as Classif11_0_0_, productrel0_.DateModified as DateMod12_0_0_, productrel0_.CreatedBy as CreatedBy0_0_, productrel0_.JSONDoc as JSONDoc0_0_ from ProductRelation productrel0_ where productrel0_.DocID=?
Hibernate: select productrel0_.DocID as DocID0_0_, productrel0_.RevisionId as RevisionId0_0_, productrel0_.Brand as Brand0_0_, productrel0_.Product as Product0_0_, productrel0_.All_Product as All5_0_0_, productrel0_.SKU as SKU0_0_, productrel0_.ModifiedBy as ModifiedBy0_0_, productrel0_.DateCreated as DateCrea8_0_0_, productrel0_.Category as Category0_0_, productrel0_.Sub_Brand as Sub10_0_0_, productrel0_.Classification as Classif11_0_0_, productrel0_.DateModified as DateMod12_0_0_, productrel0_.CreatedBy as CreatedBy0_0_, productrel0_.JSONDoc as JSONDoc0_0_ from ProductRelation productrel0_ where productrel0_.DocID=?
Hibernate: select productrel0_.DocID as DocID0_0_, productrel0_.RevisionId as RevisionId0_0_, productrel0_.Brand as Brand0_0_, productrel0_.Product as Product0_0_, productrel0_.All_Product as All5_0_0_, productrel0_.SKU as SKU0_0_, productrel0_.ModifiedBy as ModifiedBy0_0_, productrel0_.DateCreated as DateCrea8_0_0_, productrel0_.Category as Category0_0_, productrel0_.Sub_Brand as Sub10_0_0_, productrel0_.Classification as Classif11_0_0_, productrel0_.DateModified as DateMod12_0_0_, productrel0_.CreatedBy as CreatedBy0_0_, productrel0_.JSONDoc as JSONDoc0_0_ from ProductRelation productrel0_ where productrel0_.DocID=?
Hibernate: select productrel0_.DocID as DocID0_0_, productrel0_.RevisionId as RevisionId0_0_, productrel0_.Brand as Brand0_0_, productrel0_.Product as Product0_0_, productrel0_.All_Product as All5_0_0_, productrel0_.SKU as SKU0_0_, productrel0_.ModifiedBy as ModifiedBy0_0_, productrel0_.DateCreated as DateCrea8_0_0_, productrel0_.Category as Category0_0_, productrel0_.Sub_Brand as Sub10_0_0_, productrel0_.Classification as Classif11_0_0_, productrel0_.DateModified as DateMod12_0_0_, productrel0_.CreatedBy as CreatedBy0_0_, productrel0_.JSONDoc as JSONDoc0_0_ from ProductRelation productrel0_ where productrel0_.DocID=?
Hibernate: select productrel0_.DocID as DocID0_0_, productrel0_.RevisionId as RevisionId0_0_, productrel0_.Brand as Brand0_0_, productrel0_.Product as Product0_0_, productrel0_.All_Product as All5_0_0_, productrel0_.SKU as SKU0_0_, productrel0_.ModifiedBy as ModifiedBy0_0_, productrel0_.DateCreated as DateCrea8_0_0_, productrel0_.Category as Category0_0_, productrel0_.Sub_Brand as Sub10_0_0_, productrel0_.Classification as Classif11_0_0_, productrel0_.DateModified as DateMod12_0_0_, productrel0_.CreatedBy as CreatedBy0_0_, productrel0_.JSONDoc as JSONDoc0_0_ from ProductRelation productrel0_ where productrel0_.DocID=?
testGetProdReln Q1 : 266 ms.
Q1 output Size:10
Hibernate: select productrel0_.DocID as DocID0_, productrel0_.RevisionId as RevisionId0_, productrel0_.Brand as Brand0_, productrel0_.Product as Product0_, productrel0_.All_Product as All5_0_, productrel0_.SKU as SKU0_, productrel0_.ModifiedBy as ModifiedBy0_, productrel0_.DateCreated as DateCrea8_0_, productrel0_.Category as Category0_, productrel0_.Sub_Brand as Sub10_0_, productrel0_.Classification as Classif11_0_, productrel0_.DateModified as DateMod12_0_, productrel0_.CreatedBy as CreatedBy0_, productrel0_.JSONDoc as JSONDoc0_ from ProductRelation productrel0_ where brand in ('A21P')
testGetProdReln Q1 : 31 ms.
Q1 output Size:10


after cache
ProductRelation TotalSize mem=10056 ,disk=0
Cache Name: ProductRelation, size: 8, keylist size: >>8
org.hibernate.cache.StandardQueryCache TotalSize mem=1800 ,disk=0
Cache Name: org.hibernate.cache.StandardQueryCache, size: 1, keylist size: >>1


How to minimize these single select query.


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.