A library that provides an embeddable, persistent key-value store for fast storage.
Find a file
zaidoon a3ba3e8a6e
Some checks failed
facebook/rocksdb/pr-jobs / config (push) Has been cancelled
clang-tidy / clang-tidy (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-clang21-mini-tsan (0) (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-clang21-mini-tsan (1) (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-clang21-mini-tsan (2) (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-static_lib-alt_namespace-status_checked (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-windows-vs2022 (false, arena_test,db_basic_test,db_test2,db_merge_operand_test,bloom_test,c_test,coding_test,crc32c_test,dynamic_bloom_test,env_basic_test,env_test,hash_test,random_test, other) (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-windows-vs2022 (false, db_test, db_test) (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-windows-vs2022 (true, , java) (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-java (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-java-static (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-macos-java (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-macos-java-static (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-macos-cmake (0) (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-macos-cmake (1) (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-macos-cmake (2) (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-macos-cmake (3) (push) Has been cancelled
facebook/rocksdb/pr-jobs / check-format-and-targets (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-cmake-mingw (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-make-with-folly (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-make-with-folly-lite-no-test (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-gcc-14-no_test_run (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-cmake-with-folly-coroutines (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-cmake-with-benchmark-no-thread-status (0) (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-cmake-with-benchmark-no-thread-status (1) (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-cmake-with-benchmark-no-thread-status (2) (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-unity-and-headers (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-cmake-with-benchmark-no-thread-status (3) (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-encrypted_env-no_compression (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-release (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-clang-13-no_test_run (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-clang-21-no_test_run (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-mini-crashtest (240, blackbox_crash_test) (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-mini-crashtest (480, blackbox_crash_test_with_atomic_flush) (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-clang21-asan-ubsan (0) (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-clang21-asan-ubsan (1) (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-macos (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-clang21-asan-ubsan (2) (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-macos-java-static-universal (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-java-pmd (push) Has been cancelled
facebook/rocksdb/pr-jobs / build-linux-arm (push) Has been cancelled
Expose ReadOptions::optimize_multiget_for_io in the C API (#14752)
Summary:
The async MultiGet support introduced two `ReadOptions` flags: `async_io` and `optimize_multiget_for_io`. The setter/getter for `async_io` was exposed in the C API in [ff04fb154](ff04fb154b); the corresponding pair for `optimize_multiget_for_io` was not.

This PR adds `rocksdb_readoptions_set_optimize_multiget_for_io` and `rocksdb_readoptions_get_optimize_multiget_for_io`, mirroring the existing `async_io` pattern exactly.

## Motivation

The flag is consulted in `db/version_set.cc` only inside the `#if USE_COROUTINES` guard, so this setter has no behavioral effect in non-coroutine builds. It matters for:

1. **API parity** with the C++ surface and with the existing `async_io` C API. The two flags were introduced together as part of the async MultiGet feature; only exposing one is an oversight.

2. **CPU/latency tuning in `USE_COROUTINES` builds.** Per the [Asynchronous IO in RocksDB blog post](https://rocksdb.org/blog/2022/10/07/asynchronous-io-in-rocksdb.html), `async_io=true` with `optimize_multiget_for_io=false` (single-level parallel reads) ran 775 μs/op vs 508 μs/op with `optimize_multiget_for_io=true` (multi-level), with the latter incurring additional CPU overhead from coroutine scheduling. Without this setter, coroutine-enabled builds cannot reach the single-level configuration from C.

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

Reviewed By: mszeszko-meta

Differential Revision: D106080144

Pulled By: xingbowang

fbshipit-source-id: 28f12f07f29660392ba6ef7840b22804dab3567b
2026-05-23 04:38:23 -07:00
.github Fix "too many open files" failures in GitHub CI (#14755) 2026-05-18 23:15:12 -07:00
buckifier Update buckifier to use folly/coro instead of folly/experimental/coro (#14685) 2026-04-30 13:04:51 -07:00
build_tools Start development 11.4 (#14747) 2026-05-18 13:35:11 -07:00
cache Remove deprecated DB::Open raw pointer variants (and more) (#14335) 2026-02-17 23:33:39 -08:00
claude_md CI: AI review workflow improvements (#14659) 2026-04-30 09:37:58 -07:00
cmake Fix zstd typo in cmake (#12309) 2024-02-22 14:39:05 -08:00
coverage internal_repo_rocksdb 2024-10-14 03:01:20 -07:00
db Expose ReadOptions::optimize_multiget_for_io in the C API (#14752) 2026-05-23 04:38:23 -07:00
db_stress_tool Notify listeners before DB shutdown begins (#14769) 2026-05-22 12:32:11 -07:00
docs Resumable Remote Compaction Blog Post (#14759) 2026-05-19 14:35:43 -07:00
env Fix flaky preallocation tests on btrfs, zfs, tmpfs, and overlayfs (#14744) 2026-05-22 14:43:23 -07:00
examples Remove deprecated DB::Open raw pointer variants (and more) (#14335) 2026-02-17 23:33:39 -08:00
file Fix check-sources.sh non-ASCII check and remove non-ASCII from sources (#14729) 2026-05-11 17:02:22 -07:00
fuzz Remove deprecated DB::Open raw pointer variants (and more) (#14335) 2026-02-17 23:33:39 -08:00
githooks Fixes and enhancements to pre-push hook (#14680) 2026-04-28 15:56:32 -07:00
include/rocksdb Expose ReadOptions::optimize_multiget_for_io in the C API (#14752) 2026-05-23 04:38:23 -07:00
java Makefile fix and speed up 'clean' (#14767) 2026-05-22 17:34:53 -07:00
logging Remove deprecated DB::Open raw pointer variants (and more) (#14335) 2026-02-17 23:33:39 -08:00
memory Remove deprecated DB::Open raw pointer variants (and more) (#14335) 2026-02-17 23:33:39 -08:00
memtable Fix GetContext status propagation and blob-backed wide-column merge operands (#14640) 2026-05-12 15:29:27 -07:00
microbench Remove deprecated DB::Open raw pointer variants (and more) (#14335) 2026-02-17 23:33:39 -08:00
monitoring Add async WAL precreation 2026-05-15 10:59:47 -07:00
options Add async WAL precreation 2026-05-15 10:59:47 -07:00
plugin Add initial CMake support to plugin (#9214) 2021-11-30 17:16:53 -08:00
port Fix check-sources.sh non-ASCII check and remove non-ASCII from sources (#14729) 2026-05-11 17:02:22 -07:00
table Start development 11.4 (#14747) 2026-05-18 13:35:11 -07:00
test_util Add async WAL precreation 2026-05-15 10:59:47 -07:00
third-party Fix tests broken by gtest upgrade (#13661) 2025-06-04 10:44:17 -07:00
tools Guard db_bench DB lifetime with RWMutex against shutdown race (#14754) 2026-05-21 11:49:59 -07:00
trace_replay propagate request_id from app -> Rocks -> FS (#13616) 2025-05-16 21:25:50 -07:00
unreleased_history Expose ReadOptions::optimize_multiget_for_io in the C API (#14752) 2026-05-23 04:38:23 -07:00
util Start development 11.4 (#14747) 2026-05-18 13:35:11 -07:00
utilities Per-StressTest fault injection with env/fs cleanup (#14757) 2026-05-21 18:39:18 -07:00
wiki Add a new picking algorithm in fifo compaction (#14326) 2026-02-15 10:04:58 -08:00
.clang-format A script that automatically reformat affected lines 2014-01-14 12:21:24 -08:00
.clang-tidy 2026 02 21 accelerate ci (#14368) 2026-02-24 04:47:32 -08:00
.gitignore db_stress: document expected-state trace/replay contract (#14612) 2026-04-14 09:58:20 -07:00
.lgtm.yml Create lgtm.yml for LGTM.com C/C++ analysis (#4058) 2018-06-26 12:43:04 -07:00
.watchmanconfig Added .watchmanconfig file to rocksdb repo (#5593) 2019-07-19 15:00:33 -07:00
AGENTS.md db_stress: document expected-state trace/replay contract (#14612) 2026-04-14 09:58:20 -07:00
AUTHORS Update RocksDB Authors File 2017-10-18 14:42:10 -07:00
BUCK Update buckifier to use folly/coro instead of folly/experimental/coro (#14685) 2026-04-30 13:04:51 -07:00
ccache_msvc_compiler.bat Use ccache to accelerate windows build (#14064) 2025-10-20 10:37:08 -07:00
CLAUDE.md Fix crash test failures in OnCompactionPreCommit listener checks (#14753) 2026-05-18 22:31:46 -07:00
CMakeLists.txt Start development 11.4 (#14747) 2026-05-18 13:35:11 -07:00
CODE_OF_CONDUCT.md Adopt Contributor Covenant 2019-08-29 23:21:01 -07:00
common.mk Clean up variables for temporary directory (#9961) 2022-05-06 16:38:06 -07:00
CONTRIBUTING.md Add Code of Conduct 2017-12-05 18:42:35 -08:00
COPYING Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
crash_test.mk env: suppress liburing TSAN false positives (#14710) 2026-05-07 16:40:56 -07:00
DEFAULT_OPTIONS_HISTORY.md Add Options::DisableExtraChecks, clarify force_consistency_checks (#9363) 2022-01-18 17:31:03 -08:00
Directory.Build.props Use ccache to accelerate windows build (#14064) 2025-10-20 10:37:08 -07:00
DUMP_FORMAT.md First version of rocksdb_dump and rocksdb_undump. 2015-06-19 16:24:36 -07:00
folly.mk Start development 11.4 (#14747) 2026-05-18 13:35:11 -07:00
HISTORY.md Start development 11.4 (#14747) 2026-05-18 13:35:11 -07:00
INSTALL.md Require C++20 (#13904) 2025-08-28 16:59:16 -07:00
issue_template.md Add Google Group to Issue Template 2020-01-28 14:40:37 -08:00
LANGUAGE-BINDINGS.md Add python binding to LANGUAGE-BINDINGS.md (#13391) 2025-02-10 17:38:40 -08:00
LICENSE.Apache Change RocksDB License 2017-07-15 16:11:23 -07:00
LICENSE.leveldb Add back the LevelDB license file 2017-07-16 18:42:18 -07:00
Makefile Makefile fix and speed up 'clean' (#14767) 2026-05-22 17:34:53 -07:00
PLUGINS.md Add encfs plugin link (#12070) 2023-11-14 07:33:21 -08:00
README.md Remove deprecated integration tests from README.md (#11354) 2023-04-07 16:52:50 -07:00
rocksdb.pc.in build: fix pkg-config file generation (#9953) 2022-05-30 12:46:40 -07:00
src.mk Wide-column blob separation: lazy resolution through read, compaction, and write paths (#14386) 2026-04-08 18:58:40 -07:00
thirdparty.inc Fix build jemalloc api (#5470) 2019-06-24 17:40:32 -07:00
USERS.md Add Venice as a RocksDB user (#13179) 2024-12-05 12:09:44 -08:00
Vagrantfile Adding CentOS 7 Vagrantfile & build script 2018-02-26 15:27:17 -08:00
WINDOWS_PORT.md Update branch name in WINDOWS_PORT.md (#8745) 2021-09-01 19:26:39 -07:00

RocksDB: A Persistent Key-Value Store for Flash and RAM Storage

CircleCI Status

RocksDB is developed and maintained by Facebook Database Engineering Team. It is built on earlier work on LevelDB by Sanjay Ghemawat (sanjay@google.com) and Jeff Dean (jeff@google.com)

This code is a library that forms the core building block for a fast key-value server, especially suited for storing data on flash drives. It has a Log-Structured-Merge-Database (LSM) design with flexible tradeoffs between Write-Amplification-Factor (WAF), Read-Amplification-Factor (RAF) and Space-Amplification-Factor (SAF). It has multi-threaded compactions, making it especially suitable for storing multiple terabytes of data in a single database.

Start with example usage here: https://github.com/facebook/rocksdb/tree/main/examples

See the github wiki for more explanation.

The public interface is in include/. Callers should not include or rely on the details of any other header files in this package. Those internal APIs may be changed without warning.

Questions and discussions are welcome on the RocksDB Developers Public Facebook group and email list on Google Groups.

License

RocksDB is dual-licensed under both the GPLv2 (found in the COPYING file in the root directory) and Apache 2.0 License (found in the LICENSE.Apache file in the root directory). You may select, at your option, one of the above-listed licenses.