mirror of https://mirror.osredm.com/root/redis.git
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;
This commit is contained in:
parent
964f4a4576
commit
87786342a5
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue