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
This commit is contained in:
Aaron Gao 2016-08-26 11:36:14 -07:00
parent e9b2af87f8
commit 4ad928e170

View file

@ -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<SimCache> NewSimCache(
std::shared_ptr<Cache> cache, size_t sim_capacity, int num_shard_bits,
std::shared_ptr<Statistics> stats = nullptr);