Repository: ignite Updated Branches: refs/heads/ignite-1.4.2-slow-server-debug 5e40926a4 -> 4ce4ff198
benchmark investigation Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4ce4ff19 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4ce4ff19 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4ce4ff19 Branch: refs/heads/ignite-1.4.2-slow-server-debug Commit: 4ce4ff1984c00f93235978b175d06723d639ac2c Parents: 5e40926 Author: Yakov Zhdanov <[email protected]> Authored: Mon Oct 12 16:55:10 2015 +0300 Committer: Yakov Zhdanov <[email protected]> Committed: Mon Oct 12 16:55:10 2015 +0300 ---------------------------------------------------------------------- .../distributed/dht/GridDhtTxPrepareFuture.java | 24 ++++--- .../cache/IgnitePutTxPrimaryOnlyBenchmark.java | 66 ++++++++++++++++++++ 2 files changed, 82 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/4ce4ff19/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java index 57d5d19..165c8a9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java @@ -813,14 +813,22 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter this.txNodes = txNodes; // TODO Remove (for debug only) - if (debug && txNodes.size() > 2 && writes != null && writes.size() == 1) { - U.debug( - log, - "\n>>>\n>>> TX nodes [txNodes=" + txNodes + ", txFut=" + this + ']'); - - for (IgniteTxEntry entry : writes) { - U.debug(log, "\tEntry: " + entry); - U.debug(log, "\tPartitions: " + entry.context().topology().partitionMap(false).toFullString()); + if (debug) { + Collection<UUID> backups = txNodes.get(cctx.localNodeId()); + + if (backups != null && backups.size() >= 2 && writes != null && writes.size() == 1){ + U.debug( + log, + "\n>>>\n>>> TX nodes [txNodes=" + txNodes + ", txFut=" + this + ']'); + + for (IgniteTxEntry entry : writes) { + U.debug( + log, + "\tEntry: " + entry); + U.debug( + log, + "\tPartitions: " + entry.context().topology().partitionMap(false).toFullString()); + } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/4ce4ff19/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxPrimaryOnlyBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxPrimaryOnlyBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxPrimaryOnlyBenchmark.java new file mode 100644 index 0000000..9c44923 --- /dev/null +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxPrimaryOnlyBenchmark.java @@ -0,0 +1,66 @@ +/* + * 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; +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; + +/** + * Ignite benchmark that performs transactional put operations skipping key if local node is backup. + */ +public class IgnitePutTxPrimaryOnlyBenchmark 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; + + Affinity<Object> aff = ignite().affinity("tx"); + ClusterNode locNode = ignite().cluster().localNode(); + + for (;;) { + key = nextRandom(args.range()); + + // Exit only if primary. + if (aff.isPrimary(locNode, key)) + break; + } + + // Implicit transaction is used. + cache.put(key, new SampleValue(key)); + + return true; + } + + /** {@inheritDoc} */ + @Override protected IgniteCache<Integer, Object> cache() { + return ignite().cache("tx"); + } +}
