Profile-Guided Optimization (PGO) and RocksDB

49 views
Skip to first unread message

zamazan4ik

unread,
Jul 3, 2023, 8:05:01 PM7/3/23
to rocksdb
Hi!

I am trying to estimate Profile-Guided Optimization (PGO) applications for RocksDB performance. Did anyone try to apply PGO on RocksDB and measure the improvements?

I did some measurements on my local machines and see some consistent results. If you can suggest more robust methodology to test RocksDB - please share with me (thanks in advance).

# Test environment:

* Fedora 38
* Linux kernel 6.3.7
* AMD Ryzen 9 5900x
* 48 Gib RAM
* SSD Samsung 980 Pro 2 Tib
* Clang 16 (from the Fedora repositories). I use Clang just because I prefer LLVM-based tooling
* RocksDB version: main branch (commit 15053f3ab47839bc14dc31a8a62df1d23f6babbe)

# Benchmark As a simple benchmark, I use db_bench (via benchmark.sh) with the following command: `DB_DIR=db_dir WAL_DIR=wal_dir OUTPUT_DIR=output_dir DB_BENCH_NO_SYNC=1 COMPRESSION_TYPE=none NUM_THREADS=24 DURATION=300 benchmark.sh readrandom`.
I use this command as a training and benchmark tool.

RocksDB built with `CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release -G Ninja ../rocksdb`. As a PGO technique, I use `-fprofile-instr-generate`/`-fprofile-instr-use` Instrumentation mode from Clang.

# Results

Here are results for usual "Release" build and "Release with PGO". In "Release with PGO" results shown for PGOed librocks.so and non-PGOed db_bench tool (so we can measure improvements only on RocksDB side). Format of the reports - a part of the "benchmark.sh" output. I performed the measurements multiple times, on the same machine, with the same hardware, etc - the results are consistent on my machine.
Release: DB path: [db_dir]
readrandom   :       0.447 micros/op 53642638 ops/sec 300.001 seconds 16092868976 operations; (0 of 667309999 found)

Release + PGO:

DB path: [db_dir]
readrandom   :       0.431 micros/op 55658391 ops/sec 300.004 seconds 16697714976 operations; (0 of 699368999 found) I hope these results will be useful for someone. If you can suggest me a more robust benchmark (like ClickBench) - it would be awesome to test PGO effects on it too.

Dan Carfas

unread,
Jul 4, 2023, 5:01:25 PM7/4/23
to zamazan4ik, rocksdb
From the Speedb Hive:

Thanks for sharing here are a few comments:
doing read only test without writing data means that the code of rocksdb is almost null. To do the read test one need to use fill(seq or random) first.
there are few more tests that can be done and are cpu intensive please contact us if you like to define one

You can find the Speedb hive here and (once you've registered) the link to the thread with your question here, if you have more questions or need additional info

--
You received this message because you are subscribed to the Google Groups "rocksdb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rocksdb+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rocksdb/85a1c254-c9e4-4156-b2c1-0502ce1e9997n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages