Skip to content

Commit 58b523d

Browse files
committed
JBTM-4014-perf-test draft
1 parent 2bf0144 commit 58b523d

File tree

6 files changed

+587
-1
lines changed

6 files changed

+587
-1
lines changed

narayana/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
<module>ArjunaJTS/jts</module>
8888
<module>ArjunaJTA/jta</module>
8989
<module>ArjunaCore/arjuna</module>
90+
<module>stm</module>
9091
<module>tools</module>
9192
</modules>
9293

@@ -175,4 +176,4 @@
175176
</dependency>
176177
</dependencies>
177178
</dependencyManagement>
178-
</project>
179+
</project>

narayana/stm/README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
2+
mvn clean package
3+
java -jar target/benchmarks.jar
4+
5+
6+
I created 3 benchmarks (see https://github.com/jbosstm/performance/pull/185):
7+
BaselineBenchmark: adds two integers together
8+
LocalJTABenchmark.benchmark: starts a JTA txn and enlists a single XAResource and commits
9+
STMBenchmark.benchmark: starts an AtomicAction and increments and decrements two integers backed by transaction memory
10+
11+
I ran the benchmarks three times taking the best result from each.
12+
13+
Comparing the the % difference between the pr/2414 and main branches I found that
14+
15+
BaselineBenchmark.benchmark: pr/2414 is 0.2% worse
16+
LocalJTABenchmark.benchmark: pr/2414 is 10% better
17+
STMBenchmark.benchmark: pr/2414 is 0.25% worse
18+
19+
So if the LocalJTABenchmark result is repeatable then I think 10% gain is significant.
20+
21+
22+
23+
24+
JMH output:
25+
26+
main branch
27+
28+
Benchmark Mode Cnt Score Error Units
29+
Hammer.testMethod thrpt 20 1067.636 ± 178.005 ops/s
30+
LocalJTA.benchmark thrpt 20 954510.170 ± 6402.297 ops/s
31+
MyBenchmark.testMethod thrpt 20 4579137210.418 ± 69013446.030 ops/s
32+
33+
|Benchmark Mode Cnt Score Error Units
34+
Hammer.testMethod thrpt 20 1067.572 ± 186.971 ops/s
35+
LocalJTA.benchmark thrpt 20 957903.778 ± 6489.387 ops/s
36+
MyBenchmark.testMethod thrpt 20 4636450701.134 ± 96601135.880 ops/s
37+
38+
39+
pr/2414 branch
40+
41+
Benchmark Mode Cnt Score Error Units
42+
Hammer.testMethod thrpt 20 1051.849 ± 162.813 ops/s
43+
LocalJTA.benchmark thrpt 20 1062807.947 ± 1979.548 ops/s
44+
MyBenchmark.testMethod thrpt 20 4611712845.913 ± 81049198.799 ops/s
45+
46+
Benchmark Mode Cnt Score Error Units
47+
Hammer.testMethod thrpt 20 1076.842 ± 199.523 ops/s
48+
LocalJTA.benchmark thrpt 20 1060085.625 ± 4898.738 ops/s
49+
MyBenchmark.testMethod thrpt 20 4537578018.823 ± 51773253.141 ops/s
50+
51+
====
52+
53+
54+
55+
BaselineBenchmark.benchmark: 4693599081.697/4701406003.318*100 = 99.83394496%
56+
LocalJTABenchmark.benchmark: 1056908.446/961397.739*100 = 109.934567466%
57+
STMBenchmark.benchmark: 1231.517/1234.618*100 = 99.748829193%
58+
59+
pr/2414 branch
60+
61+
Benchmark Mode Cnt Score Error Units
62+
BaselineBenchmark.benchmark thrpt 20 4633135964.698 ± 31491578.275 ops/s
63+
LocalJTABenchmark.benchmark thrpt 20 1053117.791 ± 8698.347 ops/s
64+
STMBenchmark.benchmark thrpt 20 1164.906 ± 198.650 ops/s
65+
66+
Benchmark Mode Cnt Score Error Units
67+
BaselineBenchmark.benchmark thrpt 20 4693599081.697 ± 16716957.140 ops/s
68+
LocalJTABenchmark.benchmark thrpt 20 1046537.204 ± 7882.340 ops/s
69+
STMBenchmark.benchmark thrpt 20 1189.513 ± 162.600 ops/s
70+
71+
Benchmark Mode Cnt Score Error Units
72+
BaselineBenchmark.benchmark thrpt 20 4587872431.227 ± 81535039.134 ops/s
73+
LocalJTABenchmark.benchmark thrpt 20 1056908.446 ± 6232.722 ops/s
74+
STMBenchmark.benchmark thrpt 20 1231.517 ± 247.400 ops/s
75+
76+
main branch
77+
78+
Benchmark Mode Cnt Score Error Units
79+
BaselineBenchmark.benchmark thrpt 20 4701406003.318 ± 19310303.884 ops/s
80+
LocalJTABenchmark.benchmark thrpt 20 956348.781 ± 4521.559 ops/s
81+
STMBenchmark.benchmark thrpt 20 1099.805 ± 251.556 ops/s
82+
83+
Benchmark Mode Cnt Score Error Units
84+
BaselineBenchmark.benchmark thrpt 20 4610215379.401 ± 20147677.468 ops/s
85+
LocalJTABenchmark.benchmark thrpt 20 955100.760 ± 8112.364 ops/s
86+
STMBenchmark.benchmark thrpt 20 1234.618 ± 208.418 ops/s
87+
88+
Benchmark Mode Cnt Score Error Units
89+
BaselineBenchmark.benchmark thrpt 20 4642252941.051 ± 30375124.007 ops/s
90+
LocalJTABenchmark.benchmark thrpt 20 961397.739 ± 7019.971 ops/s
91+
STMBenchmark.benchmark thrpt 20 1142.922 ± 231.379 ops/s
92+
93+
94+

narayana/stm/pom.xml

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>org.jboss.narayana.stm</groupId>
6+
<artifactId>stm-benchmark</artifactId>
7+
<version>7.3.1.Final-SNAPSHOT</version>
8+
<packaging>jar</packaging>
9+
10+
<name>JMH benchmarks: stm vs local jta</name>
11+
12+
<dependencies>
13+
<dependency>
14+
<groupId>org.openjdk.jmh</groupId>
15+
<artifactId>jmh-core</artifactId>
16+
<version>${jmh.version}</version>
17+
</dependency>
18+
<dependency>
19+
<groupId>org.openjdk.jmh</groupId>
20+
<artifactId>jmh-generator-annprocess</artifactId>
21+
<version>${jmh.version}</version>
22+
<scope>provided</scope>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.jboss.narayana.arjunacore</groupId>
26+
<artifactId>arjunacore</artifactId>
27+
<version>${project.version}</version>
28+
</dependency>
29+
<dependency>
30+
<groupId>org.jboss.narayana.jta</groupId>
31+
<artifactId>jta</artifactId>
32+
<version>${project.version}</version>
33+
</dependency>
34+
<dependency>
35+
<groupId>org.jboss.narayana.stm</groupId>
36+
<artifactId>stm</artifactId>
37+
<version>${project.version}</version>
38+
</dependency>
39+
<dependency>
40+
<groupId>jakarta.transaction</groupId>
41+
<artifactId>jakarta.transaction-api</artifactId>
42+
<version>2.0.1</version>
43+
</dependency>
44+
45+
<dependency>
46+
<groupId>org.jboss</groupId>
47+
<artifactId>jboss-transaction-spi</artifactId>
48+
<version>7.6.1.Final</version>
49+
<exclusions>
50+
<exclusion>
51+
<groupId>org.jboss.logging</groupId>
52+
<artifactId>jboss-logging-spi</artifactId>
53+
</exclusion>
54+
</exclusions>
55+
</dependency>
56+
</dependencies>
57+
58+
<properties>
59+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
60+
<jmh.version>1.37</jmh.version>
61+
<javac.target>1.8</javac.target>
62+
<uberjar.name>benchmarks</uberjar.name>
63+
</properties>
64+
65+
<build>
66+
<plugins>
67+
<plugin>
68+
<groupId>org.apache.maven.plugins</groupId>
69+
<artifactId>maven-compiler-plugin</artifactId>
70+
<version>3.8.0</version>
71+
<configuration>
72+
<compilerVersion>${javac.target}</compilerVersion>
73+
<source>${javac.target}</source>
74+
<target>${javac.target}</target>
75+
</configuration>
76+
</plugin>
77+
<plugin>
78+
<groupId>org.apache.maven.plugins</groupId>
79+
<artifactId>maven-shade-plugin</artifactId>
80+
<version>3.2.1</version>
81+
<executions>
82+
<execution>
83+
<phase>package</phase>
84+
<goals>
85+
<goal>shade</goal>
86+
</goals>
87+
<configuration>
88+
<finalName>${uberjar.name}</finalName>
89+
<transformers>
90+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
91+
<mainClass>org.openjdk.jmh.Main</mainClass>
92+
</transformer>
93+
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
94+
</transformers>
95+
<filters>
96+
<filter>
97+
<!--
98+
Shading signed JARs will fail without this.
99+
http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar
100+
-->
101+
<artifact>*:*</artifact>
102+
<excludes>
103+
<exclude>META-INF/*.SF</exclude>
104+
<exclude>META-INF/*.DSA</exclude>
105+
<exclude>META-INF/*.RSA</exclude>
106+
</excludes>
107+
</filter>
108+
</filters>
109+
</configuration>
110+
</execution>
111+
</executions>
112+
</plugin>
113+
</plugins>
114+
<pluginManagement>
115+
<plugins>
116+
<plugin>
117+
<artifactId>maven-clean-plugin</artifactId>
118+
<version>2.5</version>
119+
</plugin>
120+
<plugin>
121+
<artifactId>maven-deploy-plugin</artifactId>
122+
<version>2.8.1</version>
123+
</plugin>
124+
<plugin>
125+
<artifactId>maven-install-plugin</artifactId>
126+
<version>2.5.1</version>
127+
</plugin>
128+
<plugin>
129+
<artifactId>maven-jar-plugin</artifactId>
130+
<version>2.4</version>
131+
</plugin>
132+
<plugin>
133+
<artifactId>maven-javadoc-plugin</artifactId>
134+
<version>2.9.1</version>
135+
</plugin>
136+
<plugin>
137+
<artifactId>maven-resources-plugin</artifactId>
138+
<version>2.6</version>
139+
</plugin>
140+
<plugin>
141+
<artifactId>maven-site-plugin</artifactId>
142+
<version>3.3</version>
143+
</plugin>
144+
<plugin>
145+
<artifactId>maven-source-plugin</artifactId>
146+
<version>2.2.1</version>
147+
</plugin>
148+
<plugin>
149+
<artifactId>maven-surefire-plugin</artifactId>
150+
<version>2.17</version>
151+
</plugin>
152+
</plugins>
153+
</pluginManagement>
154+
</build>
155+
</project>
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/*
2+
Copyright The Narayana Authors
3+
SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
7+
8+
package org.jboss.narayana.stm;
9+
10+
import javax.transaction.xa.XAException;
11+
import javax.transaction.xa.XAResource;
12+
import javax.transaction.xa.Xid;
13+
import java.io.Serializable;
14+
15+
/*
16+
* Currently XAResources must be serializable so we can
17+
* recreate them in the event of a failure. It is likely
18+
* that other mechanisms will be added later to remove
19+
* this necessity, although serialization will still be
20+
* supported.
21+
*/
22+
23+
public class DummyXA implements XAResource, Serializable
24+
{
25+
private static final long serialVersionUID = -2285367224867593569L;
26+
27+
public DummyXA(boolean print)
28+
{
29+
_timeout = 0; // no timeout
30+
_print = print;
31+
}
32+
33+
public void commit (Xid xid, boolean onePhase) throws XAException
34+
{
35+
if (_print)
36+
System.out.println("DummyXA.commit called");
37+
}
38+
39+
public void end (Xid xid, int flags) throws XAException
40+
{
41+
if (_print)
42+
System.out.println("DummyXA.end called");
43+
}
44+
45+
public void forget (Xid xid) throws XAException
46+
{
47+
if (_print)
48+
System.out.println("DummyXA.forget called");
49+
}
50+
51+
public int getTransactionTimeout () throws XAException
52+
{
53+
if (_print)
54+
System.out.println("DummyXA.getTransactionTimeout called");
55+
56+
return _timeout;
57+
}
58+
59+
public int prepare (Xid xid) throws XAException
60+
{
61+
if (_print)
62+
System.out.println("DummyXA.prepare called");
63+
64+
return XAResource.XA_OK;
65+
}
66+
67+
public Xid[] recover (int flag) throws XAException
68+
{
69+
if (_print)
70+
System.out.println("DummyXA.recover called");
71+
72+
return null;
73+
}
74+
75+
public void rollback (Xid xid) throws XAException
76+
{
77+
if (_print)
78+
System.out.println("DummyXA.rollback called");
79+
}
80+
81+
public boolean setTransactionTimeout (int seconds) throws XAException
82+
{
83+
if (_print)
84+
System.out.println("DummyXA.setTransactionTimeout called");
85+
86+
_timeout = seconds;
87+
88+
return true;
89+
}
90+
91+
public void start (Xid xid, int flags) throws XAException
92+
{
93+
if (_print)
94+
System.out.println("DummyXA.start called");
95+
}
96+
97+
public boolean isSameRM (XAResource xares) throws XAException
98+
{
99+
if (_print)
100+
System.out.println("DummyXA.isSameRM called");
101+
102+
return (xares == this);
103+
}
104+
105+
private int _timeout;
106+
private boolean _print;
107+
108+
}

0 commit comments

Comments
 (0)