On Thu, Mar 27, 2014 at 8:27 AM, Ravikumar Govindarajan <
It's not exactly a byte[].  Default configuration is a UnsafeCacheValue
wrapped by a DetachableCacheValue.  The UnsafeCacheValue allocates off heap
memory.  The DetachableCacheValue handles when the CacheValue is still in
use by some reference but needs to be evicted from the block cache.  So
when this occurs it copies the data from the UnsafeCacheValue (off heap) to
a ByteArrayCacheValue (on heap) and then the JVM handles things from
there.  However this situation doesn't happen very often.



Actually we don't.  If you look at this code:


You will see that we return the allocated memory to a pool once it has been
evicted from the cache.  The references in the CacheIndexInput doesn't
actually manage the memory, it only holds references to the cache.

Well we never cache 300 MB at once.  Since Lucene is heavy on random
access, it typically accesses small portions of the files rapidly.  And the
cache system caches 8 KB (by default) of file data at a time.  So if a file
has 300 MB present in the cache it is very likely that it is not in
contiguous memory.

Hope this helps.


NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB