Repository: ignite Updated Branches: refs/heads/master 2a0e35426 -> f78bf2c66
IGNITE-10280 Added yardstick IgniteGetAllTxBenchmark Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f78bf2c6 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f78bf2c6 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f78bf2c6 Branch: refs/heads/master Commit: f78bf2c66f6bbb9b23f573a9dc53bf08607fbfb6 Parents: 2a0e354 Author: Alexey Goncharuk <[email protected]> Authored: Fri Nov 30 12:16:55 2018 +0300 Committer: Alexey Goncharuk <[email protected]> Committed: Fri Nov 30 12:24:55 2018 +0300 ---------------------------------------------------------------------- .../cache/IgniteGetAllTxBenchmark.java | 50 ++++++++++++++++++++ 1 file changed, 50 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/f78bf2c6/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetAllTxBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetAllTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetAllTxBenchmark.java new file mode 100644 index 0000000..d4e71ed --- /dev/null +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetAllTxBenchmark.java @@ -0,0 +1,50 @@ +/* + * 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 java.util.Set; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.internal.util.typedef.internal.U; + +/** + * Ignite benchmark that performs getAll operations. + */ +public class IgniteGetAllTxBenchmark extends IgniteGetBenchmark { + /** {@inheritDoc} */ + @Override public boolean test(Map<Object, Object> ctx) throws Exception { + Set<Integer> keys = U.newHashSet(args.batch()); + + while (keys.size() < args.batch()) { + int key = nextRandom(args.range()); + + keys.add(key); + } + + IgniteCache<Integer, Object> cache = cacheForOperation(); + + cache.getAll(keys); + + return true; + } + + /** {@inheritDoc} */ + @Override protected IgniteCache<Integer, Object> cache() { + return ignite().cache("tx"); + } +}
