]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commit
Improve Java API get() performance by reducing copies (#10970)
authorAlan Paxton <alan.paxton@gmail.com>
Wed, 21 Dec 2022 19:54:24 +0000 (11:54 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Wed, 21 Dec 2022 19:54:24 +0000 (11:54 -0800)
commitf8969ad7d4e4a3326c81be84d9b482bc77dc7451
treebe04520014da16ca111d4e095e39a96d4a79711f
parentdbf37c290ae0cbf1532f706942c098380cb9c53a
Improve Java API get() performance by reducing copies (#10970)

Summary:
Performance improvements for `get()` paths in the RocksJava API (JNI).
Document describing the performance results.

Replace uses of the legacy `DB::Get()` method wrapper returning data in a `std::string` with direct calls to `DB::Get()` passing a pinnable slice to receive this data. Copying from a pinned slice direct to the destination java byte array, without going via an intervening std::string, is a major performance gain for this code path.

Note that this gain only comes where `DB::Get()` is able to return a pinned buffer; where it has to copy into the buffer owned by the slice, there is still the intervening copy and no performance gain. It may be possible to address this case too, but it is not trivial.

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

Reviewed By: pdillinger

Differential Revision: D42125567

Pulled By: ajkr

fbshipit-source-id: b7a4df7523b0420cadb1e9b6c7da3ec030a8da34
java/GetBenchmarks.md [new file with mode: 0644]
java/jmh/pom.xml
java/jmh/src/main/java/org/rocksdb/jmh/GetBenchmarks.java
java/jmh/src/main/java/org/rocksdb/jmh/MultiGetBenchmarks.java
java/pom.xml.template
java/rocksjni/rocksjni.cc