=cdd #18328 add JMH benchmark, baseline
[info] Benchmark (set1Size) Mode Cnt Score Error Units [info] ORSetMergeBenchmark.mergeAddFromBothNodes 1 thrpt 10 492.291 ± 55.903 ops/ms [info] ORSetMergeBenchmark.mergeAddFromBothNodes 10 thrpt 10 79.890 ± 4.977 ops/ms [info] ORSetMergeBenchmark.mergeAddFromBothNodes 20 thrpt 10 44.560 ± 9.081 ops/ms [info] ORSetMergeBenchmark.mergeAddFromBothNodes 100 thrpt 10 9.405 ± 0.323 ops/ms [info] ORSetMergeBenchmark.mergeAddFromOtherNode 1 thrpt 10 714.043 ± 14.694 ops/ms [info] ORSetMergeBenchmark.mergeAddFromOtherNode 10 thrpt 10 88.281 ± 13.858 ops/ms [info] ORSetMergeBenchmark.mergeAddFromOtherNode 20 thrpt 10 49.001 ± 0.940 ops/ms [info] ORSetMergeBenchmark.mergeAddFromOtherNode 100 thrpt 10 9.379 ± 0.300 ops/ms [info] ORSetMergeBenchmark.mergeAddFromSameNode 1 thrpt 10 487.261 ± 7.457 ops/ms [info] ORSetMergeBenchmark.mergeAddFromSameNode 10 thrpt 10 80.073 ± 9.736 ops/ms [info] ORSetMergeBenchmark.mergeAddFromSameNode 20 thrpt 10 46.385 ± 1.225 ops/ms [info] ORSetMergeBenchmark.mergeAddFromSameNode 100 thrpt 10 9.583 ± 0.234 ops/ms [info] ORSetMergeBenchmark.mergeComplex 1 thrpt 10 313.959 ± 31.419 ops/ms [info] ORSetMergeBenchmark.mergeComplex 10 thrpt 10 79.265 ± 1.126 ops/ms [info] ORSetMergeBenchmark.mergeComplex 20 thrpt 10 44.478 ± 2.077 ops/ms [info] ORSetMergeBenchmark.mergeComplex 100 thrpt 10 9.202 ± 0.564 ops/ms [info] Benchmark (size) Mode Cnt Score Error Units [info] VersionVectorBenchmark.compareGreaterThan1 1 thrpt 10 15628.820 ± 913.690 ops/ms [info] VersionVectorBenchmark.compareGreaterThan1 2 thrpt 10 15471.453 ± 216.868 ops/ms [info] VersionVectorBenchmark.compareGreaterThan1 5 thrpt 10 12518.032 ± 1599.615 ops/ms [info] VersionVectorBenchmark.compareGreaterThan2 1 thrpt 10 15320.311 ± 279.346 ops/ms [info] VersionVectorBenchmark.compareGreaterThan2 2 thrpt 10 13667.638 ± 414.068 ops/ms [info] VersionVectorBenchmark.compareGreaterThan2 5 thrpt 10 12708.479 ± 287.942 ops/ms [info] VersionVectorBenchmark.compareSame1 1 thrpt 10 16096.976 ± 495.227 ops/ms [info] VersionVectorBenchmark.compareSame1 2 thrpt 10 15399.394 ± 305.350 ops/ms [info] VersionVectorBenchmark.compareSame1 5 thrpt 10 12754.067 ± 1466.724 ops/ms [info] VersionVectorBenchmark.compareSame2 1 thrpt 10 15282.217 ± 318.708 ops/ms [info] VersionVectorBenchmark.compareSame2 2 thrpt 10 13777.859 ± 328.712 ops/ms [info] VersionVectorBenchmark.compareSame2 5 thrpt 10 12711.851 ± 1159.166 ops/ms [info] VersionVectorBenchmark.increment 1 thrpt 10 33512.998 ± 610.102 ops/ms [info] VersionVectorBenchmark.increment 2 thrpt 10 32245.963 ± 317.847 ops/ms [info] VersionVectorBenchmark.increment 5 thrpt 10 20970.493 ± 346.039 ops/ms [info] VersionVectorBenchmark.merge 1 thrpt 10 31914.961 ± 1000.649 ops/ms [info] VersionVectorBenchmark.merge 2 thrpt 10 14560.442 ± 732.734 ops/ms [info] VersionVectorBenchmark.merge 5 thrpt 10 3673.067 ± 148.871 ops/ms [info] VersionVectorBenchmark.mergeConflicting 1 thrpt 10 5436.032 ± 531.450 ops/ms [info] VersionVectorBenchmark.mergeConflicting 2 thrpt 10 4641.969 ± 59.338 ops/ms [info] VersionVectorBenchmark.mergeConflicting 5 thrpt 10 3489.843 ± 127.217 ops/ms
This commit is contained in:
parent
a75a1cdf87
commit
a4b5de535f
3 changed files with 159 additions and 1 deletions
|
|
@ -0,0 +1,80 @@
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2015 Typesafe Inc. <http://www.typesafe.com>
|
||||||
|
*/
|
||||||
|
package akka.cluster.ddata
|
||||||
|
|
||||||
|
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.Measurement
|
||||||
|
import org.openjdk.jmh.annotations.Mode
|
||||||
|
import org.openjdk.jmh.annotations.OutputTimeUnit
|
||||||
|
import org.openjdk.jmh.annotations.{ Scope => JmhScope }
|
||||||
|
import org.openjdk.jmh.annotations.State
|
||||||
|
import org.openjdk.jmh.annotations.Warmup
|
||||||
|
import akka.actor.ActorPath
|
||||||
|
import akka.cluster.UniqueAddress
|
||||||
|
import akka.actor.Address
|
||||||
|
import org.openjdk.jmh.annotations.Param
|
||||||
|
import org.openjdk.jmh.annotations.Setup
|
||||||
|
import org.openjdk.jmh.annotations.Level
|
||||||
|
|
||||||
|
@Fork(2)
|
||||||
|
@State(JmhScope.Benchmark)
|
||||||
|
@BenchmarkMode(Array(Mode.Throughput))
|
||||||
|
@Warmup(iterations = 4)
|
||||||
|
@Measurement(iterations = 5)
|
||||||
|
@OutputTimeUnit(TimeUnit.MILLISECONDS)
|
||||||
|
class ORSetMergeBenchmark {
|
||||||
|
|
||||||
|
@Param(Array("1", "10", "20", "100"))
|
||||||
|
var set1Size = 0
|
||||||
|
|
||||||
|
val nodeA = UniqueAddress(Address("akka.tcp", "Sys", "aaaa", 2552), 1)
|
||||||
|
val nodeB = UniqueAddress(nodeA.address.copy(host = Some("bbbb")), 2)
|
||||||
|
val nodeC = UniqueAddress(nodeA.address.copy(host = Some("cccc")), 3)
|
||||||
|
val nodeD = UniqueAddress(nodeA.address.copy(host = Some("dddd")), 4)
|
||||||
|
val nodeE = UniqueAddress(nodeA.address.copy(host = Some("eeee")), 5)
|
||||||
|
val nodes = Vector(nodeA, nodeB, nodeC, nodeD, nodeE)
|
||||||
|
val nodesIndex = Iterator.from(0)
|
||||||
|
def nextNode(): UniqueAddress = nodes(nodesIndex.next() % nodes.size)
|
||||||
|
|
||||||
|
var set1: ORSet[String] = _
|
||||||
|
var addFromSameNode: ORSet[String] = _
|
||||||
|
var addFromOtherNode: ORSet[String] = _
|
||||||
|
var complex1: ORSet[String] = _
|
||||||
|
var complex2: ORSet[String] = _
|
||||||
|
var elem1: String = _
|
||||||
|
var elem2: String = _
|
||||||
|
|
||||||
|
@Setup(Level.Trial)
|
||||||
|
def setup() {
|
||||||
|
set1 = (1 to set1Size).foldLeft(ORSet.empty[String])((s, n) => s.add(nextNode(), "elem" + n))
|
||||||
|
addFromSameNode = set1.add(nodeA, "elem" + set1Size + 1).merge(set1)
|
||||||
|
addFromOtherNode = set1.add(nodeB, "elem" + set1Size + 1).merge(set1)
|
||||||
|
complex1 = set1.add(nodeB, "a").add(nodeC, "b").remove(nodeD, "elem" + set1Size).merge(set1)
|
||||||
|
complex2 = set1.add(nodeA, "a").add(nodeA, "c").add(nodeB, "d").merge(set1)
|
||||||
|
elem1 = "elem" + (set1Size + 1)
|
||||||
|
elem2 = "elem" + (set1Size + 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
def mergeAddFromSameNode: ORSet[String] = {
|
||||||
|
// this is the scenario when updating and then merging with local value
|
||||||
|
// set2 produced by modify function
|
||||||
|
val set2 = set1.add(nodeA, elem1).add(nodeA, elem2)
|
||||||
|
// replicator merges with local value
|
||||||
|
set1.merge(set2)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
def mergeAddFromOtherNode: ORSet[String] = set1.merge(addFromOtherNode)
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
def mergeAddFromBothNodes: ORSet[String] = addFromSameNode.merge(addFromOtherNode)
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
def mergeComplex: ORSet[String] = complex1.merge(complex2)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2015 Typesafe Inc. <http://www.typesafe.com>
|
||||||
|
*/
|
||||||
|
package akka.cluster.ddata
|
||||||
|
|
||||||
|
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.Measurement
|
||||||
|
import org.openjdk.jmh.annotations.Mode
|
||||||
|
import org.openjdk.jmh.annotations.OutputTimeUnit
|
||||||
|
import org.openjdk.jmh.annotations.{ Scope => JmhScope }
|
||||||
|
import org.openjdk.jmh.annotations.State
|
||||||
|
import org.openjdk.jmh.annotations.Warmup
|
||||||
|
import akka.actor.ActorPath
|
||||||
|
import akka.cluster.UniqueAddress
|
||||||
|
import akka.actor.Address
|
||||||
|
import org.openjdk.jmh.annotations.Param
|
||||||
|
import org.openjdk.jmh.annotations.Setup
|
||||||
|
import org.openjdk.jmh.annotations.Level
|
||||||
|
import scala.collection.immutable.TreeMap
|
||||||
|
|
||||||
|
@Fork(2)
|
||||||
|
@State(JmhScope.Benchmark)
|
||||||
|
@BenchmarkMode(Array(Mode.Throughput))
|
||||||
|
@Warmup(iterations = 4)
|
||||||
|
@Measurement(iterations = 5)
|
||||||
|
@OutputTimeUnit(TimeUnit.MILLISECONDS)
|
||||||
|
class VersionVectorBenchmark {
|
||||||
|
|
||||||
|
@Param(Array("1", "2", "5"))
|
||||||
|
var size = 0
|
||||||
|
|
||||||
|
val nodeA = UniqueAddress(Address("akka.tcp", "Sys", "aaaa", 2552), 1)
|
||||||
|
val nodeB = UniqueAddress(nodeA.address.copy(host = Some("bbbb")), 2)
|
||||||
|
val nodeC = UniqueAddress(nodeA.address.copy(host = Some("cccc")), 3)
|
||||||
|
val nodeD = UniqueAddress(nodeA.address.copy(host = Some("dddd")), 4)
|
||||||
|
val nodeE = UniqueAddress(nodeA.address.copy(host = Some("eeee")), 5)
|
||||||
|
val nodes = Vector(nodeA, nodeB, nodeC, nodeD, nodeE)
|
||||||
|
val nodesIndex = Iterator.from(0)
|
||||||
|
def nextNode(): UniqueAddress = nodes(nodesIndex.next() % nodes.size)
|
||||||
|
|
||||||
|
var vv1: VersionVector = _
|
||||||
|
var vv2: VersionVector = _
|
||||||
|
var vv3: VersionVector = _
|
||||||
|
var dot1: VersionVector = _
|
||||||
|
|
||||||
|
@Setup(Level.Trial)
|
||||||
|
def setup() {
|
||||||
|
vv1 = (1 to size).foldLeft(VersionVector.empty)((vv, n) => vv + nextNode())
|
||||||
|
vv2 = vv1 + nextNode()
|
||||||
|
vv3 = vv1 + nextNode()
|
||||||
|
dot1 = VersionVector(TreeMap(nodeA -> vv1.versions(nodeA)))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
def increment: VersionVector = (vv1 + nodeA)
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
def compareSame1: Boolean = (vv1 == dot1)
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
def compareSame2: Boolean = (vv2 == dot1)
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
def compareGreaterThan1: Boolean = (vv1 > dot1)
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
def compareGreaterThan2: Boolean = (vv2 > dot1)
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
def merge: VersionVector = vv1.merge(vv2)
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
def mergeConflicting: VersionVector = vv2.merge(vv3)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -103,7 +103,7 @@ object AkkaBuild extends Build {
|
||||||
lazy val benchJmh = Project(
|
lazy val benchJmh = Project(
|
||||||
id = "akka-bench-jmh",
|
id = "akka-bench-jmh",
|
||||||
base = file("akka-bench-jmh"),
|
base = file("akka-bench-jmh"),
|
||||||
dependencies = Seq(actor, persistence, testkit).map(_ % "compile;compile->test;provided->provided")
|
dependencies = Seq(actor, persistence, distributedData, testkit).map(_ % "compile;compile->test;provided->provided")
|
||||||
).disablePlugins(ValidatePullRequest)
|
).disablePlugins(ValidatePullRequest)
|
||||||
|
|
||||||
lazy val protobuf = Project(
|
lazy val protobuf = Project(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue