Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-11735

memcached 'total_free_bytes' & 'total_fragmentation_bytes' are incorrect

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 3.0
    • 2.5.1, 3.0
    • storage-engine
    • Security Level: Public
    • Untriaged
    • Centos 64-bit
    • Unknown

    Description

      The memory statistics 'total_free_bytes' and 'total_fragmentation_bytes' are calculated incorrectly, as they do not account for tcmalloc memory which is free and has been unmapped (returned to the OS). This means that the free memory is under-counted, and the fragmentation size is over-counted.

      Currently, we calculate 'total_free_bytes' from tcmalloc.pageheap_free_bytes, then calculate total_fragmentation_bytes as "heap_size - allocated - free" - see: http://src.couchbase.org/source/xref/3.0.0/memcached/daemon/alloc_hooks.c#157

      However, from the tcmalloc documentation [1] we see that actual free memory is sub-divided into two statistics:

      • tcmalloc.pageheap_free_bytes Number of bytes in free, mapped pages in page heap.
      • tcmalloc.pageheap_unmapped_bytes Number of bytes in free, unmapped pages in page heap.

      The free memory 'inside' the memcached process should be the sum of both of these statistics. In turn, due to us calculating this wrongly, total_fragmentation_bytes is also wrong.

      [1]: http://gperftools.googlecode.com/svn/trunk/doc/tcmalloc.html#compiletime

      ... patch incoming...

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            chiyoung Chiyoung Seo (Inactive)
            drigby Dave Rigby (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty