[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]
Why the cache size will decrease when the off-heap memory is used up?  XML
Forum Index -> BigMemory
Author Message
lijie

journeyman

Joined: 09/04/2012 23:10:13
Messages: 19
Offline

I create an off-heap cache and set the cache MaxMemoryOffHeap = 10M.
Then I put data to the cache and print the cache size, the cache size info as:
cache.size = 100
cache.size = 200
cache.size = 300
cache.size = 400
cache.size = 500
cache.size = 600
cache.size = 700
cache.size = 800
...
cache.size = 6800
cache.size = 6900
cache.size = 7000
cache.size = 7100
cache.size = 7200
cache.size = 7300
cache.size = 7400
cache.size = 7500
cache.size = 7600
cache.size = 7700
cache.size = 7800
cache.size = 7890
cache.size = 7874
cache.size = 7860
cache.size = 7775
cache.size = 7717

cache.size = 7580
cache.size = 7477
cache.size = 7401
cache.size = 7359
cache.size = 7300
cache.size = 7265
cache.size = 7232
...

Maybe the off-heap size not given enough, so the cache size reach 7890 then decrease.
My question is :
Why the cache size not keep at 7890 but decrease ?
What data will be removed when the cache size reached the maxmum?
And how can I control its?
Thanks.
rajoshi

seraphim

Joined: 07/04/2011 04:36:10
Messages: 1491
Offline

The Cache.size you are printing here is giving the number of elements in cache and not the Offheap size. Few things here :

What is the element size you have , is it variable ? The eviction depend on size and if it's variable you may see more deviation from normal behavior.


As in your case once the number of elements are decreasing(breaching the defined size) it can be because of eviction. For this MemoryStoreEvictionPolicy attribute specified in the configuration file. Legal values are LRU (default), LFU and FIFO. You can refer to following link for more detail :

http://terracotta.org/documentation/bigmemorygo/configuration/storage-config




If you want to calculate the Offheap size you can use : CalculateOffHeapSize() but this has performance stakes so not recommended in production environment.


Hope this helps.

Rakesh Joshi
Senior Consultant
Terracotta.
rajoshi

seraphim

Joined: 07/04/2011 04:36:10
Messages: 1491
Offline

The Cache.size you are printing here is giving the number of elements in cache and not the Offheap size. Few things here :

What is the element size you have , is it variable ? The eviction depend on size and if it's variable you may see more deviation from normal behavior.


As in your case once the number of elements are decreasing(breaching the defined size) it can be because of eviction. For this MemoryStoreEvictionPolicy attribute specified in the configuration file. Legal values are LRU (default), LFU and FIFO. You can refer to following link for more detail :

http://terracotta.org/documentation/bigmemorygo/configuration/storage-config




If you want to calculate the Offheap size you can use : CalculateOffHeapSize() but this has performance stakes so not recommended in production environment.


Hope this helps.

Rakesh Joshi
Senior Consultant
Terracotta.
 
Forum Index -> BigMemory
Go to:   
Powered by JForum 2.1.7 © JForum Team