rocksdb/monitoring
Peter Dillinger d79be3dca2 Changes and enhancements to compression stats, thresholds (#11388)
Summary:
## Option API updates
* Add new CompressionOptions::max_compressed_bytes_per_kb, which corresponds to 1024.0 / min allowable compression ratio. This avoids the hard-coded minimum ratio of 8/7.
* Remove unnecessary constructor for CompressionOptions.
* Document undocumented CompressionOptions. Use idiom for default values shown clearly in one place (not precariously repeated).

 ## Stat API updates
* Deprecate the BYTES_COMPRESSED, BYTES_DECOMPRESSED histograms. Histograms incur substantial extra space & time costs compared to tickers, and the distribution of uncompressed data block sizes tends to be uninteresting. If we're interested in that distribution, I don't see why it should be limited to blocks stored as compressed.
* Deprecate the NUMBER_BLOCK_NOT_COMPRESSED ticker, because the name is very confusing.
* New or existing tickers relevant to compression:
  * BYTES_COMPRESSED_FROM
  * BYTES_COMPRESSED_TO
  * BYTES_COMPRESSION_BYPASSED
  * BYTES_COMPRESSION_REJECTED
  * COMPACT_WRITE_BYTES + FLUSH_WRITE_BYTES (both existing)
  * NUMBER_BLOCK_COMPRESSED (existing)
  * NUMBER_BLOCK_COMPRESSION_BYPASSED
  * NUMBER_BLOCK_COMPRESSION_REJECTED
  * BYTES_DECOMPRESSED_FROM
  * BYTES_DECOMPRESSED_TO

We can compute a number of things with these stats:
* "Successful" compression ratio: BYTES_COMPRESSED_FROM / BYTES_COMPRESSED_TO
* Compression ratio of data on which compression was attempted: (BYTES_COMPRESSED_FROM + BYTES_COMPRESSION_REJECTED) / (BYTES_COMPRESSED_TO + BYTES_COMPRESSION_REJECTED)
* Compression ratio of data that could be eligible for compression: (BYTES_COMPRESSED_FROM + X) / (BYTES_COMPRESSED_TO + X) where X = BYTES_COMPRESSION_REJECTED + NUMBER_BLOCK_COMPRESSION_REJECTED
* Overall SST compression ratio (compression disabled vs. actual): (Y - BYTES_COMPRESSED_TO + BYTES_COMPRESSED_FROM) / Y where Y = COMPACT_WRITE_BYTES + FLUSH_WRITE_BYTES

Keeping _REJECTED separate from _BYPASSED helps us to understand "wasted" CPU time in compression.

 ## BlockBasedTableBuilder
Various small refactorings, optimizations, and name clean-ups.

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

Test Plan:
unit tests added

* `options_settable_test.cc`: use non-deprecated idiom for configuring CompressionOptions from string. The old idiom is tested elsewhere and does not need to be updated to support the new field.

Reviewed By: ajkr

Differential Revision: D45128202

Pulled By: pdillinger

fbshipit-source-id: 5a652bf5c022b7ec340cf79018cccf0686962803
2023-04-21 21:57:40 -07:00
..
file_read_sample.h Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
histogram.cc clang format files under monitoring/ (#10857) 2022-10-24 20:45:54 -07:00
histogram.h clang format files under monitoring/ (#10857) 2022-10-24 20:45:54 -07:00
histogram_test.cc clang format files under monitoring/ (#10857) 2022-10-24 20:45:54 -07:00
histogram_windowing.cc clang format files under monitoring/ (#10857) 2022-10-24 20:45:54 -07:00
histogram_windowing.h clang format files under monitoring/ (#10857) 2022-10-24 20:45:54 -07:00
in_memory_stats_history.cc clang format files under monitoring/ (#10857) 2022-10-24 20:45:54 -07:00
in_memory_stats_history.h Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
instrumented_mutex.cc Inject spurious wakeup and sleep before acquiring db mutex to expose race condition (#10291) 2022-09-12 13:55:23 -07:00
instrumented_mutex.h clang format files under monitoring/ (#10857) 2022-10-24 20:45:54 -07:00
iostats_context.cc clang format files under monitoring/ (#10857) 2022-10-24 20:45:54 -07:00
iostats_context_imp.h Fix build error with NIOSTATS_CONTEXT (#10506) 2022-08-23 15:00:14 -07:00
iostats_context_test.cc clang format files under monitoring/ (#10857) 2022-10-24 20:45:54 -07:00
perf_context.cc Block fetch CPU time counters in perf context (#11342) 2023-04-15 11:09:44 -07:00
perf_context_imp.h Remove ROCKSDB_SUPPORT_THREAD_LOCAL define because it's a part of C++11 (#10015) 2022-05-18 15:25:19 -07:00
perf_level.cc clang format files under monitoring/ (#10857) 2022-10-24 20:45:54 -07:00
perf_level_imp.h clang format files under monitoring/ (#10857) 2022-10-24 20:45:54 -07:00
perf_step_timer.h clang format files under monitoring/ (#10857) 2022-10-24 20:45:54 -07:00
persistent_stats_history.cc clang format files under monitoring/ (#10857) 2022-10-24 20:45:54 -07:00
persistent_stats_history.h Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
statistics.cc Changes and enhancements to compression stats, thresholds (#11388) 2023-04-21 21:57:40 -07:00
statistics.h clang format files under monitoring/ (#10857) 2022-10-24 20:45:54 -07:00
statistics_test.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
stats_history_test.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
thread_status_impl.cc Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
thread_status_updater.cc Group rocksdb.sst.read.micros stat by IOActivity flush and compaction (#11288) 2023-04-21 09:07:18 -07:00
thread_status_updater.h Group rocksdb.sst.read.micros stat by IOActivity flush and compaction (#11288) 2023-04-21 09:07:18 -07:00
thread_status_updater_debug.cc Replace reinterpret_cast with static_cast_with_check (#7067) 2020-07-02 19:25:41 -07:00
thread_status_util.cc Group rocksdb.sst.read.micros stat by IOActivity flush and compaction (#11288) 2023-04-21 09:07:18 -07:00
thread_status_util.h Group rocksdb.sst.read.micros stat by IOActivity flush and compaction (#11288) 2023-04-21 09:07:18 -07:00
thread_status_util_debug.cc Group rocksdb.sst.read.micros stat by IOActivity flush and compaction (#11288) 2023-04-21 09:07:18 -07:00