IGNITE-1678 add benchmarks

Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7d1cf05c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7d1cf05c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7d1cf05c

Branch: refs/heads/ignite-1678
Commit: 7d1cf05c37867aab1a6496a97cf6ffc4727c8501
Parents: 4cdaf25
Author: Dmitriy Govorukhin <dmitriy.govoruk...@gmail.com>
Authored: Tue Aug 28 22:14:35 2018 +0300
Committer: Dmitriy Govorukhin <dmitriy.govoruk...@gmail.com>
Committed: Tue Aug 28 22:14:35 2018 +0300

----------------------------------------------------------------------
 .../jmh/sequence/JmhSequenceBenchmark.java      | 223 +++++++++++++++++++
 .../config/benchmark-atomic-sequence.properties |  84 +++++++
 .../yardstick/IgniteBenchmarkArguments.java     |  11 +
 .../cache/IgniteAtomicSequenceBenchmark.java    |  47 ----
 .../IgniteAtomicSequenceAbstractBenchmark.java  |  53 +++++
 .../IgniteAtomicSequenceAddAndGetBenchmark.java |  36 +++
 .../IgniteAtomicSequenceGetAndAddBenchmark.java |  36 +++
 ...eAtomicSequenceGetAndIncrementBenchmark.java |  33 +++
 ...eAtomicSequenceIncrementAndGetBenchmark.java |  33 +++
 9 files changed, 509 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7d1cf05c/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sequence/JmhSequenceBenchmark.java
----------------------------------------------------------------------
diff --git 
a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sequence/JmhSequenceBenchmark.java
 
b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sequence/JmhSequenceBenchmark.java
new file mode 100644
index 0000000..236e6df
--- /dev/null
+++ 
b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sequence/JmhSequenceBenchmark.java
@@ -0,0 +1,223 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.benchmarks.jmh.sequence;
+
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteAtomicSequence;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.configuration.AtomicConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.benchmarks.jmh.JmhAbstractBenchmark;
+import org.apache.ignite.internal.benchmarks.jmh.runner.JmhIdeBenchmarkRunner;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.openjdk.jmh.annotations.Benchmark;
+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 static 
org.apache.ignite.internal.benchmarks.jmh.runner.JmhIdeBenchmarkRunner.createProperty;
+
+/**
+ * JMH benchmark for {@link IgniteAtomicSequence}.
+ */
+@State(Scope.Benchmark)
+public class JmhSequenceBenchmark extends JmhAbstractBenchmark {
+    /** IP finder shared across nodes. */
+    private static final TcpDiscoveryVmIpFinder IP_FINDER = new 
TcpDiscoveryVmIpFinder(true);
+
+    /** 1/10 of batchSize. */
+    private int randomBound;
+
+    /** Property: nodes count. */
+    private static final String PROP_DATA_NODES = 
"ignite.jmh.sequence.dataNodes";
+
+    /** Property: client mode flag. */
+    private static final String PROP_CLIENT_MODE = 
"ignite.jmh.sequence.clientMode";
+
+    /** Property: reservation batch size. */
+    private static final String PROP_BATCH_SIZE = 
"ignite.jmh.sequence.batchSize";
+
+    /** Property: reservation percentage. */
+    private static final String PROP_PERCENTAGE = 
"ignite.jmh.sequence.percentage";
+
+    /** */
+    private IgniteAtomicSequence seq;
+
+    /**
+     *
+     */
+    @Setup
+    public void setup() {
+        Ignite node = Ignition.start(configuration("NODE_0"));
+
+        for (int i = 1; i < 4; i++)
+            Ignition.start(configuration("NODE_" + i));
+
+        boolean isClient = booleanProperty(PROP_CLIENT_MODE);
+
+        if (isClient) {
+            IgniteConfiguration clientCfg = configuration("client");
+
+            clientCfg.setClientMode(true);
+
+            node = Ignition.start(clientCfg);
+        }
+
+        AtomicConfiguration acfg = new AtomicConfiguration();
+
+        int batchSize = intProperty(PROP_BATCH_SIZE);
+        int percentage = intProperty(PROP_PERCENTAGE);
+
+        randomBound = batchSize < 10 ? 1 : batchSize / 10;
+
+        acfg.setAtomicSequenceReserveSize(batchSize);
+        acfg.setAtomicSequenceReservePercentage(percentage);
+
+        seq = node.atomicSequence("seq", acfg, 0, true);
+    }
+
+    /**
+     * Create Ignite configuration.
+     *
+     * @param igniteInstanceName Ignite instance name.
+     * @return Configuration.
+     */
+    private IgniteConfiguration configuration(String igniteInstanceName) {
+        IgniteConfiguration cfg = new IgniteConfiguration();
+
+        cfg.setIgniteInstanceName(igniteInstanceName);
+
+        cfg.setLocalHost("127.0.0.1");
+
+        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+        discoSpi.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(discoSpi);
+
+        return cfg;
+    }
+
+    /**
+     * Tear down routine.
+     */
+    @TearDown
+    public void tearDown() {
+        Ignition.stopAll(true);
+    }
+
+    /**
+     * Run benchmarks.
+     *
+     * @param args Arguments.
+     * @throws Exception If failed.
+     */
+    public static void main(String[] args) throws Exception {
+        run(false, 4, 10_000, 100);
+        run(false, 4, 100_000, 100);
+
+        run(true, 4, 10_000, 100);
+        run(true, 4, 100_000, 100);
+
+        run(false, 4, 10_000, 60);
+        run(false, 4, 100_000, 60);
+
+        run(true, 4, 10_000, 60);
+        run(true, 4, 100_000, 60);
+    }
+
+    /**
+     * @param client Client node.
+     * @param dataNodes Number of data nodes.
+     * @param batchSize Batch size.
+     * @param percentage Reservation percentage.
+     * @throws Exception If failed.
+     */
+    private static void run(boolean client, int dataNodes, int batchSize, int 
percentage) throws Exception {
+        String simpleClsName = JmhSequenceBenchmark.class.getSimpleName();
+
+        String output = simpleClsName +
+            "-" + (client ? "client" : "data") +
+            "-" + dataNodes +
+            "-" + batchSize;
+
+        JmhIdeBenchmarkRunner.create()
+            .forks(1)
+            .threads(5)
+            .warmupIterations(10)
+            .measurementIterations(20)
+            .output(output + ".jmh.log")
+            .benchmarks(JmhSequenceBenchmark.class.getSimpleName())
+            .jvmArguments(
+                "-Xms4g",
+                "-Xmx4g",
+                createProperty(PROP_BATCH_SIZE, batchSize),
+                createProperty(PROP_DATA_NODES, dataNodes),
+                createProperty(PROP_CLIENT_MODE, client),
+                createProperty(PROP_PERCENTAGE, percentage)
+            )
+            .run();
+    }
+
+    /**
+     * Benchmark for {@link IgniteAtomicSequence#incrementAndGet} operation.
+     *
+     * @return Long new value.
+     */
+    @Benchmark
+    public long incrementAndGet() {
+        return seq.incrementAndGet();
+    }
+
+    /**
+     * Benchmark for {@link IgniteAtomicSequence#getAndIncrement()} operation.
+     *
+     * @return Long previous value.
+     */
+    @Benchmark
+    public long getAndIncrement() {
+        return seq.getAndIncrement();
+    }
+
+    /**
+     * Benchmark for {@link IgniteAtomicSequence#addAndGet(long)} operation.
+     *
+     * @return Long new value.
+     */
+    @Benchmark
+    public long addAndGet() {
+        int key = ThreadLocalRandom.current().nextInt(randomBound) + 1;
+
+        return seq.getAndAdd(key);
+    }
+
+    /**
+     * Benchmark for {@link IgniteAtomicSequence#getAndAdd(long)} operation.
+     *
+     * @return Long previous value.
+     */
+    @Benchmark
+    public long getAndAdd() {
+        int key = ThreadLocalRandom.current().nextInt(randomBound) + 1;
+
+        return seq.getAndAdd(key);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d1cf05c/modules/yardstick/config/benchmark-atomic-sequence.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-atomic-sequence.properties 
b/modules/yardstick/config/benchmark-atomic-sequence.properties
new file mode 100644
index 0000000..2e27230
--- /dev/null
+++ b/modules/yardstick/config/benchmark-atomic-sequence.properties
@@ -0,0 +1,84 @@
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+now0=`date +'%H%M%S'`
+
+# JVM options.
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
+
+# Uncomment to enable concurrent garbage collection (GC) if you encounter long 
GC pauses.
+JVM_OPTS=${JVM_OPTS}" \
+-Xms6g \
+-Xmx6g \
+-Xloggc:./gc${now0}.log \
+-XX:+PrintGCDetails \
+-verbose:gc \
+-XX:+UseParNewGC \
+-XX:+UseConcMarkSweepGC \
+-XX:+PrintGCDateStamps \
+"
+
+#Ignite version
+ver="RELEASE-"
+
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on 
Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+# Probe point writer class name.
+# BENCHMARK_WRITER=
+
+# Comma-separated list of the hosts to run BenchmarkServers on. 2 nodes on 
local host are enabled by default.
+SERVER_HOSTS=localhost,localhost,localhost
+
+# Comma-separated list of the hosts to run BenchmarkDrivers on. 1 node on 
local host is enabled by default.
+DRIVER_HOSTS=localhost
+
+# Remote username.
+# REMOTE_USER=
+
+# Number of nodes, used to wait for the specified number of nodes to start.
+nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo 
${DRIVER_HOSTS} | tr ',' '\n' | wc -l`))
+
+# Warmup.
+w=60
+
+# Duration.
+d=300
+
+# Threads count.
+t=64
+
+# Batch size
+bs=10000
+
+# Backups count.
+b=1
+
+# Reservation percentage.
+p=60
+
+# Run configuration.
+# Note that each benchmark is set to run for 300 seconds (5 min) with warm-up 
set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -bs ${bs} -b ${b} -p 
${p} -w ${w} -d ${d} -t ${t} -dn IgniteAtomicSequenceAddAndGetBenchmark -sn 
IgniteNode -ds ${ver}atomic-sequence-addAndGet-benchmark-${bs}-${p}-${b}-backup 
-nn ${nodesNum}, \
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -bs ${bs} -b ${b} -p 
${p} -w ${w} -d ${d} -t ${t} -dn IgniteAtomicSequenceGetAndAddBenchmark -sn 
IgniteNode -ds ${ver}atomic-sequence-getAndAdd-benchmark-${bs}-${p}-${b}-backup 
-nn ${nodesNum}, \
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -bs ${bs} -b ${b} -p 
${p} -w ${w} -d ${d} -t ${t} -dn IgniteAtomicSequenceGetAndIncrementBenchmark 
-sn IgniteNode -ds 
${ver}atomic-sequence-getAndIncrement-benchmark-${bs}-${p}-${b}-backup -nn 
${nodesNum}, \
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -bs ${bs} -b ${b} -p 
${p} -w ${w} -d ${d} -t ${t} -dn IgniteAtomicSequenceIncrementAndGetBenchmark 
-sn IgniteNode -ds 
${ver}atomic-sequence-incrementAndGet-benchmark-${bs}-${p}-${b}-backup -nn 
${nodesNum}, \
+"

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d1cf05c/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
----------------------------------------------------------------------
diff --git 
a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
index 72409a0..e7b08fd 100644
--- 
a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
+++ 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
@@ -137,6 +137,10 @@ public class IgniteBenchmarkArguments {
     private int batch = 500;
 
     /** */
+    @Parameter(names = {"-p", "--percentage"}, description = "Reservation 
percentage")
+    private int percentage = 100;
+
+    /** */
     @Parameter(names = {"-col", "--collocated"}, description = "Collocated")
     private boolean collocated;
 
@@ -499,6 +503,13 @@ public class IgniteBenchmarkArguments {
     }
 
     /**
+     * @return Reservation percentage.
+     */
+    public int percentage(){
+        return percentage;
+    }
+
+    /**
      * @return Collocated.
      */
     public boolean collocated() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d1cf05c/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteAtomicSequenceBenchmark.java
----------------------------------------------------------------------
diff --git 
a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteAtomicSequenceBenchmark.java
 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteAtomicSequenceBenchmark.java
deleted file mode 100644
index e961439..0000000
--- 
a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteAtomicSequenceBenchmark.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.yardstick.cache;
-
-import java.util.Map;
-import org.apache.ignite.IgniteAtomicSequence;
-import org.apache.ignite.yardstick.IgniteAbstractBenchmark;
-import org.yardstickframework.BenchmarkConfiguration;
-
-/**
- * Ignite atomic sequence benchmark.
- */
-public class IgniteAtomicSequenceBenchmark extends IgniteAbstractBenchmark {
-    /** Cache. */
-    private IgniteAtomicSequence seq;
-
-    /** {@inheritDoc} */
-    @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
-        super.setUp(cfg);
-
-        seq = ignite().atomicSequence("benchSequence", 0, true);
-
-        seq.batchSize(args.batch());
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean test(Map<Object, Object> ctx) throws Exception {
-        seq.incrementAndGet();
-
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d1cf05c/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceAbstractBenchmark.java
----------------------------------------------------------------------
diff --git 
a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceAbstractBenchmark.java
 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceAbstractBenchmark.java
new file mode 100644
index 0000000..bb7aeff
--- /dev/null
+++ 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceAbstractBenchmark.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.sequence;
+
+import org.apache.ignite.IgniteAtomicSequence;
+import org.apache.ignite.configuration.AtomicConfiguration;
+import org.apache.ignite.yardstick.IgniteAbstractBenchmark;
+import org.yardstickframework.BenchmarkConfiguration;
+
+/**
+ * Abstract class for {@link IgniteAtomicSequence} benchmarks.
+ */
+public abstract class IgniteAtomicSequenceAbstractBenchmark extends 
IgniteAbstractBenchmark {
+    /** Bound for random operation, by default 1/10 of batchSize. */
+    protected int randomBound;
+
+    /** Sequence. */
+    protected IgniteAtomicSequence seq;
+
+    /** {@inheritDoc} */
+    @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
+        super.setUp(cfg);
+
+        int batchSize = args.batch();
+        int backups = args.backups();
+        int percentage = args.percentage();
+
+        AtomicConfiguration acfg = new AtomicConfiguration();
+
+        acfg.setAtomicSequenceReserveSize(batchSize);
+        acfg.setBackups(backups);
+        acfg.setAtomicSequenceReservePercentage(percentage);
+
+        seq = ignite().atomicSequence("benchSequence", acfg, 0, true);
+
+        randomBound = batchSize < 10 ? 1 : batchSize / 10;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d1cf05c/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceAddAndGetBenchmark.java
----------------------------------------------------------------------
diff --git 
a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceAddAndGetBenchmark.java
 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceAddAndGetBenchmark.java
new file mode 100644
index 0000000..a2ee428
--- /dev/null
+++ 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceAddAndGetBenchmark.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.sequence;
+
+import java.util.Map;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.IgniteAtomicSequence;
+
+/**
+ * {@link IgniteAtomicSequence#addAndGet(long)} benchmark.
+ */
+public class IgniteAtomicSequenceAddAndGetBenchmark extends 
IgniteAtomicSequenceAbstractBenchmark {
+    /** {@inheritDoc} */
+    @Override public boolean test(Map<Object, Object> map) throws Exception {
+        int delta = ThreadLocalRandom.current().nextInt(randomBound) + 1;
+
+        seq.addAndGet(delta);
+
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d1cf05c/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceGetAndAddBenchmark.java
----------------------------------------------------------------------
diff --git 
a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceGetAndAddBenchmark.java
 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceGetAndAddBenchmark.java
new file mode 100644
index 0000000..842b187
--- /dev/null
+++ 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceGetAndAddBenchmark.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.sequence;
+
+import java.util.Map;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.IgniteAtomicSequence;
+
+/**
+ * {@link IgniteAtomicSequence#getAndAdd(long)} benchmark.
+ */
+public class IgniteAtomicSequenceGetAndAddBenchmark extends 
IgniteAtomicSequenceAbstractBenchmark {
+    /** {@inheritDoc} */
+    @Override public boolean test(Map<Object, Object> map) throws Exception {
+        int delta = ThreadLocalRandom.current().nextInt(randomBound) + 1;
+
+        seq.getAndAdd(delta);
+
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d1cf05c/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceGetAndIncrementBenchmark.java
----------------------------------------------------------------------
diff --git 
a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceGetAndIncrementBenchmark.java
 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceGetAndIncrementBenchmark.java
new file mode 100644
index 0000000..604c1d7
--- /dev/null
+++ 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceGetAndIncrementBenchmark.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.sequence;
+
+import java.util.Map;
+import org.apache.ignite.IgniteAtomicSequence;
+
+/**
+ * {@link IgniteAtomicSequence#getAndIncrement()} benchmark.
+ */
+public class IgniteAtomicSequenceGetAndIncrementBenchmark extends 
IgniteAtomicSequenceAbstractBenchmark {
+    /** {@inheritDoc} */
+    @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+        seq.getAndIncrement();
+
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d1cf05c/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceIncrementAndGetBenchmark.java
----------------------------------------------------------------------
diff --git 
a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceIncrementAndGetBenchmark.java
 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceIncrementAndGetBenchmark.java
new file mode 100644
index 0000000..1390568
--- /dev/null
+++ 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/sequence/IgniteAtomicSequenceIncrementAndGetBenchmark.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.sequence;
+
+import java.util.Map;
+import org.apache.ignite.IgniteAtomicSequence;
+
+/**
+ * {@link IgniteAtomicSequence#incrementAndGet()} benchmark.
+ */
+public class IgniteAtomicSequenceIncrementAndGetBenchmark extends 
IgniteAtomicSequenceAbstractBenchmark {
+    /** {@inheritDoc} */
+    @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+        seq.incrementAndGet();
+
+        return true;
+    }
+}

Reply via email to