ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkuliche...@apache.org
Subject ignite git commit: Invoke benchmarks
Date Wed, 04 Nov 2015 05:43:42 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-invoke-bench [created] a3043b278


Invoke benchmarks


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

Branch: refs/heads/ignite-invoke-bench
Commit: a3043b2787bf7e6b4bbc80ce154436606df6ac90
Parents: 0cfb32f
Author: Valentin Kulichenko <valentin.kulichenko@gmail.com>
Authored: Tue Nov 3 21:43:31 2015 -0800
Committer: Valentin Kulichenko <valentin.kulichenko@gmail.com>
Committed: Tue Nov 3 21:43:31 2015 -0800

----------------------------------------------------------------------
 .../yardstick/cache/InvokeAllBenchmark.java     | 65 ++++++++++++++++++++
 .../ignite/yardstick/cache/InvokeBenchmark.java | 57 +++++++++++++++++
 2 files changed, 122 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a3043b27/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/InvokeAllBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/InvokeAllBenchmark.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/InvokeAllBenchmark.java
new file mode 100644
index 0000000..07482e9
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/InvokeAllBenchmark.java
@@ -0,0 +1,65 @@
+/*
+ * 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.HashMap;
+import java.util.Map;
+import javax.cache.processor.EntryProcessor;
+import javax.cache.processor.EntryProcessorException;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheEntryProcessor;
+
+/**
+ * Ignite benchmark that performs put operations.
+ */
+public class InvokeAllBenchmark extends IgniteCacheAbstractBenchmark<String, Object>
{
+    /** {@inheritDoc} */
+    @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+        Map<String, EntryProcessor<String, Object, Object>> map = new HashMap<>(args.batch());
+
+        for (int i = 0; i < args.batch(); i++) {
+            String key = "key" + nextRandom(args.range());
+
+            map.put(key, new EP(new byte[500]));
+        }
+
+        cache.invokeAll(map);
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteCache<String, Object> cache() {
+        return ignite().cache("atomic");
+    }
+
+    private static class EP implements CacheEntryProcessor<String, Object, Object>
{
+        private final byte[] payload;
+
+        public EP(byte[] payload) {
+            this.payload = payload;
+        }
+
+        @Override public Object process(MutableEntry<String, Object> e, Object... args)
throws EntryProcessorException {
+            for (long i = 0; i < 1000000; i++);
+
+            return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/a3043b27/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/InvokeBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/InvokeBenchmark.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/InvokeBenchmark.java
new file mode 100644
index 0000000..084be2d
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/InvokeBenchmark.java
@@ -0,0 +1,57 @@
+/*
+ * 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 javax.cache.processor.EntryProcessorException;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheEntryProcessor;
+
+/**
+ * Ignite benchmark that performs put operations.
+ */
+public class InvokeBenchmark extends IgniteCacheAbstractBenchmark<String, Object> {
+    /** {@inheritDoc} */
+    @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+        String key = "key" + nextRandom(args.range());
+
+        cache.invoke(key, new EP(new byte[500]));
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteCache<String, Object> cache() {
+        return ignite().cache("atomic");
+    }
+
+    private static class EP implements CacheEntryProcessor<String, Object, Object>
{
+        private final byte[] payload;
+
+        public EP(byte[] payload) {
+            this.payload = payload;
+        }
+
+        @Override public Object process(MutableEntry<String, Object> e, Object... args)
throws EntryProcessorException {
+            for (long i = 0; i < 1000000; i++);
+
+            return null;
+        }
+    }
+}


Mime
View raw message