java - ehcache memorystoresize and diskstoresize -
[avatar] 2010-09-23 18:20:41 ist have following configuration ehcache.
<cachemanager dynamicconfig="true" monitoring="autodetect" name="cachemanager1"    updatecheck="true"> <diskstore path="java.io.tmpdir" /> <defaultcache    clearonflush="true" copyonread="false" copyonwrite="false" diskaccessstripes="1"    diskexpirythreadintervalseconds="5" diskpersistent="true" diskspoolbuffersizemb="20"    eternal="true" logging="true" maxelementsinmemory="100" maxelementsondisk="100"    memorystoreevictionpolicy="lru" name="cache1" overflowtodisk="true" statistics="true"    timetoidleseconds="0" timetoliveseconds="60" transactionalmode="off"> </defaultcache>    <cache clearonflush="true" copyonread="false" copyonwrite="false" diskaccessstripes="1"    diskexpirythreadintervalseconds="5" diskpersistent="true" diskspoolbuffersizemb="20"    eternal="true" logging="true" maxelementsinmemory="100" maxelementsondisk="100"    memorystoreevictionpolicy="lru" name="cache1" overflowtodisk="true" statistics="true"    timetoidleseconds="0" timetoliveseconds="60" transactionalmode="off"> </cache>        </cachemanager>    the maxelementsinmemorystore , maxelementsondiskstore set 100. have put 150 elements in cache. when query memorystoresize , diskstoresize 138 , 15. not understand sizes returned. can please explain why so??
i found reason memorystoresize > maxelementsinmemory here. when size of memorystore has been exceeded, further calls put() cause elements pushed overflow (disk spool) queue, flushed disk asynchronously using worker thread.  disk spool queue 300mb default, , gets flushed when full (or @ shutdown, if cache persistent).
the call memorystoresize returns sum of elements in memorystore , in disk spool queue.
some elements may in queue , on disk @ same time, explains why 2 numbers not sum 150.
Comments
Post a Comment