[ 
https://issues.apache.org/jira/browse/GEODE-996?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15169866#comment-15169866
 ] 

Sai Boorlagadda commented on GEODE-996:
---------------------------------------

Comparing currentFragmentCount with initialSlabCount can be wrong if all 
current fragments are in one slab, which case we wanted it to be heavily 
fragmented rather than 0. Instead we can compare freeMomory with totalMemory.

So I propose the logic be:

{code}
if (currentFragments < 2)
    fragmentation = 0;
else {
   if(freeMemory == totalMemory)
      fragmentation = 0;
   else
      fragmentation =  (currentFragmentCount / (freeMemory / 
ObjectChunk.MIN_CHUNK_SIZE)) * 100.0
}
{code}


> OffheapStats - fragmentation percentage calculation has to be revisited.
> ------------------------------------------------------------------------
>
>                 Key: GEODE-996
>                 URL: https://issues.apache.org/jira/browse/GEODE-996
>             Project: Geode
>          Issue Type: Bug
>          Components: docs, offheap
>            Reporter: Sai Boorlagadda
>
> Fragmentation calculation is not correct before compaction or even after 
> compaction if the largest fragment is >= MAX_SLAB_SIZE.
> Currently the fragmentation is calculated as below. 
> {quote}
>     FS - LF
>  -----------   * 100
>        FS
> FS: Free space found during compaction
> LF: Largest fragment found during compaction
> {quote}
> eg: 
> For a free space of 100G and largest fragment = 2G (MAX_SLAB_SIZE)
> Fragmentation = (100G - 2G / 100G) * 100 ~ 98% (where as we want it to be 
> close to 0 as the free space is not fragmented)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to