4

The EHCache used by DXA is detected as a leak in our heapdump because it's arriving to get 1Gb of it. I guess EHCache is not at all a good implementation for large/intensive systems were an external cache is more useful, we are considering to disable the DD4T cache but we don't know yet how this could affect the performance & throughput of our application.

Is there a way to disable EHCache from the DXA framework? This is our conf

<cache name="DD4T-Objects"
       eternal="false"
       maxBytesLocalHeap="100m"
       timeToLiveSeconds="3600"
       timeToIdleSeconds="3600"
       memoryStoreEvictionPolicy="LRU">
</cache>
<cache name="DD4T-Dependencies"
       maxBytesLocalHeap="100m"
       timeToLiveSeconds="3600"
       timeToIdleSeconds="3600"
       memoryStoreEvictionPolicy="LRU">
</cache>
3
  • It was brought to my attention last week that there were some memory leaks identified in DD4T Java which have been fixed with the latest release (May 10, 2017 github.com/dd4t/dd4t-2-java/releases/tag/2.1.0-beta). We need to look into the possibility of using this with DXA, and if these are the same as you mention. Commented May 15, 2017 at 9:44
  • @Bart, I checked the code in github and couldn't detect any issue regarding this github.com/dd4t/dd4t-2-java/…. Or is it solved in the open enhacenment Refactor caching classes github.com/dd4t/dd4t-2-java/issues/74
    – tfinez
    Commented May 16, 2017 at 11:04
  • I'm not sure if it was listed as an issue, but reading Raimonds response, what you are experiencing isn't related to any issues addressed in the latest release. Commented May 16, 2017 at 11:37

1 Answer 1

6

That EHCache uses a lot of memory makes sense, since when caching is turned on, it will use the configured amount of memory to store items.

If you disable cache, be prepared to take a big performance hit. All models and items generated and fetched from the Tridion Broker database will always happen. Turning on the Tridion Object Cache will essentially move the memory problem to that area - you will see that in your monitoring / profiling the memory used there will then also start to spike.

The solution would be to limit the amount of items EHCache can store per server / JVM. You can add a maxBytesLocalHeap attribute to ehcache.xml to really limit on memory. More information can be found here. Note that you will have to remove the maxEntriesLocalHeap attribute for it to work.

An alternative can be to for instance move to Terracotta. DD4T can do this OOTB with some reconfiguration, but it would require major infrastructural changes.

Update

There appeared to be a bug in DD4T's EHCacheProvider after all , but it has nothing to do with a memory leak. When an item was put into cache with a null value and populated later, EHCache didnt recalculate the size if the item was not re-put in the cache.

Should be fixed in DD4T 2.0.9 with this commit.

8
  • Thank you Raimond. Our weird behavior was that despite of fixing the maximun size in the ehcache.xml file, the instances in memory are arriving to 1GB, so we guess that the code is not taking into consideration this conf:
    – tfinez
    Commented May 15, 2017 at 11:12
  • Just checked that. DD4T doesnt have any configuration done in code. What is required is that you need to remove the maxEntriesLocalHeap attribute for the memory setting to be picked up.
    – Raimond
    Commented May 15, 2017 at 11:49
  • @tfinez - could it be that simply your ehcache.xml isnt picked up at all?
    – Raimond
    Commented May 15, 2017 at 12:01
  • we created a controller for debugging issues and we checked that it was getting the values configured
    – tfinez
    Commented May 16, 2017 at 11:01
  • So is it fixed now? If not - it maybe an issue in EHCache itself..
    – Raimond
    Commented May 16, 2017 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.