rocksdb/db/db_impl
Peter Dillinger 3182beeffc Observe and warn about misconfigured HyperClockCache (#10965)
Summary:
Background. One of the core risks of chosing HyperClockCache is ending up with degraded performance if estimated_entry_charge is very significantly wrong. Too low leads to under-utilized hash table, which wastes a bit of (tracked) memory and likely increases access times due to larger working set size (more TLB misses). Too high leads to fully populated hash table (at some limit with reasonable lookup performance) and not being able to cache as many objects as the memory limit would allow. In either case, performance degradation is graceful/continuous but can be quite significant. For example, cutting block size in half without updating estimated_entry_charge could lead to a large portion of configured block cache memory (up to roughly 1/3) going unused.

Fix. This change adds a mechanism through which the DB periodically probes the block cache(s) for "problems" to report, and adds diagnostics to the HyperClockCache for bad estimated_entry_charge. The periodic probing is currently done with DumpStats / stats_dump_period_sec, and diagnostics reported to info_log (normally LOG file).

Pull Request resolved: https://github.com/facebook/rocksdb/pull/10965

Test Plan:
unit test included. Doesn't cover all the implemented subtleties of reporting, but ensures basics of when to report or not.

Also manual testing with db_bench. Create db with
```
./db_bench --benchmarks=fillrandom,flush --num=3000000 --disable_wal=1
```
Use and check LOG file for HyperClockCache for various block sizes (used as estimated_entry_charge)
```
./db_bench --use_existing_db --benchmarks=readrandom --num=3000000 --duration=20 --stats_dump_period_sec=8 --cache_type=hyper_clock_cache -block_size=XXXX
```
Seeing warnings / errors or not as expected.

Reviewed By: anand1976

Differential Revision: D41406932

Pulled By: pdillinger

fbshipit-source-id: 4ca56162b73017e4b9cec2cad74466f49c27a0a7
2022-11-21 12:08:21 -08:00
..
compacted_db_impl.cc Run clang-format on some files in db/db_impl directory (#10869) 2022-10-25 13:49:09 -07:00
compacted_db_impl.h Run clang-format on some files in db/db_impl directory (#10869) 2022-10-25 13:49:09 -07:00
db_impl.cc Observe and warn about misconfigured HyperClockCache (#10965) 2022-11-21 12:08:21 -08:00
db_impl.h Basic Support for Merge with user-defined timestamp (#10819) 2022-10-31 22:28:58 -07:00
db_impl_compaction_flush.cc Fix FIFO causing overlapping seqnos in L0 files due to overlapped seqnos between ingested files and memtable's (#10777) 2022-10-25 10:39:58 -07:00
db_impl_debug.cc Add manual_wal_flush, FlushWAL() to stress/crash test (#10698) 2022-09-30 15:48:33 -07:00
db_impl_experimental.cc
db_impl_files.cc Add new property in IOOptions to skip recursing through directories and list only files during GetChildren. (#10668) 2022-10-03 10:59:45 -07:00
db_impl_open.cc Run clang-format on some files in db/db_impl directory (#10869) 2022-10-25 13:49:09 -07:00
db_impl_readonly.cc
db_impl_readonly.h Run clang-format on some files in db/db_impl directory (#10869) 2022-10-25 13:49:09 -07:00
db_impl_secondary.cc Run clang-format on some files in db/db_impl directory (#10869) 2022-10-25 13:49:09 -07:00
db_impl_secondary.h Run clang-format on some files in db/db_impl directory (#10869) 2022-10-25 13:49:09 -07:00
db_impl_write.cc Basic Support for Merge with user-defined timestamp (#10819) 2022-10-31 22:28:58 -07:00