File tree Expand file tree Collapse file tree 4 files changed +7
-23
lines changed
performance/src/test/com/clickhouse/benchmark Expand file tree Collapse file tree 4 files changed +7
-23
lines changed Original file line number Diff line number Diff line change 11package com .clickhouse .benchmark ;
22
33
4- import com .clickhouse .benchmark .clients .BenchmarkBase ;
54import com .clickhouse .benchmark .clients .Components ;
65import com .clickhouse .benchmark .clients .InsertClient ;
76import 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 )
Original file line number Diff line number Diff 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 ) {
Original file line number Diff line number Diff line change 44import com .clickhouse .client .api .internal .ClickHouseLZ4OutputStream ;
55import com .clickhouse .data .ClickHouseOutputStream ;
66import com .clickhouse .data .stream .Lz4OutputStream ;
7- import net .jpountz .lz4 .LZ4Compressor ;
87import net .jpountz .lz4 .LZ4Factory ;
98import 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 ;
139import org .slf4j .Logger ;
1410import org .slf4j .LoggerFactory ;
1511
1814public 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 ;
Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments