Author |
Message |
10/11/2012 20:35:29
|
amraheem
neo
Joined: 10/11/2012 20:25:44
Messages: 3
Offline
|
Hi,
It would be helpful if you can give me the solution for this.
Concern is : I am trying to persist the data to the disk and loading on server startup. .data file is getting created but there is no .index file created anywhere. On reading of the cache after server startup, there are no elements in cache.
My ehcache.xml file as below:
--------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd" >
<diskStore path="C:\work\Hazmat\cacheBackup"/>
<cache name="items" maxElementsInMemory="10000" maxEntriesLocalHeap="10000" eternal="true" timeToIdleSeconds="0"
timeToLiveSeconds="0" overflowToDisk="false" clearOnFlush="true" memoryStoreEvictionPolicy="LRU" diskPersistent="true" >
<bootstrapCacheLoaderFactory
class="net.sf.ehcache.store.DiskStoreBootstrapCacheLoaderFactory"
properties="bootstrapAsynchronously=true"/>
</cache>
</ehcache>
------------------------------------------
My web.xml (Using Tomcat6) contains below configuration:
<listener>
<listener-class>net.sf.ehcache.constructs.web.ShutdownListener</listener-class>
</listener>
------------------------------------------------------
I am creating cache as below:
CacheManager manager = CacheManager.create(CACHE_CONFIG_FILE);
System.out.println("manager instance is : "+manager);
System.out.println("is cache exists:"+manager.cacheExists("items"));
this.cache = manager.getCache("items");
-----------------------------------------------------------------------
Am I doing anything wrong anywhere? Please suggest.
|
|
|
10/11/2012 22:49:39
|
rajoshi
seraphim
Joined: 07/04/2011 04:36:10
Messages: 1491
Offline
|
Can you try again with overflowToDisk=true alongwith diskPersistent="true" setting. Also in your ehcache.xml I see
maxElementsInMemory="10000" maxEntriesLocalHeap="10000
Both are same thing why are you defining this twice.
|
Rakesh Joshi
Senior Consultant
Terracotta. |
|
|
10/12/2012 05:04:22
|
klalithr
consul
Joined: 01/23/2011 10:58:07
Messages: 489
Offline
|
Plus, AFAIK, contents are persisted to disk only when you perform a cacheManager.shutdown.
|
Karthik Lalithraj (Terracotta) |
|
|
10/12/2012 08:59:04
|
amraheem
neo
Joined: 10/11/2012 20:25:44
Messages: 3
Offline
|
Tahank you for responding to my issue.
1. I tried with the option overflowToDisk=true (also mentioning only this attribute maxElementsInMemory="10000"), still it didn't work.
2. I am configuring shutdown manager in the web.xml and also java class like below:
System.setProperty("net.sf.ehcache.enableShutdownHook", "true");
3) items.data file is getting created but not the items.index file.
4) In logs it gives the following message.
net.sf.ehcache.store.disk.Segment.put(Segment.java:420)evel [http-8585-2hread] - put added 0 on heap
Please help me with your thoughts.
|
|
|
10/12/2012 12:29:06
|
klalithr
consul
Joined: 01/23/2011 10:58:07
Messages: 489
Offline
|
Not sure why this is so complex. Setting the system property for the shutdown hook will not help. You need to manually shutdown your cacheManager for the contents to be persisted.
Anyways, Good Luck!
|
Karthik Lalithraj (Terracotta) |
|
|
10/12/2012 14:09:53
|
amraheem
neo
Joined: 10/11/2012 20:25:44
Messages: 3
Offline
|
Thanks Karthik.
I found the issue, why it is not creating the .index file. This file got created when i called explicitly cache.flush() . Then it started working. But just want to know, If I call flush method, will there be any performance overhead?
|
|
|
10/12/2012 19:58:20
|
klalithr
consul
Joined: 01/23/2011 10:58:07
Messages: 489
Offline
|
Here another unique idea. Our new product Bigmemory Go provides you upto 32GB of FREE Bigmemory per server instance.
Link below ...
http://terracotta.org/products/bigmemorygo
BigMemory Go is the easiest way to get real-time access to your data — with zero GC pauses. Data is stored outside the heap but in process. BigMemory Go stores data in your server's RAM, scaling to as much memory as your machine can hold. It uses the same technology as BigMemory Max, Terracotta’s award-winning distributed in-memory solution, and it comes with 32GB free!
Check it out and my bet is that you wont need the disk option anymore.
|
Karthik Lalithraj (Terracotta) |
|
|
10/12/2012 21:26:44
|
steve
ophanim
Joined: 05/24/2006 14:22:53
Messages: 619
Offline
|
It's also fully restartable and fault tolerant.
|
Want to post to this forum? Join the Terracotta Community |
|
|
|