[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]
EHcache 2.5.1 Disk Persistance issue  XML
Forum Index -> Ehcache
Author Message
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.

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.
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)
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.

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)
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?
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)
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
 
Forum Index -> Ehcache
Go to:   
Powered by JForum 2.1.7 © JForum Team