Repository: ignite Updated Branches: refs/heads/ignite-1093-2 [created] 9d5718f2e
http://git-wip-us.apache.org/repos/asf/ignite/blob/9d5718f2/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 5eb7060..a0d5b6f 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 @@ -28,6 +28,10 @@ import org.apache.ignite.transactions.*; @SuppressWarnings({"UnusedDeclaration", "FieldCanBeLocal"}) public class IgniteBenchmarkArguments { /** */ + @Parameter(names = {"-cn", "--cacheName"}, description = "Cache name") + private String cacheName; + + /** */ @Parameter(names = {"-nn", "--nodeNumber"}, description = "Node number") private int nodes = 1; @@ -265,11 +269,18 @@ public class IgniteBenchmarkArguments { } /** + * @return Cache name. + */ + public String cacheName() { + return cacheName; + } + + /** * @return Description. */ public String description() { return "-nn=" + nodes + "-b=" + backups + "-sm=" + syncMode + "-cl=" + clientOnly + "-nc=" + nearCacheFlag + - (orderMode == null ? "" : "-wom=" + orderMode) + "-txc=" + txConcurrency; + (orderMode == null ? "" : "-wom=" + orderMode) + "-txc=" + txConcurrency+ "-cn=" + cacheName; } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/ignite/blob/9d5718f2/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteCacheAbstractBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteCacheAbstractBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteCacheAbstractBenchmark.java index 3ecf904..397c7e9 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteCacheAbstractBenchmark.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteCacheAbstractBenchmark.java @@ -32,7 +32,10 @@ public abstract class IgniteCacheAbstractBenchmark extends IgniteAbstractBenchma @Override public void setUp(BenchmarkConfiguration cfg) throws Exception { super.setUp(cfg); - cache = cache(); + if (args.cacheName() != null) + cache = ignite().cache(args.cacheName()); + else + cache = cache(); } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/9d5718f2/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/rabalance/IgniteRebalancePutGetBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/rabalance/IgniteRebalancePutGetBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/rabalance/IgniteRebalancePutGetBenchmark.java new file mode 100644 index 0000000..bd4657e --- /dev/null +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/rabalance/IgniteRebalancePutGetBenchmark.java @@ -0,0 +1,72 @@ +/* + * 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.rabalance; + +import org.apache.ignite.*; +import org.apache.ignite.yardstick.cache.*; +import org.yardstickframework.*; + +import java.util.*; + +import static org.yardstickframework.BenchmarkUtils.*; + +/** + * + */ +public class IgniteRebalancePutGetBenchmark extends IgniteCacheAbstractBenchmark { + /** {@inheritDoc} */ + @Override public void setUp(BenchmarkConfiguration cfg) throws Exception { + super.setUp(cfg); + + println(cfg, "Populating query data..."); + + long start = System.nanoTime(); + + try (IgniteDataStreamer<Integer, Integer> dataLdr = ignite().dataStreamer(cache.getName())) { + for (int i = 0; i < args.range() && !Thread.currentThread().isInterrupted(); i++) { + dataLdr.addData(i, i); + + if (i % 100000 == 0) + println(cfg, "Populated: " + i); + } + + dataLdr.flush(); + } + + println(cfg, "Finished populating query data in " + ((System.nanoTime() - start) / 1_000_000) + " ms."); + } + + /** {@inheritDoc} */ + @Override public boolean test(Map<Object, Object> ctx) throws Exception { + int key = nextRandom(args.range()); + + Object val = cache.get(key); + + if (val != null) + key = nextRandom(args.range()); + + cache.put(key, key); + + return true; + } + + /** {@inheritDoc} */ + @Override protected IgniteCache<Integer, Object> cache() { + return null; + } +}
