Skip to content

Commit d38b0f9

Browse files
committed
added option to test without compression
1 parent 6ba434a commit d38b0f9

File tree

4 files changed

+7
-23
lines changed

4 files changed

+7
-23
lines changed

performance/src/test/com/clickhouse/benchmark/BenchmarkRunner.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.clickhouse.benchmark;
22

33

4-
import com.clickhouse.benchmark.clients.BenchmarkBase;
54
import com.clickhouse.benchmark.clients.Components;
65
import com.clickhouse.benchmark.clients.InsertClient;
76
import com.clickhouse.benchmark.clients.QueryClient;
@@ -31,17 +30,15 @@ public static void main(String[] args) throws Exception {
3130
Map<String, String> argMap = parseArguments(args);
3231

3332
Options opt = new OptionsBuilder()
34-
// .param("datasetSourceName", argMap.getOrDefault("dataset", "simple"))
35-
// .include(QueryClient.class.getSimpleName())
36-
// .include(InsertClient.class.getSimpleName())
33+
.include(QueryClient.class.getSimpleName())
34+
.include(InsertClient.class.getSimpleName())
3735
.include(Components.class.getSimpleName())
3836
.forks(1) // must be a fork. No fork only for debugging
3937
.mode(Mode.AverageTime)
4038
.timeUnit(TimeUnit.MILLISECONDS)
4139
.threads(1)
4240
.addProfiler(GCProfiler.class)
4341
.addProfiler(MemPoolProfiler.class)
44-
.addProfiler("async", "libPath=/Users/mark.zitnik/Downloads/async-profiler-3.0-macos/lib/libasyncProfiler.dylib;output=flamegraph;dir=profile-results;event=alloc")
4542
.warmupIterations(0)
4643
.warmupTime(TimeValue.seconds(10))
4744
.measurementIterations(10)

performance/src/test/com/clickhouse/benchmark/clients/BenchmarkBase.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ public static class DataState {
8181
String tableNameFilled;
8282
@Param({"data_empty"})
8383
String tableNameEmpty;
84+
85+
@Param({"true"})
86+
boolean useClientCompression = true;
8487
DataSet dataSet;
8588

8689
public void setDataSet(DataSet dataSet) {

performance/src/test/com/clickhouse/benchmark/clients/Components.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@
44
import com.clickhouse.client.api.internal.ClickHouseLZ4OutputStream;
55
import com.clickhouse.data.ClickHouseOutputStream;
66
import com.clickhouse.data.stream.Lz4OutputStream;
7-
import net.jpountz.lz4.LZ4Compressor;
87
import net.jpountz.lz4.LZ4Factory;
98
import org.openjdk.jmh.annotations.Benchmark;
10-
import org.openjdk.jmh.annotations.Level;
11-
import org.openjdk.jmh.annotations.Setup;
12-
import org.openjdk.jmh.annotations.TearDown;
139
import org.slf4j.Logger;
1410
import org.slf4j.LoggerFactory;
1511

@@ -18,18 +14,6 @@
1814
public class Components extends BenchmarkBase {
1915
private static final Logger LOGGER = LoggerFactory.getLogger(Components.class);
2016

21-
@Setup(Level.Trial)
22-
public void setup(DataState dataState) throws Exception {
23-
super.setup(dataState, false);
24-
}
25-
26-
27-
@TearDown(Level.Invocation)
28-
public void tearDownIteration(DataState dataState) {
29-
verifyRowsInsertedAndCleanup(dataState.dataSet, false);
30-
}
31-
32-
3317
@Benchmark
3418
public void CompressingOutputStreamV1(DataState dataState) {
3519
DataSet dataSet = dataState.dataSet;

performance/src/test/com/clickhouse/benchmark/clients/InsertClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public void insertV1(DataState dataState) {
4242
try (ClickHouseResponse response = clientV1.read(getServer())
4343
.write()
4444
.option(ClickHouseClientOption.ASYNC, false)
45+
.option(ClickHouseClientOption.COMPRESS, dataState.useClientCompression)
4546
.format(format)
4647
.query(BenchmarkRunner.getInsertQuery(dataState.tableNameEmpty))
4748
.data(out -> {
@@ -63,10 +64,9 @@ public void insertV2(DataState dataState) {
6364
try (InsertResponse response = clientV2.insert(dataState.tableNameEmpty, out -> {
6465
for (byte[] bytes: dataState.dataSet.getBytesList(format)) {
6566
out.write(bytes);
66-
6767
}
6868
out.close();
69-
}, format, new InsertSettings()).get()) {
69+
}, format, new InsertSettings().compressClientRequest(dataState.useClientCompression)).get()) {
7070
response.getWrittenRows();
7171
}
7272
} catch (Exception e) {

0 commit comments

Comments
 (0)