[jboss-user] [JBoss Seam] - Re: Storing large recordset in memory

damianharvey do-not-reply at jboss.com
Mon Oct 29 13:04:27 EDT 2007


I've been looking into the second level cache and following this rather good article: http://www.devx.com/dbzone/Article/29685/0/page/1. My setup appears correct however I'm getting no performance improvement.

My test reads 10,000 UN Location codes in 10 iterations. I would expect the last 9 to be quicker but the reverse is happening:

  | 16:31:45,699 INFO  [STDOUT] Iteration 0 took 3190 ms
  | 16:31:51,757 INFO  [STDOUT] Iteration 1 took 6058 ms
  | 16:31:57,237 INFO  [STDOUT] Iteration 2 took 5480 ms
  | 16:32:02,964 INFO  [STDOUT] Iteration 3 took 5727 ms
  | 16:32:10,310 INFO  [STDOUT] Iteration 4 took 7346 ms
  | 16:32:15,971 INFO  [STDOUT] Iteration 5 took 5661 ms
  | 16:32:21,670 INFO  [STDOUT] Iteration 6 took 5699 ms
  | 16:32:27,176 INFO  [STDOUT] Iteration 7 took 5506 ms
  | 16:32:32,882 INFO  [STDOUT] Iteration 8 took 5706 ms
  | 16:32:38,628 INFO  [STDOUT] Iteration 9 took 5746 ms
  | 

On server startup I get the following logs, which to me indicate a working setup:16:21:15,028 INFO  [SettingsFactory] Second-level cache: enabled
  | 16:21:15,029 INFO  [SettingsFactory] Query cache: disabled
  | 16:21:15,029 INFO  [SettingsFactory] Cache provider: net.sf.ehcache.hibernate.EhCacheProvider
  | ...
  | ...
  | 16:20:59,140 WARN  [CacheFactory] read-only cache configured for mutable class: Odyssey0_5_0_ear,Odyssey0_5_0.UnLocode
  | 
I have an ehcache.xml in my classpath with the following entry:

  |     <cache name="UnLocode"
  |         maxElementsInMemory="90000"
  |         eternal="true"
  |         overflowToDisk="false"
  |         />
  | 
Where my entity is annotated with a region of 'UnLocode' (I've tried with no region and using class as well):
@Entity
  | @Table(name = "UN_LOCODE")
  | @Cache(usage = CacheConcurrencyStrategy.READ_ONLY, region="UnLocode")
  | public class UnLocode implements java.io.Serializable {
  | 

Interestingly if I change my queries to include .setHint("org.hibernate.cacheable", new Boolean(true)) then I don't get 10 Hibernate queries but the times don't change much at all.

Is there something that I'm missing?

I'll be asking this on the Ehcache forum but thought I'd continue here first. 

Thanks,

Damian.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4099927#4099927

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4099927



More information about the jboss-user mailing list