ehcache is overflowing to disk store from the start, much before maxEntriesLocalHeap is exceeded ?

1,330 views
Skip to first unread message

Rahul Chhiber

unread,
Apr 22, 2015, 9:52:00 AM4/22/15
to ehcach...@googlegroups.com
  1. What version of Ehcache you are currently using; 2.9
  2. Paste the configuration for the Cache/CacheManager you have an issue with;
  3. <ehcache>
  4. <diskStore path="F:/EclipseWorkspace2/ehcachePOC/cache"/>
  5. <cache name="test"
  6. maxEntriesLocalHeap="150000"
  7. eternal="true"
  8. overflowToDisk="true"
  9.         maxEntriesLocalDisk="0"        
  10. memoryStoreEvictionPolicy="LRU"
  11. transactionalMode="off"
  12. diskSpoolBufferSizeMB="20">
  13. </cache>

  14. </ehcache>
  15. Add any name and version of other library or framework you use Ehcache with (e.g. Hibernate); Simple Java Program
  16. Providing JDK and OS versions maybe useful as well. Java 1.7, Windows 7
EhCache should overflow to disk store only when the maximum number of elements in memory store is exceeded (maxEntriesLocalHeap).  However I observe that ehcache is dumping to disk right from the first element that is inserted into the cache. Is this behaviour expected ? Any help is greatly appreciated. 

Thanks

Alex Snaps

unread,
Apr 22, 2015, 12:11:31 PM4/22/15
to ehcach...@googlegroups.com
Hey Rahul, 
Yes, that's the expected behavior, even if it is probably surprising. 
I will not start on how it all got to where it is, but basically the isn't a _strict_ overflow mode in Ehcache. 
The option remains there in the sake of backwards compatibility, i.e. it will use more than the heap and the data on disk will not be reused across restarts. 
There is a new Java API into the disk usage settings of Caches, also exposed through XML iirc, but we can't deprecate the "old" one in XML sadly enough.
That being said, other than disk usage, you shouldn't get a latency hit from that given behavior. 
Hope this clarifies somewhat...
Alex 



--
You received this message because you are subscribed to the Google Groups "ehcache-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ehcache-user...@googlegroups.com.
To post to this group, send email to ehcach...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ehcache-users/3d56fe3c-ec53-480f-8906-53891105220e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rahul Chhiber

unread,
Apr 24, 2015, 3:05:45 AM4/24/15
to ehcach...@googlegroups.com
Thanks Alex, good to know that it is the expected behaviour. I was surprised, because we have used EhCache 2.4.1 before, and I think in that we do have a "strict" overflow operation - as far as I can tell, elements are not dumped to disk before memory store is full. Is this correct ?

Thanks

Louis Jacomet

unread,
Apr 24, 2015, 5:28:23 AM4/24/15
to ehcach...@googlegroups.com
Hi Rahul,

You are correct, Ehcache used to have a strict overflow model but no longer does.
 The change was already present as far as version 2.6.

Regards,
Louis

Message has been deleted

Saurabh Jain

unread,
May 19, 2020, 2:13:04 AM5/19/20
to ehcache-users
Hi Louis,

We are also facing similar issue in 3.8 version, please let me know how can I disable using XML configuration?

Thanks
Saurabh
To unsubscribe from this group and stop receiving emails from it, send an email to ehcach...@googlegroups.com.

To post to this group, send email to ehcach...@googlegroups.com.

dkode

unread,
Jul 10, 2020, 2:07:28 AM7/10/20
to ehcache-users
You can't. Just don't use disk.
As per the ehcache model, Put will always flow to the lowest tier (disk is lowest).This provides predictable performance.

Hervé Guillaume

unread,
Nov 13, 2020, 3:24:40 PM11/13/20
to ehcache-users


Hello,

I'm not sur to understand.
If, with a bi-tiers cache : heap and disk, each time we write on cache, the heap is not used and only the disk is, what is the difference with a single tier cache : disk only ?

I'm asking this, because, for performance reasons, I would like to have a heap cache used first, and only when this cache is full, use a disk cache.

Thx for your help !

dakks...@gmail.com

unread,
Dec 19, 2020, 2:14:10 PM12/19/20
to ehcache-users
Its not possible in Ehcache, as writes go to the lowest tier first i.e disk in your case.
Ehcache developers if they see this thread, may suggest performance tweaks while using disk tier like threads,segements etc.
Reply all
Reply to author
Forward
0 new messages