Unverified Commit 87786342 authored by Chen Tianjie's avatar Chen Tianjie Committed by GitHub
Browse files

Correct bytes_per_key computing. (#12897)

Change the calculation method of bytes_per_key to make it closer to
the true average key size. The calculation method is as follows:

mh->bytes_per_key = mh->total_keys ? (mh->dataset / mh->total_keys) : 0;
parent 964f4a45
......@@ -1274,7 +1274,7 @@ struct redisMemOverhead *getMemoryOverheadData(void) {
if (zmalloc_used > mh->startup_allocated)
net_usage = zmalloc_used - mh->startup_allocated;
mh->dataset_perc = (float)mh->dataset*100/net_usage;
mh->bytes_per_key = mh->total_keys ? (net_usage / mh->total_keys) : 0;
mh->bytes_per_key = mh->total_keys ? (mh->dataset / mh->total_keys) : 0;
return mh;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment