Repository: ignite Updated Branches: refs/heads/ignite-1.4.2-slow-server-debug 2ab78f917 -> 5e40926a4
benchmark investigation Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5e40926a Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5e40926a Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5e40926a Branch: refs/heads/ignite-1.4.2-slow-server-debug Commit: 5e40926a4e5eab6ed6b5a8ed362bdd36517256a8 Parents: 2ab78f9 Author: Yakov Zhdanov <[email protected]> Authored: Fri Oct 9 18:19:31 2015 +0300 Committer: Yakov Zhdanov <[email protected]> Committed: Fri Oct 9 18:19:31 2015 +0300 ---------------------------------------------------------------------- .../yardstick/cache/IgnitePutTxBenchmark.java | 10 ++ .../IgnitePutTxSkipLocalBackupBenchmark.java | 10 ++ .../cache/WaitMapExchangeFinishCallable.java | 96 ++++++++++++++++++++ 3 files changed, 116 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/5e40926a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java index 0645b05..e29730f 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java @@ -19,13 +19,23 @@ package org.apache.ignite.yardstick.cache; import java.util.Map; import org.apache.ignite.IgniteCache; +import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.yardstick.cache.model.SampleValue; +import org.yardstickframework.BenchmarkConfiguration; /** * Ignite benchmark that performs transactional put operations. */ public class IgnitePutTxBenchmark extends IgniteCacheAbstractBenchmark { /** {@inheritDoc} */ + @Override public void setUp(BenchmarkConfiguration cfg) throws Exception { + super.setUp(cfg); + + if (!IgniteSystemProperties.getBoolean("SKIP_MAP_CHECK")) + ignite().compute().broadcast(new WaitMapExchangeFinishCallable()); + } + + /** {@inheritDoc} */ @Override public boolean test(Map<Object, Object> ctx) throws Exception { int key = nextRandom(args.range()); http://git-wip-us.apache.org/repos/asf/ignite/blob/5e40926a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxSkipLocalBackupBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxSkipLocalBackupBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxSkipLocalBackupBenchmark.java index a92898d..45db6b0 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxSkipLocalBackupBenchmark.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxSkipLocalBackupBenchmark.java @@ -18,9 +18,11 @@ package org.apache.ignite.yardstick.cache; import org.apache.ignite.IgniteCache; +import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.cache.affinity.Affinity; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.yardstick.cache.model.SampleValue; +import org.yardstickframework.BenchmarkConfiguration; import java.util.Map; @@ -29,6 +31,14 @@ import java.util.Map; */ public class IgnitePutTxSkipLocalBackupBenchmark extends IgniteCacheAbstractBenchmark { /** {@inheritDoc} */ + @Override public void setUp(BenchmarkConfiguration cfg) throws Exception { + super.setUp(cfg); + + if (!IgniteSystemProperties.getBoolean("SKIP_MAP_CHECK")) + ignite().compute().broadcast(new WaitMapExchangeFinishCallable()); + } + + /** {@inheritDoc} */ @Override public boolean test(Map<Object, Object> ctx) throws Exception { int key; http://git-wip-us.apache.org/repos/asf/ignite/blob/5e40926a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/WaitMapExchangeFinishCallable.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/WaitMapExchangeFinishCallable.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/WaitMapExchangeFinishCallable.java new file mode 100644 index 0000000..168f7d2 --- /dev/null +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/WaitMapExchangeFinishCallable.java @@ -0,0 +1,96 @@ +/* + * 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.Ignite; +import org.apache.ignite.internal.IgniteKernal; +import org.apache.ignite.internal.processors.cache.IgniteInternalCache; +import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState; +import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology; +import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap; +import org.apache.ignite.lang.IgniteCallable; +import org.apache.ignite.resources.IgniteInstanceResource; +import org.yardstickframework.BenchmarkUtils; + +import java.util.Collection; +import java.util.Map; +import java.util.UUID; + +/** + * + */ +public class WaitMapExchangeFinishCallable implements IgniteCallable<Void> { + /** */ + @IgniteInstanceResource + private Ignite ignite; + + /** {@inheritDoc} */ + @Override public Void call() throws Exception { + Collection<IgniteInternalCache<?, ?>> cachesx = ((IgniteKernal)ignite).cachesx(null); + + for (IgniteInternalCache<?, ?> cache : cachesx) { + try { + GridDhtPartitionTopology top = cache.context().isNear() ? cache.context().near().dht().topology() : + cache.context().dht().topology(); + + BenchmarkUtils.println("Validating cache: " + cache.name()); + + for (;;) { + boolean success = true; + + if (top.topologyVersion().topologyVersion() == ignite.cluster().topologyVersion()) { + for (Map.Entry<UUID, GridDhtPartitionMap> e : top.partitionMap(true).entrySet()) { + for (Map.Entry<Integer, GridDhtPartitionState> p : e.getValue().entrySet()) { + if (p.getValue() != GridDhtPartitionState.OWNING) { + BenchmarkUtils.println("Not owning partition [part=" + p.getKey() + + ", state=" + p.getValue() + ']'); + + success = false; + + break; + } + } + + if (!success) + break; + } + } + else { + BenchmarkUtils.println("Topology version is different [cache=" + top.topologyVersion() + + ", cluster=" + ignite.cluster().topologyVersion() + ']'); + + success = false; + } + + if (!success) + Thread.sleep(1000); + else { + BenchmarkUtils.println("Cache state is fine: " + cache.name()); + + break; + } + } + } + catch (RuntimeException e1) { + BenchmarkUtils.println("Ignored exception: " + e1); + } + } + + return null; + } +}
