Skip to content

Commit 75b0264

Browse files
committed
update README to document the various crate features that can be enabled
Also remove unused code in ci workflow
1 parent 4a6bb9d commit 75b0264

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

.github/workflows/rust.yml

-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ jobs:
7777

7878
- name: Install rust
7979
uses: dtolnay/rust-toolchain@stable
80-
with:
81-
target: ${{ matrix.target }}
8280

8381
- name: Remove msys64 # Workaround to resolve link error with C:\msys64\mingw64\bin\libclang.dll
8482
if: runner.os == 'Windows'

README.md

+32-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ compression submodules:
3737
git submodule update --init --recursive
3838
```
3939

40-
## Compression Support
40+
## Features
41+
42+
### Compression Support
4143

4244
By default, support for [Snappy](https://github.com/google/snappy),
4345
[LZ4](https://github.com/lz4/lz4), [Zstd](https://github.com/facebook/zstd),
@@ -53,7 +55,7 @@ default-features = false
5355
features = ["lz4"]
5456
```
5557

56-
## Multithreaded ColumnFamily alternation
58+
### Multithreaded ColumnFamily alternation
5759

5860
RocksDB allows column families to be created and dropped
5961
from multiple threads concurrently, but this crate doesn't allow it by default
@@ -62,9 +64,36 @@ the crate feature `multi-threaded-cf`, which makes this binding's
6264
data structures use `RwLock` by default. Alternatively, you can directly create
6365
`DBWithThreadMode<MultiThreaded>` without enabling the crate feature.
6466

65-
## Switch between /MT or /MD run time library (Only for Windows)
67+
### Switch between /MT or /MD run time library (Only for Windows)
6668

6769
The feature `mt_static` will request the library to be built with [/MT](https://learn.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library?view=msvc-170)
6870
flag, which results in library using the static version of the run-time library.
6971
*This can be useful in case there's a conflict in the dependecy tree between different
7072
run-time versions.*
73+
74+
### Jemalloc
75+
76+
The feature `jemalloc` will enable the
77+
`unprefixed_malloc_on_supported_platforms` feature of `tikv-jemalloc-sys`,
78+
hooking the actual malloc and free, so jemalloc is used to allocate memory. On
79+
Supported platforms such as Linux, Rocksdb will also be properly informed that
80+
Jemalloc is enabled so that it can apply internal optimizations gated behind
81+
Jemalloc being enabled. On [unsupported
82+
platforms](https://github.com/zaidoon1/rust-rocksdb/blob/master/librocksdb-sys/build.rs#L4-L7),
83+
Rocksdb won't be properly
84+
informed that Jemalloc is being used so some internal optimizations are skipped
85+
BUT you will still get the benefits of Jemalloc memory allocation. Note that by
86+
default, Rust uses libc malloc on Linux which is known to have more memory
87+
fragmentation than Jemalloc especially with Rocksdb. See [github
88+
issue](https://github.com/facebook/rocksdb/issues/12364) for more information.
89+
In general, I highly suggest enabling Jemalloc unless there is a specific reason
90+
not to (your system doesn't support it, etc.)
91+
92+
### Malloc Usable Size
93+
94+
The feature `malloc-usable-size` will inform Rocksdb that malloc_usable_size is
95+
supported by the platform and is necessary if you want to use the
96+
`optimize_filters_for_memory` rocksdb feature as this feature is gated behind
97+
malloc_usable_size being available. See
98+
[rocksdb](https://github.com/facebook/rocksdb/blob/v9.0.0/include/rocksdb/table.h#L401-L434)
99+
for more information on the feature.

0 commit comments

Comments
 (0)