rocksdb/options
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
..
cf_options.cc Changes and enhancements to compression stats, thresholds (#11388) 2023-04-21 21:57:40 -07:00
cf_options.h Initial add UDT in memtable only option (#11362) 2023-04-11 17:50:34 -07:00
configurable.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
configurable_helper.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
configurable_test.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
configurable_test.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
customizable.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
customizable_test.cc Misc cleanup of block cache code (#11291) 2023-03-15 12:08:17 -07:00
db_options.cc Put Cache and CacheWrapper in new public header (#11192) 2023-02-09 12:12:02 -08:00
db_options.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
options.cc Group rocksdb.sst.read.micros stat by IOActivity flush and compaction (#11288) 2023-04-21 09:07:18 -07:00
options_helper.cc Initial add UDT in memtable only option (#11362) 2023-04-11 17:50:34 -07:00
options_helper.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
options_parser.cc Improve error message from SanityCheckCFOptions() for merge_operator (#11393) 2023-04-21 16:54:02 -07:00
options_parser.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
options_settable_test.cc Changes and enhancements to compression stats, thresholds (#11388) 2023-04-21 21:57:40 -07:00
options_test.cc Improve error message from SanityCheckCFOptions() for merge_operator (#11393) 2023-04-21 16:54:02 -07:00