diff --git a/clickhouse-http-client/pom.xml b/clickhouse-http-client/pom.xml index 1cd6de96d..0cae59606 100644 --- a/clickhouse-http-client/pom.xml +++ b/clickhouse-http-client/pom.xml @@ -129,7 +129,7 @@ com.clickhouse:clickhouse-data com.clickhouse:clickhouse-client - org.lz4:lz4-pure-java + org.lz4:lz4-java diff --git a/clickhouse-jdbc/pom.xml b/clickhouse-jdbc/pom.xml index b80607310..0874e3676 100644 --- a/clickhouse-jdbc/pom.xml +++ b/clickhouse-jdbc/pom.xml @@ -48,7 +48,7 @@ org.lz4 - lz4-pure-java + lz4-java com.google.code.gson @@ -425,7 +425,7 @@ org.apache.httpcomponents.core5:httpcore5 org.apache.httpcomponents.core5:httpcore5-h2 com.clickhouse:jdbc-v2 - org.lz4:lz4-pure-java + org.lz4:lz4-java @@ -495,7 +495,7 @@ org.apache.httpcomponents.client5:httpclient5 org.apache.httpcomponents.core5:httpcore5 org.apache.httpcomponents.core5:httpcore5-h2 - org.lz4:lz4-pure-java + org.lz4:lz4-java com.clickhouse:jdbc-v2 com.clickhouse:client-v2 @@ -573,7 +573,7 @@ com.clickhouse:clickhouse-data com.clickhouse:clickhouse-client com.clickhouse:clickhouse-http-client - org.lz4:lz4-pure-java + org.lz4:lz4-java diff --git a/client-v2/docs/dependencies.md b/client-v2/docs/dependencies.md index 0aeae5a3c..693bef8d3 100644 --- a/client-v2/docs/dependencies.md +++ b/client-v2/docs/dependencies.md @@ -12,7 +12,7 @@ the document keeps historical information about the dependencies. - `com.clickhouse:clickhouse-client:jar:0.7.1-patch1-SNAPSHOT:compile` - Required because there is an option to use client-v1. Additionally, this dependency is required because a few core classes like `ClickHouseNode` are used in client-v2. When client-v1 is deprecated - all required classes should be moved to client-v2 module and this dependency will be removed. - `org.slf4j:slf4j-api:jar:2.0.7:compile` - Most commonly used logging frontend. - `org.apache.commons:commons-compress:jar:1.27.1:compile` - Required for compression. - - `org.lz4:lz4-pure-java:jar:1.8.0:compile` - Required for compression. + - `org.lz4:lz4-java:jar:1.8.0:compile` - Required for compression. - `org.ow2.asm:asm:jar:9.7:compile` - Required for serialization/deserialization. - `org.apache.httpcomponents.client5:httpclient5:jar:5.3.1:compile` - only HTTP client that is currently supported. In the future it should be an optional dependency when support for different clients will be added. This client also implements async API that might be used in the future. - `com.fasterxml.jackson.core:jackson-core:jar:2.17.2:compile` - used to safely parse summary from ClickHouse. diff --git a/client-v2/pom.xml b/client-v2/pom.xml index 1c6408799..b201227a2 100644 --- a/client-v2/pom.xml +++ b/client-v2/pom.xml @@ -53,7 +53,7 @@ org.lz4 - lz4-pure-java + lz4-java ${lz4.version} diff --git a/jdbc-v2/pom.xml b/jdbc-v2/pom.xml index aa8fb4a2a..cef308f1b 100644 --- a/jdbc-v2/pom.xml +++ b/jdbc-v2/pom.xml @@ -52,7 +52,7 @@ org.lz4 - lz4-pure-java + lz4-java true @@ -173,7 +173,7 @@ org.apache.httpcomponents.client5:httpclient5 org.apache.httpcomponents.core5:httpcore5 org.apache.httpcomponents.core5:httpcore5-h2 - org.lz4:lz4-pure-java + org.lz4:lz4-java @@ -311,7 +311,7 @@ com.clickhouse:clickhouse-data com.clickhouse:client-v2 com.clickhouse:clickhouse-http-client - org.lz4:lz4-pure-java + org.lz4:lz4-java diff --git a/performance/src/test/com/clickhouse/benchmark/BenchmarkRunner.java b/performance/src/test/com/clickhouse/benchmark/BenchmarkRunner.java index b9f4766d0..88a3fe769 100644 --- a/performance/src/test/com/clickhouse/benchmark/BenchmarkRunner.java +++ b/performance/src/test/com/clickhouse/benchmark/BenchmarkRunner.java @@ -39,17 +39,17 @@ public static void main(String[] args) throws Exception { Map argMap = parseArguments(args); Options opt = new OptionsBuilder() - .include(QueryClient.class.getName()) - .include(InsertClient.class.getName()) - .include(ConcurrentInsertClient.class.getName()) - .include(ConcurrentQueryClient.class.getName()) +// .include(QueryClient.class.getName()) +// .include(InsertClient.class.getName()) +// .include(ConcurrentInsertClient.class.getName()) +// .include(ConcurrentQueryClient.class.getName()) .include(Compression.class.getName()) - .include(Serializers.class.getName()) - .include(Deserializers.class.getName()) - .include(MixedWorkload.class.getName()) - .include(DataTypes.class.getName()) - .include(JDBCQuery.class.getName()) - .include(JDBCInsert.class.getName()) +// .include(Serializers.class.getName()) +// .include(Deserializers.class.getName()) +// .include(MixedWorkload.class.getName()) +// .include(DataTypes.class.getName()) +// .include(JDBCQuery.class.getName()) +// .include(JDBCInsert.class.getName()) .forks(1) // must be a fork. No fork only for debugging .mode(Mode.SampleTime) .timeUnit(TimeUnit.MILLISECONDS) diff --git a/performance/src/test/com/clickhouse/benchmark/clients/Compression.java b/performance/src/test/com/clickhouse/benchmark/clients/Compression.java index b1b58c53c..773bd7339 100644 --- a/performance/src/test/com/clickhouse/benchmark/clients/Compression.java +++ b/performance/src/test/com/clickhouse/benchmark/clients/Compression.java @@ -30,6 +30,10 @@ public void CompressingOutputStreamV1(DataState dataState) { } private static final LZ4Factory factory = LZ4Factory.fastestInstance(); + private static final LZ4Factory nativeFactory = LZ4Factory.nativeInstance(); + private static final LZ4Factory javaSafeFactory = LZ4Factory.safeInstance(); + private static final LZ4Factory javaUnSafeFactory = LZ4Factory.safeInstance(); + @Benchmark public void CompressingOutputStreamV2(DataState dataState) { @@ -44,4 +48,47 @@ public void CompressingOutputStreamV2(DataState dataState) { LOGGER.error("Error: ", e); } } + + @Benchmark + public void CompressingOutputStreamV2Native(DataState dataState) { + DataSet dataSet = dataState.dataSet; + try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ClickHouseLZ4OutputStream out = new ClickHouseLZ4OutputStream(baos, + nativeFactory.fastCompressor(), COMPRESS_BUFFER_SIZE)) { + for (byte[] bytes : dataSet.getBytesList(dataSet.getFormat())) { + out.write(bytes); + } + } catch (Exception e) { + LOGGER.error("Error: ", e); + } + } + + @Benchmark + public void CompressingOutputStreamV2Unsafe(DataState dataState) { + DataSet dataSet = dataState.dataSet; + try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ClickHouseLZ4OutputStream out = new ClickHouseLZ4OutputStream(baos, + javaUnSafeFactory.fastCompressor(), COMPRESS_BUFFER_SIZE)) { + for (byte[] bytes : dataSet.getBytesList(dataSet.getFormat())) { + out.write(bytes); + } + } catch (Exception e) { + LOGGER.error("Error: ", e); + } + } + + @Benchmark + public void CompressingOutputStreamV2safe(DataState dataState) { + DataSet dataSet = dataState.dataSet; + try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ClickHouseLZ4OutputStream out = new ClickHouseLZ4OutputStream(baos, + javaSafeFactory.fastCompressor(), COMPRESS_BUFFER_SIZE)) { + for (byte[] bytes : dataSet.getBytesList(dataSet.getFormat())) { + out.write(bytes); + } + } catch (Exception e) { + LOGGER.error("Error: ", e); + } + } + } diff --git a/pom.xml b/pom.xml index 48f65a7e2..6b5314480 100644 --- a/pom.xml +++ b/pom.xml @@ -281,12 +281,12 @@ org.lz4 - lz4-java + lz4-pure-java ${lz4.version} org.lz4 - lz4-pure-java + lz4-java ${lz4.version}