[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]
Any idea why the off heap cache never drop out of from memory  XML
Forum Index -> BigMemory
Author Message
armyant

neo

Joined: 08/11/2014 22:33:24
Messages: 4
Offline

Hi all,

My cache configuration is set as follow, the timeToLiveSeconds is set to 5 minutes.

I've loaded something into this holding.historic cache.
I can see this by looking into the Jmxconsole via CacheMonitorService, however I can't see this cache drop out from the memory after 5 minutes.

If the cache is not set to use offHeap, I can see it drop out from memory without problem.

Anyone can give me a hand on this will be much appreciated. Cheers

<cache name="holdings.historic"
statistics="false"
maxEntriesLocalHeap="100"
maxBytesLocalOffHeap="3G"
eternal="false"
overflowToDisk="false"
copyOnRead="false"
memoryStoreEvictionPolicy="LFU"
overflowToOffHeap="True"
timeToLiveSeconds="300"
>
<searchable keys="false" values="false" >
<searchAttribute name="assetIDList" expression="value.getAssetIDList()"/>
<searchAttribute name="asAtMillis" expression="value.getAsAtDate().getTime()"/>
</searchable>
<persistence strategy="none"/>
</cache>
armyant

neo

Joined: 08/11/2014 22:33:24
Messages: 4
Offline

Or anyone can advise me which tool you are using to monitor the off heap memory. Possibly I can start my investigation of using those tool. Thanks
ljacomet

master

Joined: 03/06/2013 07:45:49
Messages: 79
Offline

  • OffHeap allocates all memory required at CacheManager / Cache initialization and never frees it for the lifetime of the JVM.
  • Ehcache does not have a background clean up, so removal of expired objects will happen in-line or when there is memory pressure and eviction kicks in
  • To monitor internal OffHeap use, look at statistics such as net.sf.ehcache.statistics.StatisticsGateway#getLocalOffHeapSizeInBytes

    Does the above answer your question?

  • Louis Jacomet
    Terracotta engineer
    armyant

    neo

    Joined: 08/11/2014 22:33:24
    Messages: 4
    Offline

    thanks so much for your reply, I'm really appreciated.

    Just want to confirm point 2 from you. Refer back to the cache configuration that I've set in my first post, does the attribute timeToLiveSeconds (TTL) applies to the object in the off heap?

    I presumed you are saying when the TTL becomes true for the object in the off heap, this object will be marked as expired, it will be removed whenever eviction kicks or memory pressure. Is that what you mean?

    In fact the situation we've got is almost 1G objects will be located in off heap per day. if the object never expire until JVM restarts, we will have serious trouble.
    ljacomet

    master

    Joined: 03/06/2013 07:45:49
    Messages: 79
    Offline

    Yes this is what I mean.

    But your use case will not be at risk because of that. Ehcache will make sure your offheap usage never goes above 3Gb.

    Louis Jacomet
    Terracotta engineer
     
    Forum Index -> BigMemory
    Go to:   
    Powered by JForum 2.1.7 © JForum Team