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

Add state transfer test -- focused on removeStaleData for now #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
76 changes: 76 additions & 0 deletions statetransfer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# JMH Performance tests

## Build

To build the benchmark iteration tests:

$ mvn clean install


## Run it from command line using an "uber jar"

There is an alternative way to run it which might be handy when needing to copy the
performance test to a dedicated server and for some reason you're not liking rsync:

$ java -jar target/benchmarks.jar


## Run flight recorder on Infinispan with many iterations

$ java -jar target/benchmarks.jar -jvmArgsPrepend "-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints -XX:FlightRecorderOptions=stackdepth=128" -e NoRehash

or with Java 11

$ java -jar target/benchmarks.jar -jvmArgsPrepend "-XX:+FlightRecorder -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints -XX:FlightRecorderOptions=stackdepth=128 -XX:StartFlightRecording=settings=profile.jfc,dumponexit=true"


- jvmArgsPrepend: allows to add additional JVM properties to the forked process which runs the benchmark

There's also a script `run8.sh` that runs 2 different versions with FlightRecorder and generates flame graphs for both
(requires [jfr-report-tool](https://github.com/lhotari/jfr-report-tool)
and [FlameGraph](https://github.com/brendangregg/FlameGraph)).

## Set benchmark parameters

Benchmark parameters (those who use @Param) will get the benchmark repeated to satisfy each possible permutation.

For all possible paramters see InfinispanHolder and KeySequenceGenerator

## Start a cluster node without the benchmark

Infinispan node; set the appropriate interface address; in this case you can use a pattern:
$ java -cp target/benchmarks.jar -Dbind_address=match-address:192.168.* -Djava.net.preferIPv4Stack=true org.infinispan.jmhbenchmarks.InfinispanNodeStarter

This needs to be added still.

## Start a distributed benchmark

To run the benchmark and have it connect to other nodes on the cluster but running "standalone" (see previous paragraph),
set the 'distributed=true' flag.

For example to run all Hazelcast test benchmarks while connecting to other nodes on the cluster:

$ java -jar target/benchmarks.jar -jvmArgsPrepend "-Dbind_address=192.168.1.20 -Djava.net.preferIPv4Stack=true -Ddistributed=true" -e getPutInfinispan -e infinispanG -e infinispanP


# Notes

For best results disable features such as power management, dynamic CPU scaling (especially turbo boost),
and run it on a dedicated box which has no other significant services running.
So the "run it from your IDE" approach is just meant for development of new tests.

# Network checklist

- Disable any firewall! e.g. iptables

Make sure you have a route for the 232.0.0.0 routed to the network interface connected to the cluster:

Sample route output:
232.0.0.0 0.0.0.0 248.0.0.0 U 0 0 0 enp0s25


## TODO

- have it run the other nodes in physically different boxes
- improve scenario parameters

158 changes: 158 additions & 0 deletions statetransfer/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.infinispan.jmhbenchmarks</groupId>
<artifactId>statetransfer</artifactId>
<version>0.1</version>
<packaging>jar</packaging>

<name>JMH Benchmark Infinispan State Transfer</name>

<prerequisites>
<maven>3.0</maven>
</prerequisites>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jmh.version>1.20</jmh.version>
<javac.target>1.8</javac.target>
<uberjar.name>benchmarks</uberjar.name>
<!-- <infinispan.version>10.0.0-SNAPSHOT</infinispan.version>-->
<!-- <infinispan.version>9.4.15.Final-redhat-00001</infinispan.version>-->
<infinispan.version>8.5.3.Final-redhat-00002</infinispan.version>
<!-- <infinispan.version>8.5.3-redhat-SNAPSHOT</infinispan.version>-->
<log4j.version>2.8.1</log4j.version>
</properties>

<dependencies>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmh.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
<version>${infinispan.version}</version>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
<version>${infinispan.version}</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<compilerVersion>${javac.target}</compilerVersion>
<source>${javac.target}</source>
<target>${javac.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>${uberjar.name}</finalName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.openjdk.jmh.Main</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="com.github.edwgiz.mavenShadePlugin.log4j2CacheTransformer.PluginsCacheFileTransformer">
</transformer>
</transformers>
<filters>
<filter>
<!--
Shading signed JARs will fail without this.
http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar
-->
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.github.edwgiz</groupId>
<artifactId>maven-shade-plugin.log4j2-cachefile-transformer</artifactId>
<version>${log4j.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
</plugin>
</plugins>
</pluginManagement>
</build>

</project>
28 changes: 28 additions & 0 deletions statetransfer/run8.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

set -e

JAVA8_HOME=~/Tools/java8
JFR8_OPTIONS="-XX:+UnlockCommercialFeatures -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints \
-XX:+FlightRecorder -XX:FlightRecorderOptions=stackdepth=128,dumponexitpath=. \
-XX:StartFlightRecording=settings=profile.jfc,delay=0s,dumponexit=true"

JAVA_HOME=$JAVA8_HOME
PATH=$JAVA8_HOME:$PATH

mvn package -Dinfinispan.version=9.4.15.Final

$JAVA_HOME/bin/java -jar target/benchmarks.jar -jvmArgsPrepend "$JFR8_OPTIONS" 2>&1 | tee "console-$(date +%Y-%m-%d_%H-%M).log"

JFR_BASENAME=$(basename "$(ls -t *.jfr | head -1)" .jfr)

~/Work/jfr-report-tool/jfr-report-tool -e none -w 1900 --flamegraph-command ~/Work/FlameGraph/flamegraph.pl $JFR_BASENAME$I.jfr


mvn package -Dinfinispan.version=10.0.0.CR1

$JAVA_HOME/bin/java -jar target/benchmarks.jar -jvmArgsPrepend "$JFR8_OPTIONS" 2>&1 | tee "console-$(date +%Y-%m-%d_%H-%M).log"

JFR_BASENAME=$(basename "$(ls -t *.jfr | head -1)" .jfr)

~/Work/jfr-report-tool/jfr-report-tool -e none -w 1900 --flamegraph-command ~/Work/FlameGraph/flamegraph.pl $JFR_BASENAME$I.jfr
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.infinispan.jmhbenchmarks;

import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;

/**
* Utility to launch the JMH benchmark from the IDE;
* useful for debugging issues.
*/
public class IDELauncher {

public static void main(String... args) throws Exception {
Options opts = new OptionsBuilder()
.include( ".*" )
.warmupIterations( 2 )
.measurementIterations( 10 )
.forks( 1 )
.build();

new Runner(opts).run();
}
}
Loading