Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5b22a3b
Improve TSDB codec benchmarks with full encoder and compression metrics
salvatore-campagna Jan 7, 2026
969ee30
docs(benchmarks): improve javadoc for TSDB codec benchmark classes
salvatore-campagna Jan 7, 2026
ca97765
Merge branch 'main' into benchmarks/tsdb-codec-compression-throughput…
salvatore-campagna Jan 7, 2026
e077409
fix(benchmarks): add volatile to MetricsConfig for thread visibility
salvatore-campagna Jan 8, 2026
9671303
refactor(benchmarks): add EXTRA_METADATA_SIZE constant and improve ja…
salvatore-campagna Jan 8, 2026
d69730f
refactor(benchmarks): rename getEncodedBytes to getEncodedSize for cl…
salvatore-campagna Jan 8, 2026
4b9980d
refactor(benchmarks): simplify recordOperation by removing unnecessar…
salvatore-campagna Jan 8, 2026
5f6b8ba
refactor(benchmarks): remove defensive null check in computeMetrics
salvatore-campagna Jan 8, 2026
375296d
Merge branch 'main' into benchmarks/tsdb-codec-compression-throughput…
salvatore-campagna Jan 8, 2026
47f39a1
Merge branch 'main' into benchmarks/tsdb-codec-compression-throughput…
salvatore-campagna Jan 8, 2026
594ea55
refactor(benchmarks): remove MetricsConfig in favor of direct paramet…
salvatore-campagna Jan 8, 2026
9e61fd9
refactor(benchmarks): use private fields with getters in CompressionM…
salvatore-campagna Jan 8, 2026
d3e5869
Merge branch 'main' into benchmarks/tsdb-codec-compression-throughput…
salvatore-campagna Jan 8, 2026
03c01f6
refactor(benchmarks): remove totalEncodedBytes and totalValuesProcessed
salvatore-campagna Jan 8, 2026
8521409
feat(benchmarks): add throughput metrics and benchmark methods
salvatore-campagna Jan 8, 2026
074a773
docs(benchmarks): add javadoc for fields in CompressionMetrics
salvatore-campagna Jan 8, 2026
b000158
refactor(benchmarks): use Math.ceilDiv instead of custom implementation
salvatore-campagna Jan 8, 2026
c0baff9
Merge branch 'main' into benchmarks/tsdb-codec-compression-throughput…
salvatore-campagna Jan 8, 2026
2e82ff6
Merge branch 'main' into benchmarks/tsdb-codec-compression-throughput…
salvatore-campagna Jan 8, 2026
10da457
[CI] Auto commit changes from spotless
Jan 8, 2026
a565198
Merge branch 'main' into benchmarks/tsdb-codec-compression-throughput…
salvatore-campagna Jan 9, 2026
b2a31cf
fix(benchmarks): restore input array before each encode operation
salvatore-campagna Jan 9, 2026
00bf3b5
refactor(benchmarks): optimize compression benchmarks with single ite…
salvatore-campagna Jan 9, 2026
094fac1
refactor(benchmarks): use Level.Trial for benchmark setup
salvatore-campagna Jan 9, 2026
4390dd3
Merge branch 'main' into benchmarks/tsdb-codec-compression-throughput…
salvatore-campagna Jan 9, 2026
305e836
Merge branch 'main' into benchmarks/tsdb-codec-compression-throughput…
salvatore-campagna Jan 9, 2026
dd1be79
Merge branch 'main' into benchmarks/tsdb-codec-compression-throughput…
salvatore-campagna Jan 9, 2026
0efdec7
Merge branch 'main' into benchmarks/tsdb-codec-compression-throughput…
salvatore-campagna Jan 9, 2026
9c71fab
fix(benchmarks): handle 64-bit overflow in integer suppliers
salvatore-campagna Jan 9, 2026
d5482bb
Merge branch 'main' into benchmarks/tsdb-codec-compression-throughput…
salvatore-campagna Jan 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@

package org.elasticsearch.benchmark.index.codec.tsdb;

import org.elasticsearch.benchmark.index.codec.tsdb.internal.AbstractDocValuesForUtilBenchmark;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.AbstractTSDBCodecBenchmark;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.ConstantIntegerSupplier;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.DecodeBenchmark;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.ThroughputMetrics;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
Expand All @@ -29,36 +30,41 @@
import java.io.IOException;
import java.util.concurrent.TimeUnit;

/**
* Benchmark for decoding constant integer patterns.
*/
@Fork(value = 1)
@Warmup(iterations = 3)
@Measurement(iterations = 10)
@BenchmarkMode(value = Mode.AverageTime)
@OutputTimeUnit(value = TimeUnit.NANOSECONDS)
@State(value = Scope.Benchmark)
@Measurement(iterations = 5)
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.SECONDS)
@State(Scope.Benchmark)
public class DecodeConstantIntegerBenchmark {
private static final int SEED = 17;
private static final int BLOCK_SIZE = 128;
@Param({ "15" })

@Param({ "1", "4", "8", "9", "16", "17", "24", "25", "32", "33", "40", "48", "56", "57", "64" })
private int bitsPerValue;

private final AbstractDocValuesForUtilBenchmark decode;
private final AbstractTSDBCodecBenchmark decode;

public DecodeConstantIntegerBenchmark() {
this.decode = new DecodeBenchmark();
}

@Setup(Level.Invocation)
public void setupInvocation() throws IOException {
decode.setupInvocation(bitsPerValue);
decode.setupInvocation();
}

@Setup(Level.Iteration)
public void setupIteration() throws IOException {
decode.setupIteration(bitsPerValue, new ConstantIntegerSupplier(SEED, bitsPerValue, BLOCK_SIZE));
@Setup(Level.Trial)
public void setupTrial() throws IOException {
decode.setupTrial(new ConstantIntegerSupplier(SEED, bitsPerValue, BLOCK_SIZE));
}

@Benchmark
public void benchmark(Blackhole bh) throws IOException {
decode.benchmark(bitsPerValue, bh);
public void throughput(Blackhole bh, ThroughputMetrics metrics) throws IOException {
decode.benchmark(bh);
metrics.recordOperation(BLOCK_SIZE, decode.getEncodedSize());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@

package org.elasticsearch.benchmark.index.codec.tsdb;

import org.elasticsearch.benchmark.index.codec.tsdb.internal.AbstractDocValuesForUtilBenchmark;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.AbstractTSDBCodecBenchmark;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.DecodeBenchmark;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.DecreasingIntegerSupplier;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.ThroughputMetrics;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
Expand All @@ -29,36 +30,41 @@
import java.io.IOException;
import java.util.concurrent.TimeUnit;

/**
* Benchmark for decoding decreasing integer patterns.
*/
@Fork(value = 1)
@Warmup(iterations = 3)
@Measurement(iterations = 10)
@BenchmarkMode(value = Mode.AverageTime)
@OutputTimeUnit(value = TimeUnit.NANOSECONDS)
@State(value = Scope.Benchmark)
@Measurement(iterations = 5)
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.SECONDS)
@State(Scope.Benchmark)
public class DecodeDecreasingIntegerBenchmark {
private static final int SEED = 17;
private static final int BLOCK_SIZE = 128;
@Param({ "4", "8", "12", "16", "20", "24", "28", "32", "36", "40", "44", "48", "52", "56", "60", "64" })

@Param({ "1", "4", "8", "9", "16", "17", "24", "25", "32", "33", "40", "48", "56", "57", "64" })
private int bitsPerValue;

private final AbstractDocValuesForUtilBenchmark decode;
private final AbstractTSDBCodecBenchmark decode;

public DecodeDecreasingIntegerBenchmark() {
this.decode = new DecodeBenchmark();
}

@Setup(Level.Invocation)
public void setupInvocation() throws IOException {
decode.setupInvocation(bitsPerValue);
decode.setupInvocation();
}

@Setup(Level.Iteration)
public void setupIteration() throws IOException {
decode.setupIteration(bitsPerValue, new DecreasingIntegerSupplier(SEED, bitsPerValue, BLOCK_SIZE));
@Setup(Level.Trial)
public void setupTrial() throws IOException {
decode.setupTrial(new DecreasingIntegerSupplier(SEED, bitsPerValue, BLOCK_SIZE));
}

@Benchmark
public void benchmark(Blackhole bh) throws IOException {
decode.benchmark(bitsPerValue, bh);
public void throughput(Blackhole bh, ThroughputMetrics metrics) throws IOException {
decode.benchmark(bh);
metrics.recordOperation(BLOCK_SIZE, decode.getEncodedSize());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@

package org.elasticsearch.benchmark.index.codec.tsdb;

import org.elasticsearch.benchmark.index.codec.tsdb.internal.AbstractDocValuesForUtilBenchmark;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.AbstractTSDBCodecBenchmark;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.DecodeBenchmark;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.IncreasingIntegerSupplier;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.ThroughputMetrics;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
Expand All @@ -29,38 +30,41 @@
import java.io.IOException;
import java.util.concurrent.TimeUnit;

/**
* Benchmark for decoding increasing integer patterns.
*/
@Fork(value = 1)
@Warmup(iterations = 3)
@Measurement(iterations = 10)
@BenchmarkMode(value = Mode.AverageTime)
@OutputTimeUnit(value = TimeUnit.NANOSECONDS)
@State(value = Scope.Benchmark)
@Measurement(iterations = 5)
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.SECONDS)
@State(Scope.Benchmark)
public class DecodeIncreasingIntegerBenchmark {
private static final int SEED = 17;
private static final int BLOCK_SIZE = 128;
@Param({ "4", "8", "12", "16", "20", "24", "28", "32", "36", "40", "44", "48", "52", "56", "60", "64" })

@Param({ "1", "4", "8", "9", "16", "17", "24", "25", "32", "33", "40", "48", "56", "57", "64" })
private int bitsPerValue;

private final AbstractDocValuesForUtilBenchmark decode;
private final AbstractTSDBCodecBenchmark decode;

public DecodeIncreasingIntegerBenchmark() {
this.decode = new DecodeBenchmark();

}

@Setup(Level.Invocation)
public void setupInvocation() throws IOException {
decode.setupInvocation(bitsPerValue);
decode.setupInvocation();
}

@Setup(Level.Iteration)
public void setupIteration() throws IOException {
decode.setupIteration(bitsPerValue, new IncreasingIntegerSupplier(SEED, bitsPerValue, BLOCK_SIZE));
@Setup(Level.Trial)
public void setupTrial() throws IOException {
decode.setupTrial(new IncreasingIntegerSupplier(SEED, bitsPerValue, BLOCK_SIZE));
}

@Benchmark
public void benchmark(Blackhole bh) throws IOException {
decode.benchmark(bitsPerValue, bh);

public void throughput(Blackhole bh, ThroughputMetrics metrics) throws IOException {
decode.benchmark(bh);
metrics.recordOperation(BLOCK_SIZE, decode.getEncodedSize());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@

package org.elasticsearch.benchmark.index.codec.tsdb;

import org.elasticsearch.benchmark.index.codec.tsdb.internal.AbstractDocValuesForUtilBenchmark;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.AbstractTSDBCodecBenchmark;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.DecodeBenchmark;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.NonSortedIntegerSupplier;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.ThroughputMetrics;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
Expand All @@ -29,37 +30,41 @@
import java.io.IOException;
import java.util.concurrent.TimeUnit;

/**
* Benchmark for decoding non-sorted integer patterns.
*/
@Fork(value = 1)
@Warmup(iterations = 3)
@Measurement(iterations = 10)
@BenchmarkMode(value = Mode.AverageTime)
@OutputTimeUnit(value = TimeUnit.NANOSECONDS)
@State(value = Scope.Benchmark)
@Measurement(iterations = 5)
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.SECONDS)
@State(Scope.Benchmark)
public class DecodeNonSortedIntegerBenchmark {
private static final int SEED = 17;
private static final int BLOCK_SIZE = 128;
@Param({ "4", "8", "12", "16", "20", "24", "28", "32", "36", "40", "44", "48", "52", "56", "60", "64" })

@Param({ "1", "4", "8", "9", "16", "17", "24", "25", "32", "33", "40", "48", "56", "57", "64" })
private int bitsPerValue;

private final AbstractDocValuesForUtilBenchmark decode;
private final AbstractTSDBCodecBenchmark decode;

public DecodeNonSortedIntegerBenchmark() {
this.decode = new DecodeBenchmark();

}

@Setup(Level.Invocation)
public void setupInvocation() throws IOException {
decode.setupInvocation(bitsPerValue);
decode.setupInvocation();
}

@Setup(Level.Iteration)
public void setupIteration() throws IOException {
decode.setupIteration(bitsPerValue, new NonSortedIntegerSupplier(SEED, bitsPerValue, BLOCK_SIZE));
@Setup(Level.Trial)
public void setupTrial() throws IOException {
decode.setupTrial(new NonSortedIntegerSupplier(SEED, bitsPerValue, BLOCK_SIZE));
}

@Benchmark
public void benchmark(Blackhole bh) throws IOException {
decode.benchmark(bitsPerValue, bh);
public void throughput(Blackhole bh, ThroughputMetrics metrics) throws IOException {
decode.benchmark(bh);
metrics.recordOperation(BLOCK_SIZE, decode.getEncodedSize());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

package org.elasticsearch.benchmark.index.codec.tsdb;

import org.elasticsearch.benchmark.index.codec.tsdb.internal.AbstractDocValuesForUtilBenchmark;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.AbstractTSDBCodecBenchmark;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.CompressionMetrics;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.ConstantIntegerSupplier;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.EncodeBenchmark;
import org.elasticsearch.benchmark.index.codec.tsdb.internal.ThroughputMetrics;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
Expand All @@ -29,37 +31,58 @@
import java.io.IOException;
import java.util.concurrent.TimeUnit;

/**
* Benchmark for encoding constant integer patterns.
*/
@Fork(value = 1)
@Warmup(iterations = 3)
@Measurement(iterations = 10)
@BenchmarkMode(value = Mode.AverageTime)
@OutputTimeUnit(value = TimeUnit.NANOSECONDS)
@State(value = Scope.Benchmark)
@Measurement(iterations = 5)
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.SECONDS)
@State(Scope.Benchmark)
public class EncodeConstantIntegerBenchmark {
private static final int SEED = 17;
private static final int BLOCK_SIZE = 128;
@Param({ "15" })

@Param({ "1", "4", "8", "9", "16", "17", "24", "25", "32", "33", "40", "48", "56", "57", "64" })
private int bitsPerValue;

private final AbstractDocValuesForUtilBenchmark encode;
private final AbstractTSDBCodecBenchmark encode;

public EncodeConstantIntegerBenchmark() {
this.encode = new EncodeBenchmark();

}

@Setup(Level.Invocation)
public void setupInvocation() throws IOException {
encode.setupInvocation(bitsPerValue);
encode.setupInvocation();
}

@Setup(Level.Iteration)
public void setupIteration() throws IOException {
encode.setupIteration(bitsPerValue, new ConstantIntegerSupplier(SEED, bitsPerValue, BLOCK_SIZE));
@Setup(Level.Trial)
public void setupTrial() throws IOException {
encode.setupTrial(new ConstantIntegerSupplier(SEED, bitsPerValue, BLOCK_SIZE));
encode.setupInvocation();
encode.run();
}

@Benchmark
public void throughput(Blackhole bh, ThroughputMetrics metrics) throws IOException {
encode.benchmark(bh);
metrics.recordOperation(BLOCK_SIZE, encode.getEncodedSize());
}

/**
* Measures compression efficiency metrics (compression ratio, encoded bits/bytes per value).
*
* <p>Uses zero warmup and single iteration because compression metrics are deterministic:
* the same input data always produces the same encoded size. Unlike throughput measurements
* which vary due to JIT compilation and CPU state, compression ratios are constant across runs.
*/
@Benchmark
public void benchmark(Blackhole bh) throws IOException {
encode.benchmark(bitsPerValue, bh);
@Warmup(iterations = 0)
@Measurement(iterations = 1)
public void compression(Blackhole bh, CompressionMetrics metrics) throws IOException {
encode.benchmark(bh);
metrics.recordOperation(BLOCK_SIZE, encode.getEncodedSize(), bitsPerValue);
}
}
Loading