wangyum opened a new pull request, #60775: URL: https://github.com/apache/spark/pull/60775
### What changes were proposed in this pull request? Tune the RocksDB `Options`/`BlockBasedTableConfig` used by `org.apache.spark.util.kvstore.RocksDB` (the KVStore backend behind the live Spark UI / `AppStatusStore`): - Switch bottommost-level compression from `ZSTD` to `LZ4` (non-bottommost levels already use `LZ4` and are unchanged). - Raise the block size from the default 4KB to 8KB. - Enlarge and batch memtable flushes: `writeBufferSize` 64MB → 128MB, `maxWriteBufferNumber` 2 → 4, `minWriteBufferNumberToMerge` 1 → 2. Also adds `RocksDBConfigBenchmark`, a new benchmark that drives the raw `org.rocksdb.RocksDB` engine directly with the old and new option sets side by side, isolating each of the three changes: - Bulk writes relying on auto-flush (write buffer behavior) - Explicit `compactRange()` after loading several SSTs (bottommost compression CPU + resulting disk size) - Random point lookups after compaction (block size decompression cost) ### Why are the changes needed? CPU profiling of a busy driver showed RocksDB background compaction (~29% of total process CPU, much of it `ZSTD` compression) and `BlockBasedTableBuilder::Flush` (~8% of total process CPU) as significant costs. This store backs the *live* UI: its data is short-lived by design (bounded by `spark.ui.retained*` / thriftserver `retained*` eviction), so `ZSTD`'s better compression ratio doesn't pay for itself, and the small (tens to a few hundred bytes) `TaskMetrics`/`JobInfo`/`StageInfo` records pay 4KB-block overhead (compress call, checksum, index entry) far more often than the data volume warrants. A local A/B benchmark run with `RocksDBConfigBenchmark` (Apple M2 Max, `core/benchmarks/RocksDBConfigBenchmark-results.txt`) shows: ``` Compact Range: Best Time(ms) Relative Old config 76 1.0X New config 9 8.1X Bulk Write: Best Time(ms) Relative Old config 5194 1.0X New config 4788 1.1X Random Get: Best Time(ms) Relative Old config 128 1.0X New config 126 1.0X ``` 8KB (rather than 16KB) was chosen for the block size specifically because the benchmark showed 16KB captured little additional compaction benefit over 8KB while measurably regressing point lookups; 8KB keeps point-lookup cost roughly unchanged. ### Does this PR introduce _any_ user-facing change? No. This only changes internal RocksDB tuning parameters for the live UI store; no API, configuration, or on-disk format changes are user-visible. ### How was this patch tested? - Added `RocksDBConfigBenchmark` and ran it locally; results committed to `core/benchmarks/RocksDBConfigBenchmark-results.txt`. - Ran the existing `RocksDBSuite`, `RocksDBIteratorSuite`, and `RocksDBTypeInfoSuite` (69 tests, all passing) to confirm the config change doesn't affect functional correctness. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Sonnet 5) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
