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
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add Param annotations to relevant existing benchmarks
bgprudhomme committed Aug 27, 2024
commit f1e71cd15e466ebea470979dffdd92558618c0dc
Original file line number Diff line number Diff line change
@@ -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;
@@ -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
@@ -58,7 +62,7 @@ public void onlyReadLocksNoContention(Blackhole blackhole) throws Exception {

AbstractReadWriteLockManager lockManager = getReadWriteLockManager();

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

readLocks(lockManager, 100, blackhole);

@@ -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();
@@ -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();
@@ -115,7 +119,7 @@ public void readPriority(Blackhole blackhole) throws Exception {

AbstractReadWriteLockManager lockManager = getReadWriteLockManager();

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

@@ -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();
Original file line number Diff line number Diff line change
@@ -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;
@@ -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
@@ -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(() -> {
Original file line number Diff line number Diff line change
@@ -25,6 +25,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;
@@ -47,6 +48,9 @@
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public class ConcurrentQueryBenchmark extends BaseConcurrentBenchmark {

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

private SailRepository repository;

public static void main(String[] args) throws RunnerException {
@@ -82,7 +86,7 @@ public void tearDown() throws Exception {

@Benchmark
public void hasStatement(Blackhole blackhole) throws Exception {
threads(100, () -> {
threads(numThreads, () -> {
try (SailRepositoryConnection connection = repository.getConnection()) {
for (int i = 0; i < 100; i++) {
boolean b = connection.hasStatement(null, null, null, true);
@@ -95,7 +99,7 @@ public void hasStatement(Blackhole blackhole) throws Exception {
@Benchmark
public void hasStatementSharedConnection(Blackhole blackhole) throws Exception {
try (SailRepositoryConnection connection = repository.getConnection()) {
threads(100, () -> {
threads(numThreads, () -> {
for (int i = 0; i < 100; i++) {
boolean b = connection.hasStatement(null, null, null, true);
blackhole.consume(b);
@@ -106,7 +110,7 @@ public void hasStatementSharedConnection(Blackhole blackhole) throws Exception {

@Benchmark
public void getNamespaces(Blackhole blackhole) throws Exception {
threads(100, () -> {
threads(numThreads, () -> {
try (SailRepositoryConnection connection = repository.getConnection()) {
for (int i = 0; i < 100; i++) {
blackhole.consume(connection.getNamespaces().stream().count());
@@ -118,7 +122,7 @@ public void getNamespaces(Blackhole blackhole) throws Exception {
@Benchmark
public void getNamespacesSharedConnection(Blackhole blackhole) throws Exception {
try (SailRepositoryConnection connection = repository.getConnection()) {
threads(100, () -> {
threads(numThreads, () -> {
for (int i = 0; i < 100; i++) {
blackhole.consume(connection.getNamespaces().stream().count());
}
Original file line number Diff line number Diff line change
@@ -38,6 +38,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;
@@ -62,6 +63,9 @@
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public class MemValueFactoryConcurrentBenchmark extends BaseConcurrentBenchmark {

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

public static final int BUCKET_SIZE = 10000;
private SailRepository repository;
private List<List<Value>> values;
@@ -129,7 +133,7 @@ public void onlyReads(Blackhole blackhole) throws Exception {

Random random = new Random(48593);

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

List<Value> values = this.values.get(random.nextInt(this.values.size()));

@@ -151,7 +155,7 @@ public void readHeavy(Blackhole blackhole) throws Exception {

Random random = new Random(48593);

threads(100, () -> {
threads(numThreads, () -> {
Random r = new Random(random.nextInt());
for (int i = 0; i < BUCKET_SIZE; i++) {
MemIRI orCreateMemURI = valueFactory
@@ -171,7 +175,7 @@ public void onlyWrites(Blackhole blackhole) throws Exception {

AtomicInteger atomicInteger = new AtomicInteger();

threads(100, () -> {
threads(numThreads, () -> {
int base = atomicInteger.incrementAndGet();
for (int i = 0; i < BUCKET_SIZE; i++) {
IRI iri = valueFactory.createIRI("http://example.com", base + "-" + i);
Original file line number Diff line number Diff line change
@@ -45,6 +45,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;
@@ -73,6 +74,9 @@
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public class ParallelMixedReadWriteBenchmark extends BaseConcurrentBenchmark {

@Param({ "1", "5", "10", "50", "100", "500" })
public int workloadSize;

private static final String query1;
private static final String query4;
private static final String query7_pathexpression1;
@@ -181,7 +185,7 @@ private ArrayList<Runnable> getMixedWorkload(Blackhole blackhole, CountDownLatch
RepositoryConnection connection, IsolationLevel isolationLevel) {
ArrayList<Runnable> list = new ArrayList<>();

for (int i = 0; i < 10; i++) {
for (int i = 0; i < workloadSize; i++) {
list.add(getRunnable(startSignal, connection, isolationLevel, (localConnection) -> {
long count = localConnection
.prepareTupleQuery(query4)
@@ -195,7 +199,7 @@ private ArrayList<Runnable> getMixedWorkload(Blackhole blackhole, CountDownLatch
}));
}

for (int i = 0; i < 30; i++) {
for (int i = 0; i < 3*workloadSize; i++) {
list.add(getRunnable(startSignal, connection, isolationLevel, (localConnection) -> {
long count = localConnection
.prepareTupleQuery(query7_pathexpression1)
@@ -209,7 +213,7 @@ private ArrayList<Runnable> getMixedWorkload(Blackhole blackhole, CountDownLatch
}));
}

for (int i = 0; i < 30; i++) {
for (int i = 0; i < 3*workloadSize; i++) {
list.add(getRunnable(startSignal, connection, isolationLevel, (localConnection) -> {
long count = localConnection
.prepareTupleQuery(query8_pathexpression2)
@@ -223,23 +227,23 @@ private ArrayList<Runnable> getMixedWorkload(Blackhole blackhole, CountDownLatch
}));
}

for (int i = 0; i < 400; i++) {
for (int i = 0; i < 40*workloadSize; i++) {
list.add(getRunnable(startSignal, connection, isolationLevel, (localConnection) -> {
blackhole.consume(localConnection.hasStatement(null, RDF.TYPE, null, false));
// System.out.println("Finished hasStatement explicit");

}));
}

for (int i = 0; i < 400; i++) {
for (int i = 0; i < 40*workloadSize; i++) {
list.add(getRunnable(startSignal, connection, isolationLevel, (localConnection) -> {
blackhole.consume(localConnection.hasStatement(null, RDF.TYPE, null, true));
// System.out.println("Finished hasStatement inferred");

}));
}

for (int i = 0; i < 20; i++) {
for (int i = 0; i < 2*workloadSize; i++) {
list.add(getRunnable(startSignal, connection, isolationLevel, (localConnection) -> {
long count = localConnection
.prepareTupleQuery(query1)
@@ -252,7 +256,7 @@ private ArrayList<Runnable> getMixedWorkload(Blackhole blackhole, CountDownLatch
}));
}

for (int i = 0; i < 200; i++) {
for (int i = 0; i < 20*workloadSize; i++) {
list.add(getRunnable(startSignal, connection, isolationLevel, (localConnection) -> {
for (int j = 0; j < 100; j++) {
localConnection.add(Values.bnode(), RDFS.LABEL, Values.literal(j),
Original file line number Diff line number Diff line change
@@ -39,6 +39,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;
@@ -58,6 +59,9 @@
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public class ParallelQueryBenchmark extends BaseConcurrentBenchmark {

@Param({ "1", "5", "10", "50", "100", "500" })
public int workloadSize;

private static final String query1;
private static final String query4;
private static final String query7_pathexpression1;
@@ -133,7 +137,7 @@ private ArrayList<Runnable> getMixedWorkload(Blackhole blackhole, CountDownLatch
RepositoryConnection connection, IsolationLevel isolationLevel) {
ArrayList<Runnable> list = new ArrayList<>();

for (int i = 0; i < 10; i++) {
for (int i = 0; i < 2*workloadSize; i++) {
list.add(getRunnable(startSignal, connection, isolationLevel, (localConnection) -> {
long count = localConnection
.prepareTupleQuery(query4)
@@ -145,7 +149,7 @@ private ArrayList<Runnable> getMixedWorkload(Blackhole blackhole, CountDownLatch
}));
}

for (int i = 0; i < 10; i++) {
for (int i = 0; i < 2*workloadSize; i++) {
list.add(getRunnable(startSignal, connection, isolationLevel, (localConnection) -> {
long count = localConnection
.prepareTupleQuery(query7_pathexpression1)
@@ -157,7 +161,7 @@ private ArrayList<Runnable> getMixedWorkload(Blackhole blackhole, CountDownLatch
}));
}

for (int i = 0; i < 10; i++) {
for (int i = 0; i < 2*workloadSize; i++) {
list.add(getRunnable(startSignal, connection, isolationLevel, (localConnection) -> {
long count = localConnection
.prepareTupleQuery(query8_pathexpression2)
@@ -169,19 +173,19 @@ private ArrayList<Runnable> getMixedWorkload(Blackhole blackhole, CountDownLatch
}));
}

for (int i = 0; i < 100; i++) {
for (int i = 0; i < 20*workloadSize; i++) {
list.add(getRunnable(startSignal, connection, isolationLevel, (localConnection) -> {
blackhole.consume(localConnection.hasStatement(null, RDF.TYPE, null, false));
}));
}

for (int i = 0; i < 100; i++) {
for (int i = 0; i < 20*workloadSize; i++) {
list.add(getRunnable(startSignal, connection, isolationLevel, (localConnection) -> {
blackhole.consume(localConnection.hasStatement(null, RDF.TYPE, null, true));
}));
}

for (int i = 0; i < 5; i++) {
for (int i = 0; i < workloadSize; i++) {
list.add(getRunnable(startSignal, connection, isolationLevel, (localConnection) -> {
long count = localConnection
.prepareTupleQuery(query1)
Original file line number Diff line number Diff line change
@@ -53,6 +53,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;
@@ -76,6 +77,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
@@ -115,7 +119,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(() -> {