• Chen Tianjie's avatar
    Add overhead of all DBs and rehashing dict count to info. (#12913) · 4cae99e7
    Chen Tianjie authored
    
    
    Sometimes we need to make fast judgement about why Redis is suddenly
    taking more memory. One of the reasons is main DB's dicts doing
    rehashing.
    
    We may use `MEMORY STATS` to monitor the overhead memory of each DB, but
    there still lacks a total sum to show an overall trend. So this PR adds
    the total overhead of all DBs to `INFO MEMORY` section, together with
    the total count of rehashing DB dicts, providing some intuitive metrics
    about main dicts rehashing.
    
    This PR adds the following metrics to INFO MEMORY
    * `mem_overhead_db_hashtable_rehashing` - only size of ht[0] in
    dictionaries we're rehashing (i.e. the memory that's gonna get released
    soon)
    
    and a similar ones to MEMORY STATS:
    * `overhead.db.hashtable.lut` (complements the existing
    `overhead.hashtable.main` and `overhead.hashtable.expires` which also
    counts the `dictEntry` structs too)
    * `overhead.db.hashtable.rehashing` - temporary rehashing overhead.
    * `db.dict.rehashing.count` - number of top level dictionaries being
    rehashed.
    
    ---------
    Co-authored-by: default avatarzhaozhao.zz <zhaozhao.zz@alibaba-inc.com>
    Co-authored-by: default avatarOran Agra <oran@redislabs.com>
    4cae99e7
server.h 180 KB