Merge branch 'cassandra-6.0' into trunk

* cassandra-6.0:
  Reduce time to execute microbench-test
This commit is contained in:
Dmitry Konstantinov 2026-05-21 20:43:08 +01:00
commit e686ab81ca
9 changed files with 43 additions and 23 deletions

View File

@ -49,9 +49,11 @@
<!-- Only used to test jmh classes run without error. Not to be used for actual performance tests -->
<jmh>
<extra-args>
<arg value="-f"/><arg value="1"/>
<arg value="-wi"/><arg value="0"/>
<arg value="-i"/><arg value="1"/>
<arg value="-f"/><arg value="1"/> <!-- forks -->
<arg value="-wi"/><arg value="0"/> <!-- warmup iterations -->
<arg value="-i"/><arg value="1"/> <!-- fork -->
<arg value="-r"/><arg value="1"/> <!-- measurement iteration time -->
<arg value="-t"/><arg value="1"/> <!-- threads -->
</extra-args>
</jmh>
</target>

View File

@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
@ -33,6 +34,7 @@ import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.annotations.Threads;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.profile.GCProfiler;
@ -63,6 +65,7 @@ import org.apache.cassandra.service.ClientState;
import org.apache.cassandra.transport.Dispatcher;
import org.apache.cassandra.utils.ByteArrayUtil;
import org.apache.cassandra.utils.FBUtilities;
import org.apache.cassandra.utils.TestHelper;
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@ -120,6 +123,12 @@ public class BatchStatementBench
bqo = BatchQueryOptions.withPerStatementVariables(QueryOptions.DEFAULT, parameters, queryOrIdList);
}
@TearDown(Level.Trial)
public void teardown() throws Exception
{
TestHelper.teardown();
}
@Benchmark
public void bench()
{

View File

@ -28,7 +28,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.Benchmark;
@ -50,6 +49,7 @@ import org.apache.cassandra.auth.AuthenticatedUser;
import org.apache.cassandra.cql3.CIDR;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.exceptions.UnauthorizedException;
import org.apache.cassandra.utils.TestHelper;
/**
* Benchmark CIDR authorizer (enforce mode)
@ -99,9 +99,9 @@ public class CIDRAuthorizerBench extends CQLTester
}
@TearDown(Level.Trial)
public void teardown() throws IOException, ExecutionException, InterruptedException
public void teardown() throws Exception
{
CQLTester.cleanup();
TestHelper.teardown();
}
@State(Scope.Thread)

View File

@ -46,18 +46,17 @@ import org.apache.cassandra.cache.KeyCacheKey;
import org.apache.cassandra.config.Config;
import org.apache.cassandra.config.DataStorageSpec;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.cql3.QueryProcessor;
import org.apache.cassandra.db.ColumnFamilyStore;
import org.apache.cassandra.db.Keyspace;
import org.apache.cassandra.db.RowUpdateBuilder;
import org.apache.cassandra.db.commitlog.CommitLog;
import org.apache.cassandra.db.marshal.AsciiType;
import org.apache.cassandra.io.sstable.AbstractRowIndexEntry;
import org.apache.cassandra.io.sstable.format.SSTableReader;
import org.apache.cassandra.schema.ColumnMetadata;
import org.apache.cassandra.service.CacheService;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.utils.TestHelper;
@SuppressWarnings("unused")
@BenchmarkMode(Mode.SampleTime)
@ -151,11 +150,9 @@ public class CacheLoaderBench
}
@TearDown(Level.Trial)
public void teardown()
public void teardown() throws Exception
{
CQLTester.tearDownClass();
CommitLog.instance.stopUnsafe(true);
CQLTester.cleanup();
TestHelper.teardown();
}
@Benchmark

View File

@ -41,7 +41,7 @@ import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.cql3.UntypedResultSet;
import org.apache.cassandra.db.ColumnFamilyStore;
import org.apache.cassandra.db.Keyspace;
import org.apache.cassandra.db.commitlog.CommitLog;
import org.apache.cassandra.utils.TestHelper;
/**
* Benchmarks the performance of CQL functions calls with terminal arguments.
@ -101,11 +101,9 @@ public class FunctionWithTerminalArgsBench extends CQLTester
}
@TearDown(Level.Trial)
public void teardown() throws InterruptedException
public void teardown() throws Exception
{
CommitLog.instance.shutdownBlocking();
CQLTester.tearDownClass();
CQLTester.cleanup();
TestHelper.teardown();
}
@Benchmark

View File

@ -27,6 +27,7 @@ import org.jctools.util.Pow2;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
@ -34,6 +35,7 @@ import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.annotations.Warmup;
import org.apache.cassandra.cql3.CQLTester;
@ -47,6 +49,7 @@ import org.apache.cassandra.db.rows.Cell;
import org.apache.cassandra.io.sstable.metadata.MetadataCollector;
import org.apache.cassandra.schema.ColumnMetadata;
import org.apache.cassandra.schema.TableMetadata;
import org.apache.cassandra.utils.TestHelper;
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@ -122,6 +125,12 @@ public class MetadataCollectorBench
}
}
@TearDown(Level.Trial)
public void teardown() throws Exception
{
TestHelper.teardown();
}
@Benchmark
public void updateCell()
{

View File

@ -39,7 +39,7 @@ import org.apache.cassandra.db.compression.CompressionDictionary.Kind;
import org.apache.cassandra.db.compression.ZstdCompressionDictionary;
import org.apache.cassandra.io.compress.ZstdDictionaryCompressor;
// The bench takes over 20 minutes to finish
// The full bench takes over 20 minutes to finish
@State(Scope.Benchmark)
public abstract class ZstdDictionaryCompressorBenchBase
{
@ -52,7 +52,8 @@ public abstract class ZstdDictionaryCompressorBenchBase
@Param({"0", "65536"})
protected int dictionarySize;
@Param({"3", "5", "7"})
// @Param({"3", "5", "7"})
@Param({"3"})
protected int compressionLevel;
protected byte[] inputData;

View File

@ -77,10 +77,12 @@ public class ComparisonReadBench
@Param({"ON_HEAP"})
BufferType bufferType = BufferType.OFF_HEAP;
@Param({"1000", "100000", "10000000"})
// @Param({"1000", "100000", "10000000"})
@Param({"1000", "100000"})
int count = 1000;
@Param({"TREE_MAP", "CSLM", "TRIE"})
// @Param({"TREE_MAP", "CSLM", "TRIE"})
@Param({"CSLM", "TRIE"})
MapOption map = MapOption.TRIE;
@Param({"LONG"})

View File

@ -56,10 +56,12 @@ public class InMemoryTrieUnionBench
@Param({"ON_HEAP", "OFF_HEAP"})
BufferType bufferType = BufferType.OFF_HEAP;
@Param({"1000", "100000", "10000000"})
// @Param({"1000", "100000", "10000000"})
@Param({"1000", "100000"})
int count = 1000;
@Param({"2", "3", "8"})
// @Param({"2", "3", "8"})
@Param({"2", "3"})
int sources = 2;
@Param({"false", "true"})