Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional JMH tests (fibers) #7

Open
wants to merge 35 commits into
base: fibers
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
365f747
Additional JMH tests (fibers)
bgprudhomme Aug 26, 2024
f987a62
Sort imports
bgprudhomme Aug 26, 2024
720851c
Format
bgprudhomme Aug 26, 2024
f1e71cd
Add Param annotations to relevant existing benchmarks
bgprudhomme Aug 27, 2024
a058a00
Format
bgprudhomme Aug 27, 2024
ab54388
Format
bgprudhomme Aug 27, 2024
f9d8b49
Formatting
bgprudhomme Aug 27, 2024
b002275
JMH shell script
bgprudhomme Aug 29, 2024
8c18f4d
Change workload (fibers)
Nov 22, 2024
5275532
Increase heap space
Nov 22, 2024
b24ad59
Merge branch 'fibers_additional_jmh' into fibers_additional_jmh_workload
Nov 22, 2024
c96c4de
Merge pull request #9 from ponder-lab/fibers_additional_jmh_workload
bgprudhomme Nov 26, 2024
8d84b00
Update MemStatementListTestIT.java
bgprudhomme Nov 26, 2024
aaae3aa
Update ParallelMixedReadWriteBenchmark.java
bgprudhomme Nov 27, 2024
2975273
Update ParallelMixedReadWriteBenchmark.java
bgprudhomme Nov 27, 2024
f8d5940
Restore workloads
bgprudhomme Dec 3, 2024
5a81d1c
Merge branch 'fibers' into fibers_additional_jmh
bgprudhomme Dec 3, 2024
0c6df57
Merge branch 'fibers' into fibers_additional_jmh
Dec 4, 2024
7749404
Merge branch 'fibers' into fibers_additional_jmh
Dec 4, 2024
3c9f62b
Merge branch 'fibers' into fibers_additional_jmh
Dec 4, 2024
98db4a6
Merge branch 'fibers' into fibers_additional_jmh
Dec 4, 2024
28858b8
Merge branch 'fibers' into fibers_additional_jmh
Dec 4, 2024
2726de2
Merge branch 'fibers' into fibers_additional_jmh
Dec 4, 2024
ac0bf36
Merge branch 'fibers' into fibers_additional_jmh
Dec 4, 2024
eb759cb
Merge branch 'fibers' into fibers_additional_jmh
Dec 6, 2024
78709d2
Merge branch 'fibers' into fibers_additional_jmh
bgprudhomme Dec 6, 2024
aab4f38
Merge branch 'fibers' into fibers_additional_jmh
bgprudhomme Dec 7, 2024
74dcd17
Merge branch 'fibers' into fibers_additional_jmh
khatchad Dec 11, 2024
df68c33
Add back space.
khatchad Dec 11, 2024
d8524f3
Use a higher max heap size.
khatchad Dec 11, 2024
108ae4d
Update ParallelQueryBenchmark.java
bgprudhomme Dec 12, 2024
e5481e7
Update ParallelMixedReadWriteBenchmark.java
bgprudhomme Dec 12, 2024
baa9227
Update MemValueFactoryConcurrentBenchmark.java
bgprudhomme Dec 12, 2024
c9d6769
Update MemStatementListTestIT.java
bgprudhomme Dec 12, 2024
79cfa38
Remove unnecessary flags
bgprudhomme Dec 12, 2024
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
12 changes: 12 additions & 0 deletions compliance/repository/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmhVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmhVersion}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,23 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
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;
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.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;

import com.google.common.collect.Lists;

Expand All @@ -47,15 +64,25 @@
*
* @author Andreas Schwarte
*/
@State(Scope.Benchmark)
@Warmup(iterations = 5)
@BenchmarkMode({ Mode.AverageTime })
@Fork(value = 1, jvmArgs = { "-Xms1G", "-Xmx50G", })
@Measurement(iterations = 5)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public class RepositoryFederatedServiceIntegrationTest {

@Param({ "10", "50", "100", "500", "1000", "5000" })
private int numThreads;

private static final ValueFactory vf = SimpleValueFactory.getInstance();

private SailRepository serviceRepo;
private SailRepository localRepo;
private RepositoryFederatedService federatedService;

@BeforeEach
@Setup(Level.Iteration)
public void before() {
serviceRepo = new SailRepository(new MemoryStore());
serviceRepo.init();
Expand All @@ -74,6 +101,7 @@ public FederatedService getService(String serviceUrl) throws QueryEvaluationExce
}

@AfterEach
@TearDown((Level.Iteration))
public void after() {
federatedService.shutdown();
localRepo.shutDown();
Expand Down Expand Up @@ -277,6 +305,7 @@ public void test8a_subSelectAll() {
}

@Test
@Benchmark
public void test9_connectionHandling() throws Exception {

/*
Expand All @@ -297,7 +326,7 @@ public void test9_connectionHandling() throws Exception {

ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor();
try {
for (int i = 0; i < 5; i++) {
for (int i = 0; i < numThreads; i++) {
executor.submit(() -> {

String query = "SELECT ?var WHERE { SERVICE <urn:dummy> { ?s ?p ?var } }";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

Expand All @@ -27,8 +28,33 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
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.Warmup;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;

@State(Scope.Benchmark)
@Warmup(iterations = 5)
@BenchmarkMode({ Mode.AverageTime })
@Fork(value = 1, jvmArgs = { "-Xms1G", "-Xmx50G", })
@Measurement(iterations = 5)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public class MinimalContextNowTest {

@Param({ "10", "50", "100", "500", "1000", "5000" })
private int numberOfThreads;

@Test
public void testNow() {
// Tests that the now value is correctly initialized.
Expand All @@ -45,9 +71,9 @@ public void testNow() {
}

@Test
@Benchmark
public void testConcurrentAccessToNow() throws ExecutionException, InterruptedException {
int numberOfIterations = 100;
int numberOfThreads = 10;

ExecutorService executorService = Executors.newVirtualThreadPerTaskExecutor();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.runner.Runner;
Expand All @@ -41,6 +42,9 @@
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public class ReadWriteLockManagerBenchmark extends BaseLockManagerBenchmark {

@Param({ "10", "50", "100", "500", "1000", "5000" })
public int numThreads;

public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder().include("ReadWriteLockManagerBenchmark.*") // adapt to run other benchmark
// tests
Expand All @@ -58,7 +62,7 @@ public void onlyReadLocksNoContention(Blackhole blackhole) throws Exception {

AbstractReadWriteLockManager lockManager = getReadWriteLockManager();

threads(100, () -> {
threads(numThreads, () -> {

readLocks(lockManager, 100, blackhole);

Expand All @@ -71,7 +75,7 @@ public void onlyWriteLocks(Blackhole blackhole) throws Exception {

AbstractReadWriteLockManager lockManager = getReadWriteLockManager();

threads(1000, () -> {
threads(numThreads, () -> {
try {
Lock lock = lockManager.getWriteLock();
lock.release();
Expand All @@ -94,7 +98,7 @@ public void mixedReadHeavy(Blackhole blackhole) throws Exception {

AbstractReadWriteLockManager lockManager = getReadWriteLockManager();

threads(100, () -> {
threads(numThreads, () -> {
try {
Lock lock = lockManager.getWriteLock();
lock.release();
Expand All @@ -115,7 +119,7 @@ public void readPriority(Blackhole blackhole) throws Exception {

AbstractReadWriteLockManager lockManager = getReadWriteLockManager();

threads(100, () -> {
threads(numThreads, () -> {
try {
Lock readLock1 = lockManager.getReadLock();

Expand Down Expand Up @@ -190,7 +194,7 @@ public void mixed(Blackhole blackhole) throws Exception {

AbstractReadWriteLockManager lockManager = getReadWriteLockManager();

threads(1000, () -> {
threads(numThreads, () -> {
try {
Lock lock = lockManager.getWriteLock();
lock.release();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,45 @@
import org.eclipse.rdf4j.sail.SailException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
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;
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.Warmup;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;

/**
* Unit tests for {@link AbstractSail}.
*
* @author Jeen Broekstra
*/
@State(Scope.Benchmark)
@Warmup(iterations = 5)
@BenchmarkMode({ Mode.AverageTime })
@Fork(value = 1, jvmArgs = { "-Xms1G", "-Xmx50G", })
@Measurement(iterations = 5)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public class AbstractSailTest {

@Param({ "10", "50", "100", "500", "1000", "5000" })
private int count;

AbstractSail subject;

private final Random random = new Random(43252333);

@BeforeEach
@Setup(Level.Iteration)
public void setUp() {

subject = new AbstractSail() {
Expand Down Expand Up @@ -96,8 +122,8 @@ public void testExplicitInitTwice() {
}

@Test
@Benchmark
public void testConcurrentAutoInit() throws Exception {
int count = 200;
CountDownLatch latch = new CountDownLatch(count);

for (int i = 0; i < count; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
Expand All @@ -78,6 +79,9 @@
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public class OverflowBenchmarkConcurrent {

@Param({ "5", "25", "50", "250", "500", "2500" })
public int numThreadsHalf;

@Setup(Level.Trial)
public void setup() {
((Logger) (LoggerFactory
Expand Down Expand Up @@ -123,7 +127,7 @@ public void manyConcurrentTransactions() throws IOException {

CountDownLatch countDownLatch = new CountDownLatch(1);

for (int i = 0; i < 38; i++) {
for (int i = 0; i < numThreadsHalf; i++) {
var seed = i + 485924;
{
Future<?> submit = executorService.submit(() -> {
Expand Down
12 changes: 12 additions & 0 deletions core/sail/lucene/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,17 @@
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmhVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmhVersion}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,38 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
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;
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.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Timeout(value = 10, unit = TimeUnit.MINUTES)
@State(Scope.Benchmark)
@Warmup(iterations = 5)
@BenchmarkMode({ Mode.AverageTime })
@Fork(value = 1, jvmArgs = { "-Xms1G", "-Xmx50G", })
@Measurement(iterations = 5)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public abstract class AbstractGenericLuceneTest {

@Param({ "10", "50", "100", "500", "1000", "5000" })
int numThreads;

protected static final ValueFactory vf = SimpleValueFactory.getInstance();

public static final String QUERY_STRING;
Expand Down Expand Up @@ -120,6 +147,7 @@ public abstract class AbstractGenericLuceneTest {
protected abstract void configure(LuceneSail sail) throws IOException;

@BeforeEach
@Setup(Level.Iteration)
public void setUp() throws Exception {
// set logging, uncomment this to get better logging for debugging
// org.apache.log4j.BasicConfigurator.configure();
Expand Down Expand Up @@ -151,6 +179,7 @@ public void setUp() throws Exception {
}

@AfterEach
@TearDown(Level.Iteration)
public void tearDown() throws RepositoryException {
try {
if (connection != null) {
Expand Down Expand Up @@ -767,8 +796,8 @@ public void testPropertyVar() throws MalformedQueryException, RepositoryExceptio
}

@Test
@Benchmark
public void testMultithreadedAdd() throws InterruptedException {
int numThreads = 3;
final CountDownLatch startLatch = new CountDownLatch(1);
final CountDownLatch endLatch = new CountDownLatch(numThreads);
final Set<Throwable> exceptions = ConcurrentHashMap.newKeySet();
Expand Down
Loading
Loading