Added put/remove benchmarks.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0726d320 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0726d320 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0726d320 Branch: refs/heads/ignite-3477-merge2.0 Commit: 0726d3200a411817dae8c00cc183c49b25bb1f6f Parents: d20b7f1 Author: sboikov <sboi...@gridgain.com> Authored: Mon Feb 6 14:11:06 2017 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Mon Feb 6 14:11:06 2017 +0300 ---------------------------------------------------------------------- .../cache/IgnitePutRemoveBenchmark.java | 42 ++++++++++++++++++++ .../cache/IgnitePutRemoveTxBenchmark.java | 30 ++++++++++++++ 2 files changed, 72 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/0726d320/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutRemoveBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutRemoveBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutRemoveBenchmark.java new file mode 100644 index 0000000..7ea3d91 --- /dev/null +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutRemoveBenchmark.java @@ -0,0 +1,42 @@ +/* + * 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.IgniteCache; +import org.apache.ignite.yardstick.cache.model.SampleValue; + +/** + * Ignite benchmark that performs put and immediate remove operations. + */ +public class IgnitePutRemoveBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> { + /** {@inheritDoc} */ + @Override public boolean test(Map<Object, Object> ctx) throws Exception { + int key = nextRandom(args.range()); + + cache.put(key, new SampleValue(key)); + cache.remove(key); + + return true; + } + + /** {@inheritDoc} */ + @Override protected IgniteCache<Integer, Object> cache() { + return ignite().cache("atomic"); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/0726d320/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutRemoveTxBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutRemoveTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutRemoveTxBenchmark.java new file mode 100644 index 0000000..ec88083 --- /dev/null +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutRemoveTxBenchmark.java @@ -0,0 +1,30 @@ +/* + * 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 org.apache.ignite.IgniteCache; + +/** + * + */ +public class IgnitePutRemoveTxBenchmark extends IgnitePutRemoveBenchmark { + /** {@inheritDoc} */ + @Override protected IgniteCache<Integer, Object> cache() { + return ignite().cache("tx"); + } +}