From 4ad928e170e23f8a77ccc1a845b3a9af9cff139e Mon Sep 17 00:00:00 2001 From: Aaron Gao Date: Fri, 26 Aug 2016 11:36:14 -0700 Subject: [PATCH] add comment to SimCache to estimate actual capacity Summary: as title Test Plan: make all check Reviewers: yiwu Reviewed By: yiwu Subscribers: andrewkr, dhruba, leveldb Differential Revision: https://reviews.facebook.net/D62493 --- include/rocksdb/utilities/sim_cache.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/rocksdb/utilities/sim_cache.h b/include/rocksdb/utilities/sim_cache.h index 8ccef0560..039c66efd 100644 --- a/include/rocksdb/utilities/sim_cache.h +++ b/include/rocksdb/utilities/sim_cache.h @@ -23,6 +23,14 @@ class SimCache; // to predict block cache hit rate without actually allocating the memory. It // can help users tune their current block cache size, and determine how // efficient they are using the memory. +// +// Since GetSimCapacity() returns the capacity for simulutation, it differs from +// actual memory usage, which can be estimated as: +// sim_capacity * entry_size / (entry_size + block_size), +// where 76 <= entry_size <= 104, +// BlockBasedTableOptions.block_size = 4096 by default but is configurable, +// Therefore, generally the actual memory overhead of SimCache is Less than +// sim_capacity * 2% extern std::shared_ptr NewSimCache( std::shared_ptr cache, size_t sim_capacity, int num_shard_bits, std::shared_ptr stats = nullptr); -- GitLab