[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Messages posted by: klalithr  XML
Profile for klalithr -> Messages posted by klalithr [482] Go to Page: Previous  1, 2, 3 ... , 31, 32, 33 Next 
Author Message
First off, I would recommend that you upgrade to the most recent version of Ehcache (2.4.2). You are using an much older version (Make sure to replace the ehcache jar files that come with JBoss).
This upgrade might solve your problem.

Secondly, I am a bit confused with your setup. You said that you are not using standalone - are you replicating? When you say multiple threads, are they hitting the same JBoss instance? Also, your stack trace doesn't show Ehcache API being called.
Your stack trace doesn't tell me where ehcache API is invoked. Can you post the complete trace?

Also which version of Ehcache are you using? Are you using standalone Ehcache or distributing with Terracotta?
Could you share with us the complete stack trace, the few lines of code in question, and the details of the object "key" that is in cache?
Could you use session.get instead of session.load and post the behavior.
Could you post the complete ehcache.xml (I just found a snippet earlier). Also are you using the same ehcache.xml in both the nodes? If No, then please post both the ehcache.xmls
I would recommend that you contact "sales@terracotta.org" with a brief explanation of your use case to better determine your upgrade options.
The logs would give you additional information. Most likely the Client got disconnected from the cluster due to a long GC pause or N/W related issue. Its tough to exactly point out the issue without the logs. Would also recommend tuning the L1 for GC pauses. You could also try to increase your L2-L1 disconnect pause times.
Are you using the decorated cache in your code?

For example.
NonStopCache myCache = (NonStopCache) cacheManager.getEhcache("myNonStopCache");

Note the difference in API to get the decorated cache ...
Non stop is packaged as a separate jar file.
If you are using maven use the following dependency
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-nonstopcache</artifactId>
<version>1.0.1</version>
</dependency>

Otherwise you can find the jar to include in ehcache.org
Any reason you are using the older version. Recommend to move to ehcache 2.4.1 to get best use of the monitor
You can start with this link. There are samples on how the CacheManager is used.

http://ehcache.org/documentation/samples.html

If you intend to use ehcache as hibernate second level cache, here is the link

http://ehcache.org/documentation/hibernate.html
Ah !! I just saw that you are using ehCache Version 1.4.1.
Please use the most current GA release (2.4.0) available in the ehcache.org website. You might need to replace the ehcache jars that come packaged with hibernate.

Good catch on the hibernate factory class.
Another option is the EhcacheRegionFactory as below ...
hibernate.cache.region.factory_class=net.sf.ehcache.hibernate.EhCacheRegionFactory
Couple of things come to mind

1. The cache name should be the fully qualified name of the hibernate object.
eg com.domain.product2Cache.
2. Lets check for second level cache usage a different way. Can you enable query logging in hibernate (hibernate.show_sql=true) and look at the console logs to make sure that your DB is being queried twice
How are you querying the database? Are you using hql? Criteria API?
Are you using session.get/session.load? If you are using spring, are you using
hibernateTemplate.get?
Yes, you can dynamically add caches and make them use the write behind pattern programmatically.
To add a cache to your configuration, you dont need to implement the clone method of the writer. Just use a configuration similar to the below
Cache cache = new Cache(
new CacheConfiguration("cacheName", 10)
.cacheWriter(new CacheWriterConfiguration()
.writeMode(CacheWriterConfiguration.WriteMode.WRITE_BEHIND)
.maxWriteDelay(8)
.rateLimitPerSecond(5)
.writeCoalescing(true)
.writeBatching(true)
.writeBatchSize(20)
.retryAttempts(2)
.retryAttemptDelaySeconds(2)
.cacheWriterFactory(new CacheWriterConfiguration.CacheWriterFactoryConfiguration()
.className("com.company.MyCacheWriterFactory")
.properties("just.some.property=test; another.property=test2")
.propertySeparator(";"))));

More details are found in the below link
http://ehcache.org/documentation/write_through_caching.html

 
Profile for klalithr -> Messages posted by klalithr [482] Go to Page: Previous  1, 2, 3 ... , 31, 32, 33 Next 
Go to:   
Powered by JForum 2.1.7 © JForum Team