Skip to content

Conversation

@Tim-Brooks
Copy link
Contributor

Java9 added a number of features that are useful to improve compression
and decompression. These include the Arrays#mismatch method and
VarHandles. This commit adds compression tools forked from the java-lz4
library which include these improvements.

This commit is a back port modification of #77153. As we target Java8 on
7.x, the Java9 methods are not available. This commit uses MethodHandles
to implement the Java9 perf methods if the JDK is JDK9+. Otherwise, it falls
back to legacy versions.

Java9 added a number of features that are useful to improve compression
and decompression. These include the Arrays#mismatch method and
VarHandles. This commit adds compression tools forked from the java-lz4
library which include these improvements. We hope to contribute these
changes back to the original project, however the project currently
supports Java7 so this is not possible at the moment.
@elasticmachine elasticmachine added the Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. label Sep 10, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

@Tim-Brooks
Copy link
Contributor Author

Only LZ4SafeUtils and SafeUtils vary from the 8.0 version.

@Tim-Brooks
Copy link
Contributor Author

Tim-Brooks commented Sep 10, 2021

I will add microbenchmarks soon.

@Tim-Brooks
Copy link
Contributor Author

Benchmark                                           Mode  Cnt     Score    Error  Units
MyBenchmark.testCompressLZ4Java                    thrpt   15   540.005 ±  6.667  ops/s
MyBenchmark.testCompressLZ4JavaForked              thrpt   15  1014.770 ±  3.755  ops/s
MyBenchmark.testCompressLZ4JavaForkedMH            thrpt   15  1019.950 ± 14.563  ops/s
MyBenchmark.testCompressLZ4JavaForkedMHFallback    thrpt   15   532.644 ±  2.028  ops/s
MyBenchmark.testDecompressLZ4Java                  thrpt   15  1518.632 ± 28.043  ops/s
MyBenchmark.testDecompressLZ4JavaForked            thrpt   15  3106.815 ± 82.369  ops/s
MyBenchmark.testDecompressLZ4JavaForkedMH          thrpt   15  3133.160 ± 10.002  ops/s
MyBenchmark.testDecompressLZ4JavaForkedMHFallback  thrpt   15  1407.144 ±  9.146  ops/s

These are benchmarks for the original lz4-java safe version, the varhandles "forked" version on 8.0, the method handle version, and the method handle version with forced fallback to pre-JDK9 behavior.

@Tim-Brooks
Copy link
Contributor Author

Closing. We backported using a MR jar.

@Tim-Brooks Tim-Brooks closed this Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed Coordination/Network Http and internode communication implementations >non-issue Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v7.16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants