http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheBenchmark.java b/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheBenchmark.java deleted file mode 100644 index 1ee1d08..0000000 --- a/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheBenchmark.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * 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.gridgain.loadtests.cache; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.internal.util.typedef.*; -import org.gridgain.testframework.*; -import org.jetbrains.annotations.*; - -import java.util.*; -import java.util.concurrent.*; -import java.util.concurrent.atomic.*; - -/** - * Benchmark for cache {@code putx()} and {@code get()} operations. - */ -public class GridCacheBenchmark { - /** Warm up time. */ - public static final long WARM_UP_TIME = Long.getLong("TEST_WARMUP_TIME", 20000); - - /** Number of puts. */ - private static final long PUT_CNT = Integer.getInteger("TEST_PUT_COUNT", 3000000); - - /** Thread count. */ - private static final int THREADS = Integer.getInteger("TEST_THREAD_COUNT", 16); - - /** Test write or read operations. */ - private static boolean testWrite = Boolean.getBoolean("TEST_WRITE"); - - /** Cache name. */ - private static final String CACHE = "partitioned"; - - /** Counter. */ - private static final AtomicLong cntr = new AtomicLong(); - - /** */ - private static final int LOG_MOD = 500000; - - /** - * @param args Arguments. - * @throws Exception If failed. - */ - @SuppressWarnings("BusyWait") - public static void main(String[] args) throws Exception { - GridFileLock fileLock = GridLoadTestUtils.fileLock(); - - fileLock.lock(); - - try { - final String outputFileName = args.length > 0 ? args[0] : null; - - // try (Grid g = G.start("modules/core/src/test/config/load/cache-client-benchmark.xml")) { - try (Ignite g = G.start("modules/core/src/test/config/load/cache-benchmark.xml")) { - X.println("warmupTime=" + WARM_UP_TIME); - X.println("putCnt=" + PUT_CNT); - X.println("threadCnt=" + THREADS); - X.println("testWrite=" + testWrite); - - final GridCache<Long, Long> cache = g.cache(CACHE); - - assert cache != null; - - cntr.set(0); - - final AtomicLong opCnt = new AtomicLong(); - - X.println("Warming up (putx)..."); - - GridLoadTestUtils.runMultithreadedInLoop(new Callable<Object>() { - @Nullable @Override public Object call() throws Exception { - long keyVal = cntr.incrementAndGet(); - - cache.putx(keyVal % 100000, keyVal); - - long ops = opCnt.incrementAndGet(); - - if (ops % LOG_MOD == 0) - X.println(">>> Performed " + ops + " operations."); - - return null; - } - }, THREADS, WARM_UP_TIME); - - cntr.set(0); - - opCnt.set(0); - - X.println("Warming up (get)..."); - - GridLoadTestUtils.runMultithreadedInLoop(new Callable<Object>() { - @Nullable @Override public Object call() throws Exception { - long keyVal = cntr.incrementAndGet(); - - Long old = cache.get(keyVal % 100000); - - long ops = opCnt.incrementAndGet(); - - if (ops % LOG_MOD == 0) - X.println(">>> Performed " + ops + " operations, old=" + old + ", keyval=" + keyVal); - - return null; - } - }, THREADS, WARM_UP_TIME); - - cache.clearAll(); - - System.gc(); - - cntr.set(0); - - opCnt.set(0); - - X.println("Starting GridGain cache putx() benchmark..."); - - long durPutx = GridLoadTestUtils.measureTime(new Callable<Object>() { - @Nullable @Override public Object call() throws Exception { - while (true) { - long keyVal = cntr.incrementAndGet(); - - if (keyVal >= PUT_CNT) - break; - - cache.putx(keyVal % 100000, keyVal); - - long ops = opCnt.incrementAndGet(); - - if (ops % LOG_MOD == 0) - X.println(">>> Performed " + ops + " operations."); - } - - return null; - } - }, THREADS); - - X.println(">>>"); - X.println(">> GridGain cache putx() benchmark results [duration=" + durPutx + " ms, tx/sec=" + - (opCnt.get() * 1000 / durPutx) + ", total=" + opCnt.get() + ']'); - X.println(">>>"); - - System.gc(); - - cntr.set(0); - - opCnt.set(0); - - X.println("Starting GridGain cache get() benchmark..."); - - long durGet = GridLoadTestUtils.measureTime(new Callable<Object>() { - @Nullable @Override public Object call() throws Exception { - while (true) { - long keyVal = cntr.incrementAndGet(); - - if (keyVal >= PUT_CNT) - break; - - Long old = cache.get(keyVal % 100000); - - long ops = opCnt.incrementAndGet(); - - if (ops % LOG_MOD == 0) - X.println(">>> Performed " + ops + " operations, old=" + old + ", keyval=" + keyVal); - } - - return null; - } - }, THREADS); - - X.println(">>>"); - X.println(">> GridGain cache get() benchmark results [duration=" + durGet + " ms, tx/sec=" + - (opCnt.get() * 1000 / durGet) + ", total=" + opCnt.get() + ']'); - X.println(">>>"); - - if (outputFileName != null) - GridLoadTestUtils.appendLineToFile( - outputFileName, - "%s,%d,%d", - GridLoadTestUtils.DATE_TIME_FORMAT.format(new Date()), - durPutx, - durGet); - } - } - finally { - fileLock.close(); - } - } -}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheDataStructuresLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheDataStructuresLoadTest.java b/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheDataStructuresLoadTest.java deleted file mode 100644 index c19b67e..0000000 --- a/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheDataStructuresLoadTest.java +++ /dev/null @@ -1,364 +0,0 @@ -/* - * 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.gridgain.loadtests.cache; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cache.datastructures.*; -import org.apache.ignite.internal.util.typedef.*; - -import java.util.*; - -/** - * Cache data structures load test. - */ -public final class GridCacheDataStructuresLoadTest extends GridCacheAbstractLoadTest { - /** Atomic long name. */ - private static final String TEST_LONG_NAME = "test-atomic-long"; - - /** Atomic reference name. */ - private static final String TEST_REF_NAME = "test-atomic-ref"; - - /** Atomic sequence name. */ - private static final String TEST_SEQ_NAME = "test-atomic-seq"; - - /** Atomic stamped name. */ - private static final String TEST_STAMP_NAME = "test-atomic-stamp"; - - /** Queue name. */ - private static final String TEST_QUEUE_NAME = "test-queue"; - - /** Count down latch name. */ - private static final String TEST_LATCH_NAME = "test-latch"; - - /** Maximum added value. */ - private static final int MAX_INT = 1000; - - /** Count down latch initial count. */ - private static final int LATCH_INIT_CNT = 1000; - - /** */ - private static final boolean LONG = false; - - /** */ - private static final boolean REF = false; - - /** */ - private static final boolean SEQ = false; - - /** */ - private static final boolean STAMP = false; - - /** */ - private static final boolean QUEUE = false; - - /** */ - private static final boolean LATCH = true; - - /** */ - private GridCacheDataStructuresLoadTest() { - // No-op - } - - /** Atomic long write closure. */ - private final CIX1<GridCacheProjection<Integer, Integer>> longWriteClos = - new CIX1<GridCacheProjection<Integer, Integer>>() { - @Override public void applyx(GridCacheProjection<Integer, Integer> cache) - throws IgniteCheckedException { - GridCacheAtomicLong al = cache.cache().dataStructures().atomicLong(TEST_LONG_NAME, 0, true); - - for (int i = 0; i < operationsPerTx; i++) { - al.addAndGet(RAND.nextInt(MAX_INT)); - - long cnt = writes.incrementAndGet(); - - if (cnt % WRITE_LOG_MOD == 0) - info("Performed " + cnt + " writes."); - } - } - }; - - /** Atomic long read closure. */ - private final CIX1<GridCacheProjection<Integer, Integer>> longReadClos = - new CIX1<GridCacheProjection<Integer, Integer>>() { - @Override public void applyx(GridCacheProjection<Integer, Integer> cache) - throws IgniteCheckedException { - GridCacheAtomicLong al = cache.cache().dataStructures().atomicLong(TEST_LONG_NAME, 0, true); - - for (int i = 0; i < operationsPerTx; i++) { - al.get(); - - long cnt = reads.incrementAndGet(); - - if (cnt % READ_LOG_MOD == 0) - info("Performed " + cnt + " reads."); - } - } - }; - - /** Atomic reference write closure. */ - private final CIX1<GridCacheProjection<Integer, Integer>> refWriteClos = - new CIX1<GridCacheProjection<Integer, Integer>>() { - @Override public void applyx(GridCacheProjection<Integer, Integer> cache) - throws IgniteCheckedException { - GridCacheAtomicReference<Integer> ar = cache.cache().dataStructures().atomicReference(TEST_REF_NAME, - null, true); - - for (int i = 0; i < operationsPerTx; i++) { - ar.set(RAND.nextInt(MAX_INT)); - - long cnt = writes.incrementAndGet(); - - if (cnt % WRITE_LOG_MOD == 0) - info("Performed " + cnt + " writes."); - } - } - }; - - /** Atomic reference read closure. */ - private final CIX1<GridCacheProjection<Integer, Integer>> refReadClos = - new CIX1<GridCacheProjection<Integer, Integer>>() { - @Override public void applyx(GridCacheProjection<Integer, Integer> cache) - throws IgniteCheckedException { - GridCacheAtomicReference<Integer> ar = cache.cache().dataStructures().atomicReference(TEST_REF_NAME, null, - true); - - for (int i = 0; i < operationsPerTx; i++) { - ar.get(); - - long cnt = reads.incrementAndGet(); - - if (cnt % READ_LOG_MOD == 0) - info("Performed " + cnt + " reads."); - } - } - }; - - /** Atomic sequence write closure. */ - private final CIX1<GridCacheProjection<Integer, Integer>> seqWriteClos = - new CIX1<GridCacheProjection<Integer, Integer>>() { - @Override public void applyx(GridCacheProjection<Integer, Integer> cache) - throws IgniteCheckedException { - GridCacheAtomicSequence as = cache.cache().dataStructures().atomicSequence(TEST_SEQ_NAME, 0, true); - - for (int i = 0; i < operationsPerTx; i++) { - as.addAndGet(RAND.nextInt(MAX_INT) + 1); - - long cnt = writes.incrementAndGet(); - - if (cnt % WRITE_LOG_MOD == 0) - info("Performed " + cnt + " writes."); - } - } - }; - - /** Atomic sequence read closure. */ - private final CIX1<GridCacheProjection<Integer, Integer>> seqReadClos = - new CIX1<GridCacheProjection<Integer, Integer>>() { - @Override public void applyx(GridCacheProjection<Integer, Integer> cache) - throws IgniteCheckedException { - GridCacheAtomicSequence as = cache.cache().dataStructures().atomicSequence(TEST_SEQ_NAME, 0, true); - - for (int i = 0; i < operationsPerTx; i++) { - as.get(); - - long cnt = reads.incrementAndGet(); - - if (cnt % READ_LOG_MOD == 0) - info("Performed " + cnt + " reads."); - } - } - }; - - /** Atomic stamped write closure. */ - private final CIX1<GridCacheProjection<Integer, Integer>> stampWriteClos = - new CIX1<GridCacheProjection<Integer, Integer>>() { - @Override public void applyx(GridCacheProjection<Integer, Integer> cache) - throws IgniteCheckedException { - GridCacheAtomicStamped<Integer, Integer> as = cache.cache().dataStructures().atomicStamped(TEST_STAMP_NAME, - 0, 0, true); - - for (int i = 0; i < operationsPerTx; i++) { - as.set(RAND.nextInt(MAX_INT), RAND.nextInt(MAX_INT)); - - long cnt = writes.incrementAndGet(); - - if (cnt % WRITE_LOG_MOD == 0) - info("Performed " + cnt + " writes."); - } - } - }; - - /** Atomic stamped read closure. */ - private final CIX1<GridCacheProjection<Integer, Integer>> stampReadClos = - new CIX1<GridCacheProjection<Integer, Integer>>() { - @Override public void applyx(GridCacheProjection<Integer, Integer> cache) - throws IgniteCheckedException { - GridCacheAtomicStamped<Integer, Integer> as = cache.cache().dataStructures().atomicStamped(TEST_STAMP_NAME, - 0, 0, true); - - for (int i = 0; i < operationsPerTx; i++) { - as.get(); - - long cnt = reads.incrementAndGet(); - - if (cnt % READ_LOG_MOD == 0) - info("Performed " + cnt + " reads."); - } - } - }; - - /** Queue write closure. */ - private final CIX1<GridCacheProjection<Integer, Integer>> queueWriteClos = - new CIX1<GridCacheProjection<Integer, Integer>>() { - @Override public void applyx(GridCacheProjection<Integer, Integer> cache) - throws IgniteCheckedException { - GridCacheQueue<Integer> q = cache.cache().dataStructures().queue(TEST_QUEUE_NAME, 0, true, true); - - for (int i = 0; i < operationsPerTx; i++) { - q.put(RAND.nextInt(MAX_INT)); - - long cnt = writes.incrementAndGet(); - - if (cnt % WRITE_LOG_MOD == 0) - info("Performed " + cnt + " writes."); - } - } - }; - - /** Queue read closure. */ - private final CIX1<GridCacheProjection<Integer, Integer>> queueReadClos = - new CIX1<GridCacheProjection<Integer, Integer>>() { - @Override public void applyx(GridCacheProjection<Integer, Integer> cache) - throws IgniteCheckedException { - GridCacheQueue<Integer> q = cache.cache().dataStructures().queue(TEST_QUEUE_NAME, 0, true, true); - - for (int i = 0; i < operationsPerTx; i++) { - q.peek(); - - long cnt = reads.incrementAndGet(); - - if (cnt % READ_LOG_MOD == 0) - info("Performed " + cnt + " reads."); - } - } - }; - - /** Count down latch write closure. */ - private final CIX1<GridCacheProjection<Integer, Integer>> latchWriteClos = - new CIX1<GridCacheProjection<Integer, Integer>>() { - @Override public void applyx(GridCacheProjection<Integer, Integer> cache) - throws IgniteCheckedException { - GridCacheCountDownLatch l = cache.cache().dataStructures().countDownLatch(TEST_LATCH_NAME, LATCH_INIT_CNT, - true, true); - - for (int i = 0; i < operationsPerTx; i++) { - l.countDown(); - - long cnt = writes.incrementAndGet(); - - if (cnt % WRITE_LOG_MOD == 0) - info("Performed " + cnt + " writes."); - } - } - }; - - /** Count down latch read closure. */ - private final CIX1<GridCacheProjection<Integer, Integer>> latchReadClos = - new CIX1<GridCacheProjection<Integer, Integer>>() { - @Override public void applyx(GridCacheProjection<Integer, Integer> cache) - throws IgniteCheckedException { - GridCacheCountDownLatch l = cache.cache().dataStructures().countDownLatch(TEST_LATCH_NAME, LATCH_INIT_CNT, - true, true); - - for (int i = 0; i < operationsPerTx; i++) { - l.count(); - - long cnt = reads.incrementAndGet(); - - if (cnt % READ_LOG_MOD == 0) - info("Performed " + cnt + " reads."); - } - } - }; - - /** - * @param args Arguments. - * @throws IgniteCheckedException In case of error. - */ - public static void main(String[] args) throws IgniteCheckedException { - System.setProperty(IgniteSystemProperties.GG_UPDATE_NOTIFIER, "false"); - - System.out.println("Starting master node [params=" + Arrays.toString(args) + ']'); - - String cfg = args.length >= 1 ? args[0] : CONFIG_FILE; - String log = args.length >= 2 ? args[1] : LOG_FILE; - - final GridCacheDataStructuresLoadTest test = new GridCacheDataStructuresLoadTest(); - - try (Ignite g = Ignition.start(test.configuration(cfg, log))) { - System.gc(); - - if (LONG) { - info("Testing atomic long..."); - - test.loadTest(test.longWriteClos, test.longReadClos); - } - - System.gc(); - - if (REF) { - info("Testing atomic reference..."); - - test.loadTest(test.refWriteClos, test.refReadClos); - } - - System.gc(); - - if (SEQ) { - info("Testing atomic sequence..."); - - test.loadTest(test.seqWriteClos, test.seqReadClos); - } - - System.gc(); - - if (STAMP) { - info("Testing atomic stamped..."); - - test.loadTest(test.stampWriteClos, test.stampReadClos); - } - - System.gc(); - - if (QUEUE) { - info("Testing queue..."); - - test.loadTest(test.queueWriteClos, test.queueReadClos); - } - - System.gc(); - - if (LATCH) { - info("Testing count down latch..."); - - test.loadTest(test.latchWriteClos, test.latchReadClos); - } - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheGroupLockComparisonTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheGroupLockComparisonTest.java b/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheGroupLockComparisonTest.java deleted file mode 100644 index 6342bf6..0000000 --- a/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheGroupLockComparisonTest.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * 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.gridgain.loadtests.cache; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cache.affinity.*; -import org.apache.ignite.transactions.*; -import org.apache.ignite.internal.util.typedef.*; -import org.gridgain.testframework.*; -import org.jetbrains.annotations.*; - -import java.util.*; -import java.util.concurrent.*; -import java.util.concurrent.atomic.*; - -import static org.apache.ignite.transactions.IgniteTxConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.IgniteTxIsolation.REPEATABLE_READ; - -/** - * Performance comparison between putAll and group lock. - * - */ -public class GridCacheGroupLockComparisonTest { - /** Batch size. */ - private static final int BATCH_SIZE = Integer.getInteger("TEST_BATCH_SIZE", 25000); - - /** Thread count. */ - private static final int THREADS = Integer.getInteger("TEST_THREAD_COUNT", 16); - - /** Cache name. */ - private static final String CACHE = "partitioned"; - - /** Total number of objects in cache. */ - private static final long OBJECT_CNT = Integer.getInteger("TEST_OBJECT_COUNT", 2000000); - - /** Counter. */ - private static final AtomicLong cntr = new AtomicLong(); - - /** */ - private static final int LOG_MOD = 50000; - - /** - * @param args Arguments. - * @throws Exception If failed. - */ - public static void main(String[] args) throws Exception { - try (Ignite g = G.start("modules/tests/config/load/cache-benchmark.xml")) { - System.out.println("threadCnt=" + THREADS); - System.out.println("objectCnt=" + OBJECT_CNT); - System.out.println("batchSize=" + BATCH_SIZE); - - // Populate and warm-up. - gridGainGroupLock(g, OBJECT_CNT, THREADS); - - gridGainGroupLock(g, OBJECT_CNT, THREADS); - } - } - - /** - * @param ignite Grid. - * @param max Maximum cache size. - * @param threads Threads. - * @throws Exception If failed. - */ - private static void gridGainPutAll(Ignite ignite, final long max, int threads) throws Exception { - X.println(">>>"); - X.println(">>> Testing putAll"); - X.println(">>>"); - - final GridCache<GridCacheAffinityKey<Long>, Long> cache = ignite.cache(CACHE); - - assert cache != null; - - final AtomicLong opCnt = new AtomicLong(); - - cntr.set(0); - - final long start = System.currentTimeMillis(); - - GridTestUtils.runMultiThreaded(new Callable<Object>() { - @Nullable @Override public Object call() throws Exception { - while (true) { - Map<GridCacheAffinityKey<Long>, Long> vals = - new HashMap<>(BATCH_SIZE); - - long start = cntr.getAndAdd(BATCH_SIZE); - - if (start >= max) - break; - - for (long i = start; i < start + BATCH_SIZE; i++) - vals.put(new GridCacheAffinityKey<>(i % 100000, start), i); - - cache.putAll(vals); - - long ops = opCnt.addAndGet(BATCH_SIZE); - - if (ops % LOG_MOD == 0) - X.println(">>> Performed " + ops + " operations."); - } - - return null; - } - }, threads, "load-worker"); - - long dur = System.currentTimeMillis() - start; - - X.println(">>>"); - X.println(">> putAll timed results [dur=" + dur + " ms, tx/sec=" + (opCnt.get() * 1000 / dur) + - ", total=" + opCnt.get() + ", duration=" + (dur + 500) / 1000 + "s]"); - X.println(">>>"); - } - - /** - * @param ignite Grid. - * @param max Maximum cache size. - * @param threads Threads. - * @throws Exception If failed. - */ - private static void gridGainGroupLock(Ignite ignite, final long max, int threads) throws Exception { - X.println(">>>"); - X.println(">>> Testing group lock"); - X.println(">>>"); - - final GridCache<GridCacheAffinityKey<Long>, Long> cache = ignite.cache(CACHE); - - assert cache != null; - - final AtomicLong opCnt = new AtomicLong(); - - cntr.set(0); - - final AtomicInteger range = new AtomicInteger(); - - final long start = System.currentTimeMillis(); - - GridTestUtils.runMultiThreaded(new Callable<Object>() { - @Nullable @Override public Object call() throws Exception { - int affIdx = range.getAndIncrement(); - - String affKey = Thread.currentThread().getName(); - - long rangeCnt = OBJECT_CNT / THREADS; - - long base = affIdx * rangeCnt; - - X.println("Going to put vals in range [" + base + ", " + (base + rangeCnt - 1) + ']'); - - long key = 0; - - while (true) { - long total = cntr.getAndAdd(BATCH_SIZE); - - if (total >= max) - break; - - // Threads should not lock the same key. - - try (IgniteTx tx = cache.txStartAffinity(affKey, PESSIMISTIC, REPEATABLE_READ, 0, BATCH_SIZE)) { - for (long i = 0; i < BATCH_SIZE; i++) { - cache.put(new GridCacheAffinityKey<>((key % rangeCnt) + base, affKey), i); - - key++; - } - - tx.commit(); - } - - long ops = opCnt.addAndGet(BATCH_SIZE); - - if (ops % LOG_MOD == 0) - X.println(">>> Performed " + ops + " operations."); - } - - return null; - } - }, threads, "load-worker"); - - long dur = System.currentTimeMillis() - start; - - X.println(">>>"); - X.println(">>> Cache size: " + cache.size()); - X.println(">>> Group lock timed results [dur=" + dur + " ms, tx/sec=" + (opCnt.get() * 1000 / dur) + - ", total=" + opCnt.get() + ", duration=" + (dur + 500) / 1000 + "s]"); - X.println(">>>"); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheLoadTest.java b/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheLoadTest.java deleted file mode 100644 index 3e7eead..0000000 --- a/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheLoadTest.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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.gridgain.loadtests.cache; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.internal.util.typedef.*; -import org.gridgain.testframework.*; - -import java.util.*; -import java.util.concurrent.*; -import java.util.concurrent.atomic.*; - -/** - * Cache load test. - */ -public final class GridCacheLoadTest extends GridCacheAbstractLoadTest { - /** Memory test. */ - private static final boolean MEMORY = false; - - /** Load test. */ - private static final boolean LOAD = true; - - /** */ - private static final int KEY_RANGE = 1000; - - /** */ - private GridCacheLoadTest() { - // No-op - } - - /** Write closure. */ - private final CIX1<GridCacheProjection<Integer, Integer>> writeClos = - new CIX1<GridCacheProjection<Integer, Integer>>() { - @Override public void applyx(GridCacheProjection<Integer, Integer> cache) - throws IgniteCheckedException { - for (int i = 0; i < operationsPerTx; i++) { - int kv = RAND.nextInt(KEY_RANGE); - - assert cache.putx(kv, kv); - - long cnt = writes.incrementAndGet(); - - if (cnt % WRITE_LOG_MOD == 0) - info("Performed " + cnt + " writes"); - } - } - }; - - /** Read closure. */ - private final CIX1<GridCacheProjection<Integer, Integer>> readClos = - new CIX1<GridCacheProjection<Integer, Integer>>() { - @Override public void applyx(GridCacheProjection<Integer, Integer> cache) - throws IgniteCheckedException { - for (int i = 0; i < operationsPerTx; i++) { - int k = RAND.nextInt(KEY_RANGE); - - Integer v = cache.get(k); - - if (v != null && !v.equals(k)) - error("Invalid value [k=" + k + ", v=" + v + ']'); - - long cnt = reads.incrementAndGet(); - - if (cnt % READ_LOG_MOD == 0) - info("Performed " + cnt + " reads"); - } - } - }; - - /** - * @return New byte array. - */ - private byte[] newArray() { - byte[] bytes = new byte[valSize]; - - // Populate one byte. - bytes[RAND.nextInt(valSize)] = 1; - - return bytes; - } - - /** - * - */ - @SuppressWarnings({"ErrorNotRethrown", "InfiniteLoopStatement"}) - private void memoryTest() { - Ignite ignite = G.ignite(); - - final GridCache<Integer, byte[]> cache = ignite.cache(null); - - assert cache != null; - - final AtomicInteger cnt = new AtomicInteger(); - - try { - GridTestUtils.runMultiThreaded(new Callable() { - @Override public Object call() throws Exception { - while (true) { - int idx; - - cache.putx(idx = cnt.getAndIncrement(), newArray()); - - if (idx % 1000 == 0) - info("Stored '" + idx + "' objects in cache [cache-size=" + cache.keySet().size() + ']'); - } - } - }, threads, "memory-test-worker"); - } - catch (OutOfMemoryError ignore) { - info("Populated '" + cnt.get() + "' 1K objects into cache [cache-size=" + cache.keySet().size() + ']'); - } - catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * @param args Command line. - * @throws Exception If fails. - */ - public static void main(String[] args) throws Exception { - System.setProperty(IgniteSystemProperties.GG_UPDATE_NOTIFIER, "false"); - - System.out.println("Starting master node [params=" + Arrays.toString(args) + ']'); - - String cfg = args.length >= 1 ? args[0] : CONFIG_FILE; - String log = args.length >= 2 ? args[1] : LOG_FILE; - - final GridCacheLoadTest test = new GridCacheLoadTest(); - - try (Ignite g = Ignition.start(test.configuration(cfg, log))) { - System.gc(); - - if (LOAD) - test.loadTest(test.writeClos, test.readClos); - - G.ignite().cache(null).clearAll(); - - System.gc(); - - if (MEMORY) - test.memoryTest(); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCachePutRemoveLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCachePutRemoveLoadTest.java b/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCachePutRemoveLoadTest.java deleted file mode 100644 index 520c1b0..0000000 --- a/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCachePutRemoveLoadTest.java +++ /dev/null @@ -1,373 +0,0 @@ -/* - * 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.gridgain.loadtests.cache; - -import com.beust.jcommander.*; -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cache.eviction.lru.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.internal.util.tostring.*; - -import java.util.*; -import java.util.concurrent.*; -import java.util.concurrent.atomic.*; - -import static org.apache.ignite.cache.GridCacheAtomicityMode.*; -import static org.apache.ignite.cache.GridCacheMemoryMode.*; -import static org.apache.ignite.cache.GridCacheDistributionMode.*; - -/** - * The benchmark that performs put and remove operations on the cache to identify memory leaks. - * <P> - * Run this class with needed parameters. Type '-help' to get the list of the available parameters. - */ -public class GridCachePutRemoveLoadTest { - /** */ - private final Arguments args; - - /** */ - private GridCache<Object, Object> cache; - - /** - * @param args Arguments. - */ - public GridCachePutRemoveLoadTest(Arguments args) { - this.args = args; - } - - /** - * @param a Arguments. - */ - public static void main(String[] a) { - Arguments args = new Arguments(); - - JCommander jCommander = new JCommander(); - - jCommander.setAcceptUnknownOptions(true); - jCommander.addObject(args); - - jCommander.parse(a); - - if (args.help()) { - jCommander.usage(); - - return; - } - - X.println(args.toString()); - - GridCachePutRemoveLoadTest test = new GridCachePutRemoveLoadTest(args); - - try { - test.startNodes(); - - test.runTest(); - } - catch (Exception e) { - e.printStackTrace(); - } - finally { - G.stopAll(true); - } - } - - /** - * @throws Exception If failed. - */ - protected void startNodes() throws Exception { - for (int i = 0; i < args.nodes(); i++) { - IgniteConfiguration cfg = - GridGainEx.loadConfiguration("modules/core/src/test/config/spring-cache-put-remove-load.xml").get1(); - - assert cfg != null; - - cfg.setGridName("g" + i); - - CacheConfiguration cacheCfg = cfg.getCacheConfiguration()[0]; - - GridCacheDistributionMode distro = i == 0 && - args.distribution() == CLIENT_ONLY ? CLIENT_ONLY : PARTITIONED_ONLY; - - cacheCfg.setCacheMode(args.cache()); - cacheCfg.setDistributionMode(distro); - cacheCfg.setWriteSynchronizationMode(args.synchronization()); - cacheCfg.setAtomicWriteOrderMode(args.orderMode()); - - if (cacheCfg.getCacheMode() == GridCacheMode.PARTITIONED) - cacheCfg.setBackups(args.backups()); - - if (args.isOffHeap()) { - cacheCfg.setOffHeapMaxMemory(0); - - if (args.isOffheapValues()) - cacheCfg.setMemoryMode(OFFHEAP_VALUES); - } - - cacheCfg.setAtomicityMode(args.transactional() ? TRANSACTIONAL : ATOMIC); - - if (args.evictionEnabled()) - cacheCfg.setEvictionPolicy(new GridCacheLruEvictionPolicy(1000)); - - G.start(cfg); - } - - Ignite g = G.ignite("g0"); - - assert g != null; - - cache = g.cache("cache"); - - assert cache != null; - } - - /** - * @throws Exception If failed. - */ - @SuppressWarnings("BusyWait") - private void runTest() throws Exception { - X.println(">>>"); - X.println(">>> Running test."); - X.println(">>>"); - - final AtomicLong putNum = new AtomicLong(); - - final AtomicLong rmvNum = new AtomicLong(); - - Thread timer = new Thread(new Runnable() { - @Override public void run() { - try { - while (!Thread.currentThread().isInterrupted()) { - long rmv = rmvNum.get(); - - long put = putNum.get(); - - if (args.evictionEnabled()) - X.println("Put: " + put); - else - X.println("Put: " + put + ", removed: " + rmv); - - Thread.sleep(5000); - } - } - catch (InterruptedException e) { - e.printStackTrace(); - } - } - }); - - timer.setDaemon(true); - timer.start(); - - int queueSize = 100000; - - final BlockingQueue<Long> queue = new ArrayBlockingQueue<>(queueSize); - - if (!args.evictionEnabled()) { - Thread rmvThread = new Thread(new Runnable() { - @Override public void run() { - try { - for (long i = 0; i < Long.MAX_VALUE; i++) { - Long key = queue.take(); - - cache.removex(key); - - rmvNum.set(key); - } - } - catch (Exception e) { - e.printStackTrace(); - } - } - }, "rmvThread"); - - rmvThread.start(); - } - - for (long i = 0; i < Long.MAX_VALUE; i++) { - cache.putx(i, i); - - putNum.set(i); - - if (!args.evictionEnabled()) { - // Wait for queue to be empty if remove operation is slower than put operation. - if (!queue.offer(i)) { - while (!queue.isEmpty()) - Thread.sleep(1000); - - X.println("Waited for the remover thread to empty the queue."); - - queue.offer(i); - } - } - } - } - - /** - * - */ - private static class Arguments { - /** Main arguments (arguments without prefix '-') fall here. */ - @Parameter(description = "Main arguments") - @GridToStringExclude - private Iterable<String> mainArgs = new ArrayList<>(); - - /** */ - @Parameter(names = "-n", description = "Nodes") - private int nodes = 1; - - /** */ - @Parameter(names = "-cm", description = "Cache Mode") - private GridCacheMode cacheMode = GridCacheMode.PARTITIONED; - - /** */ - @Parameter(names = "-sm", description = "Synchronization Mode") - private GridCacheWriteSynchronizationMode syncMode = GridCacheWriteSynchronizationMode.PRIMARY_SYNC; - - /** */ - @Parameter(names = "-wo", description = "Write Ordering Mode") - private GridCacheAtomicWriteOrderMode orderMode = GridCacheAtomicWriteOrderMode.CLOCK; - - /** */ - @Parameter(names = "-dm", description = "Distribution mode") - private GridCacheDistributionMode distroMode = PARTITIONED_ONLY; - - /** */ - @Parameter(names = "-ot", description = "Tiered Offheap") - private boolean offheapTiered; - - /** */ - @Parameter(names = "-ov", description = "Offheap Values Only") - private boolean offheapVals; - - /** */ - @Parameter(names = "-b", description = "Backups") - private int backups; - - /** */ - @Parameter(names = "-tx", description = "Whether transactional cache is used or not") - private boolean tx; - - /** */ - @Parameter(names = "-ee", description = "Eviction Enabled") - private boolean evictionEnabled; - - /** */ - @Parameter(names = "-help", description = "Print this help message") - private boolean help; - - /** - * @return If help requested. - */ - public boolean help() { - return help; - } - - /** - * @return Distribution. - */ - public GridCacheDistributionMode distribution() { - return distroMode; - } - - /** - * @return Cache Mode. - */ - public GridCacheMode cache() { - return cacheMode; - } - - /** - * @return Synchronization. - */ - public GridCacheWriteSynchronizationMode synchronization() { - return syncMode; - } - - /** - * @return Cache write ordering mode. - */ - public GridCacheAtomicWriteOrderMode orderMode() { - return orderMode; - } - - /** - * @return Backups. - */ - public int backups() { - return backups; - } - - /** - * @return Offheap tiered. - */ - public boolean isOffheapTiered() { - return offheapTiered; - } - - /** - * @return Offheap values. - */ - public boolean isOffheapValues() { - return offheapVals; - } - - /** - * @return {@code True} if any offheap is enabled. - */ - public boolean isOffHeap() { - return offheapTiered || offheapVals; - } - - /** - * @return Nodes. - */ - public int nodes() { - return nodes; - } - - /** - * @return Whether transactional cache is used or not. - */ - public boolean transactional() { - return tx; - } - - /** - * @return Eviction enabled. - */ - public boolean evictionEnabled() { - return evictionEnabled; - } - - /** - * @return Main arguments. - */ - public Iterable<String> mainArgs() { - return mainArgs; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(Arguments.class, this); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheSingleNodeLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheSingleNodeLoadTest.java b/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheSingleNodeLoadTest.java deleted file mode 100644 index 2ace3c5..0000000 --- a/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheSingleNodeLoadTest.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * 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.gridgain.loadtests.cache; - -import org.apache.ignite.cache.*; -import org.apache.ignite.cache.eviction.lru.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.thread.*; -import org.apache.ignite.spi.collision.fifoqueue.*; -import org.apache.ignite.spi.discovery.tcp.*; -import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; -import org.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.gridgain.testframework.*; -import org.jetbrains.annotations.*; - -import java.util.*; -import java.util.concurrent.*; -import java.util.concurrent.atomic.*; - -import static org.apache.ignite.cache.GridCacheMode.*; -import static org.apache.ignite.cache.GridCacheDistributionMode.*; - -/** - */ -public class GridCacheSingleNodeLoadTest { - /** Thread count. */ - private static final int THREADS = 200; - - /** - * @param args Arguments. - * @throws Exception If failed. - */ - public static void main(String[] args) throws Exception { - start(); - - try { - runTest(200, THREADS); - - runTest(1000, THREADS); - } - finally { - stop(); - } - } - - /** - * @param putCnt Number of puts per thread. - * @param userThreads Number of user threads. - * @throws Exception If failed. - */ - private static void runTest(final int putCnt, int userThreads) throws Exception { - final AtomicInteger keyGen = new AtomicInteger(); - - final AtomicLong totalTime = new AtomicLong(); - - final AtomicInteger txCntr = new AtomicInteger(); - - X.println("Starting multithread test with thread count: " + userThreads); - - long start = System.currentTimeMillis(); - - GridTestUtils.runMultiThreaded(new Callable<Object>() { - @Nullable @Override public Object call() throws Exception { - GridCache<Integer, Student> cache = G.ignite().cache(null); - - assert cache != null; - - long startTime = System.currentTimeMillis(); - - for (int i = 0; i < putCnt; i++) { - cache.putx(keyGen.incrementAndGet(), new Student()); - - int cnt = txCntr.incrementAndGet(); - - if (cnt % 5000 == 0) - X.println("Processed transactions: " + cnt); - } - - totalTime.addAndGet(System.currentTimeMillis() - startTime); - - return null; - } - }, userThreads, "load-worker"); - - long time = System.currentTimeMillis() - start; - - X.println("Average tx/sec: " + (txCntr.get() * 1000 / time)); - X.println("Average commit time (ms): " + (totalTime.get() / txCntr.get())); - } - - /** - * @throws Exception If failed. - */ - private static void start() throws Exception { - IgniteConfiguration c = new IgniteConfiguration(); - - TcpDiscoverySpi disco = new TcpDiscoverySpi(); - - disco.setIpFinder(new TcpDiscoveryVmIpFinder(true)); - - c.setDiscoverySpi(disco); - - FifoQueueCollisionSpi cols = new FifoQueueCollisionSpi(); - - cols.setParallelJobsNumber(Integer.MAX_VALUE); - - c.setCollisionSpi(cols); - - c.setExecutorService(new IgniteThreadPoolExecutor(THREADS / 2, THREADS / 2, 0L, new LinkedBlockingQueue<Runnable>())); - c.setSystemExecutorService(new IgniteThreadPoolExecutor(THREADS * 2, THREADS * 2, 0L, - new LinkedBlockingQueue<Runnable>())); - - CacheConfiguration cc = new CacheConfiguration(); - - cc.setCacheMode(PARTITIONED); - cc.setBackups(1); - cc.setNearEvictionPolicy(new GridCacheLruEvictionPolicy(10000)); - cc.setEvictionPolicy(new GridCacheLruEvictionPolicy(300000)); - cc.setSwapEnabled(false); - cc.setDistributionMode(PARTITIONED_ONLY); - - c.setCacheConfiguration(cc); - - G.start(c); - } - - /** - * Stop grid. - */ - private static void stop() { - G.stop(true); - } - - /** - * Entity class for test. - */ - @SuppressWarnings({"PublicInnerClass"}) - public static class Student { - /** */ - private final UUID id; - - /** - * Constructor. - */ - Student() { - id = UUID.randomUUID(); - } - - /** - * @return Id. - */ - public UUID id() { - return id; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(Student.class, this); - } - } - - /** - * Ensure singleton. - */ - private GridCacheSingleNodeLoadTest() { - // No-op. - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheSwapLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheSwapLoadTest.java b/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheSwapLoadTest.java deleted file mode 100644 index 641ada9..0000000 --- a/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheSwapLoadTest.java +++ /dev/null @@ -1,310 +0,0 @@ -/* - * 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.gridgain.loadtests.cache; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.events.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.internal.util.typedef.*; -import org.gridgain.testframework.*; -import org.jetbrains.annotations.*; - -import java.util.*; -import java.util.concurrent.*; -import java.util.concurrent.atomic.*; - -import static org.apache.ignite.events.IgniteEventType.*; - -/** - * Cache+swap load test. - */ -public class GridCacheSwapLoadTest { - /** */ - private static final int LOG_MOD = 10000; - - /** */ - private static final int DFLT_KEY_CNT = 100000; - - /** */ - private static final float DFLT_GET_REMOVE_RATIO = 0.2f; - - /** */ - private static final int DFLT_PUT_THREAD_CNT = 5; - - /** */ - private static final int DFLT_GET_THREAD_CNT = 2; - - /** */ - private static final int DFLT_REMOVE_THREAD_CNT = 2; - - /** */ - private static final boolean DFLT_GET_REMOVE_ENABLED = true; - - /** */ - private static int keyCnt = DFLT_KEY_CNT; - - /** */ - private static float getRmvRatio = DFLT_GET_REMOVE_RATIO; - - /** */ - private static int putThreadCnt = DFLT_PUT_THREAD_CNT; - - /** */ - private static int getThreadCnt = DFLT_GET_THREAD_CNT; - - /** */ - private static int rmvThreadCnt = DFLT_REMOVE_THREAD_CNT; - - /** */ - private static boolean getRmvEnabled = DFLT_GET_REMOVE_ENABLED; - - /** */ - private static final CountDownLatch getRemoveStartedLatch = new CountDownLatch(1); - - /** */ - private static final BlockingQueue<Integer> swappedKeys = new LinkedBlockingQueue<>(); - - /** */ - private GridCacheSwapLoadTest() { - // No-op - } - - /** - * @param args Command line arguments. - * @throws IgniteCheckedException In case of error. - */ - public static void main(String[] args) throws IgniteCheckedException { - parseArgs(args); - - try (Ignite g = G.start("modules/core/src/test/config/spring-cache-swap.xml")) { - g.events().localListen(new IgnitePredicate<IgniteEvent>() { - private final AtomicInteger cnt = new AtomicInteger(0); - - private final AtomicBoolean getRmvStartedGuard = new AtomicBoolean(false); - - @Override public boolean apply(IgniteEvent evt) { - int cnt = this.cnt.incrementAndGet(); - - if (cnt % LOG_MOD == 0) - X.println(">>> Swap count: " + cnt); - - if (getRmvEnabled) { - IgniteCacheEvent ce = (IgniteCacheEvent) evt; - - Integer key = ce.key(); - - swappedKeys.add(key); - - if (swappedKeys.size() > keyCnt * getRmvRatio && - getRmvStartedGuard.compareAndSet(false, true)) { - getRemoveStartedLatch.countDown(); - - X.println(">>> Started get/remove."); - } - } - - return true; - } - }, EVT_CACHE_OBJECT_SWAPPED); - - Collection<IgniteFuture<?>> futs = new ArrayList<>(3); - - long start = System.currentTimeMillis(); - - futs.add(doPut(g)); - - if (getRmvEnabled) - futs.addAll(doGetRemove(g)); - - wait(futs); - - X.println("Test finished in: " + (System.currentTimeMillis() - start)); - } - } - - /** - * @param args Command line arguments. - */ - private static void parseArgs(String[] args) { - try { - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - - switch (arg) { - case "-k": - keyCnt = Integer.valueOf(args[++i]); break; - case "-r": - getRmvRatio = Float.valueOf(args[++i]); break; - case "-pt": - putThreadCnt = Integer.valueOf(args[++i]); break; - case "-gt": - getThreadCnt = Integer.valueOf(args[++i]); break; - case "-rt": - rmvThreadCnt = Integer.valueOf(args[++i]); break; - case "-dgr": - getRmvEnabled = false; break; - default: - usage(); - } - } - } - catch (Exception e) { - e.printStackTrace(); - - usage(); - } - - X.println(">>>"); - X.println(">>> Key count: " + keyCnt); - X.println(">>> Get/remove ratio: " + getRmvRatio); - X.println(">>> Put threads count: " + putThreadCnt); - X.println(">>> Get threads count: " + getThreadCnt); - X.println(">>> Remove threads count: " + rmvThreadCnt); - X.println(">>> Get/remove " + (getRmvEnabled ? "enabled" : "disabled") + "."); - X.println(">>>"); - } - - /** */ - private static void usage() { - X.println(">>>"); - X.println(">>> Usage: swaploadtest.sh -k <number of keys> -r <get/remove ratio> -pt <number of put threads>"); - X.println(">>> -gt <number of get threads> -rt <number of remove threads> -dgr"); - X.println(">>>"); - X.println(">>> -dgr disables get/remove threads."); - X.println(">>>"); - X.println(">>> All arguments are optional."); - X.println(">>>"); - - System.exit(1); - } - - /** - * @return Future. - */ - private static IgniteFuture<?> doPut(final Ignite g) { - final AtomicInteger putKey = new AtomicInteger(0); - - return GridTestUtils.runMultiThreadedAsync(new CAX() { - @Override public void applyx() throws IgniteCheckedException { - GridCache<Integer, Integer> cache = g.cache(null); - - assert cache != null; - - while (true) { - int i = putKey.incrementAndGet(); - - if (i % LOG_MOD == 0) - X.println(">>> Put count: " + i); - - if (i > keyCnt) - break; - - cache.putx(i, i); - } - - X.println(">>> Thread '" + Thread.currentThread().getName() + "' stopped."); - } - }, putThreadCnt, "put-thread"); - } - - /** - * @return Futures. - */ - private static Collection<IgniteFuture<Long>> doGetRemove(final Ignite g) { - final AtomicBoolean stop = new AtomicBoolean(false); - - return F.asList( - GridTestUtils.runMultiThreadedAsync(new Callable<Object>() { - @Nullable @Override public Object call() throws Exception { - getRemoveStartedLatch.await(); - - GridCache<Integer, Integer> cache = g.cache(null); - - assert cache != null; - - while (true) { - Integer i = swappedKeys.take(); - - if (i == null) - continue; - - Integer val = cache.get(i); - - assert val != null && val.equals(i); - - if (i % LOG_MOD == 0) - X.println(">>> Get/remove count: " + i); - - if (i == keyCnt || stop.get()) { - stop.set(true); - - break; - } - } - - X.println(">>> Thread '" + Thread.currentThread().getName() + "' stopped."); - - return null; - } - }, getThreadCnt, "get-thread"), - - GridTestUtils.runMultiThreadedAsync(new Callable<Object>() { - @Nullable @Override public Object call() throws Exception { - getRemoveStartedLatch.await(); - - GridCache<Integer, Integer> cache = g.cache(null); - - assert cache != null; - - while (true) { - Integer i = swappedKeys.take(); - - Integer val = cache.remove(i); - - assert val != null && val.equals(i); - - if (i % LOG_MOD == 0) - X.println(">>> Get/remove count: " + i); - - if (i == keyCnt || stop.get()) { - stop.set(true); - - break; - } - } - - X.println(">>> Thread '" + Thread.currentThread().getName() + "' stopped."); - - return null; - } - }, rmvThreadCnt, "remove-thread") - ); - } - - /** - * @param futs Futures. - */ - private static void wait(Iterable<IgniteFuture<?>> futs) { - F.forEach(futs, new CIX1<IgniteFuture<?>>() { - @Override public void applyx(IgniteFuture<?> fut) throws IgniteCheckedException { - fut.get(); - } - }); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheWriteBehindStoreLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheWriteBehindStoreLoadTest.java b/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheWriteBehindStoreLoadTest.java deleted file mode 100644 index 4f61369..0000000 --- a/modules/core/src/test/java/org/gridgain/loadtests/cache/GridCacheWriteBehindStoreLoadTest.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.gridgain.loadtests.cache; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cache.store.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.spi.discovery.tcp.*; -import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.gridgain.testframework.junits.common.*; - -import javax.cache.*; -import javax.cache.configuration.*; -import java.util.*; -import java.util.concurrent.atomic.*; - -import static org.apache.ignite.cache.GridCacheWriteSynchronizationMode.*; - -/** - * Basic store test. - */ -public class GridCacheWriteBehindStoreLoadTest extends GridCommonAbstractTest { - /** Flush frequency. */ - private static final int WRITE_FROM_BEHIND_FLUSH_FREQUENCY = 1000; - - /** Run time is 24 hours. */ - private static final long runTime = 24L * 60 * 60 * 60 * 1000; - - /** Specify if test keys should be randomly generated. */ - private boolean rndKeys; - - /** Number of distinct keys if they are generated randomly. */ - private int keysCnt = 20 * 1024; - - /** Number of threads that concurrently update cache. */ - private int threadCnt; - - /** No-op cache store. */ - private static final CacheStore store = new CacheStoreAdapter() { - /** {@inheritDoc} */ - @Override public Object load(Object key) { - return null; - } - - /** {@inheritDoc} */ - @Override public void write(Cache.Entry e) { - // No-op. - } - - /** {@inheritDoc} */ - @Override public void delete(Object key) { - // No-op. - } - }; - - /** - * Constructor - */ - public GridCacheWriteBehindStoreLoadTest() { - super(true /*start grid. */); - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - GridCache<?, ?> cache = cache(); - - if (cache != null) - cache.clearAll(); - } - - /** - * @return Caching mode. - */ - protected GridCacheMode cacheMode() { - return GridCacheMode.PARTITIONED; - } - - /** {@inheritDoc} */ - @SuppressWarnings({"unchecked"}) - @Override protected final IgniteConfiguration getConfiguration() throws Exception { - IgniteConfiguration c = super.getConfiguration(); - - TcpDiscoverySpi disco = new TcpDiscoverySpi(); - - disco.setIpFinder(new TcpDiscoveryVmIpFinder(true)); - - c.setDiscoverySpi(disco); - - CacheConfiguration cc = defaultCacheConfiguration(); - - cc.setCacheMode(cacheMode()); - cc.setWriteSynchronizationMode(FULL_SYNC); - cc.setSwapEnabled(false); - - cc.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(store)); - cc.setReadThrough(true); - cc.setWriteThrough(true); - cc.setLoadPreviousValue(true); - - cc.setWriteBehindEnabled(true); - cc.setWriteBehindFlushFrequency(WRITE_FROM_BEHIND_FLUSH_FREQUENCY); - - c.setCacheConfiguration(cc); - - return c; - } - - /** - * @throws Exception If failed. - */ - public void testLoadCacheSequentialKeys() throws Exception { - rndKeys = false; - - threadCnt = 10; - - loadCache(); - } - - /** - * @throws Exception If failed. - */ - public void testLoadCacheRandomKeys() throws Exception { - rndKeys = true; - - threadCnt = 10; - - loadCache(); - } - - /** - * @throws Exception If failed. - */ - private void loadCache() throws Exception { - final AtomicBoolean running = new AtomicBoolean(true); - - final GridCache<Long, String> cache = cache(); - - final AtomicLong keyCntr = new AtomicLong(); - - long start = System.currentTimeMillis(); - - IgniteFuture<?> fut = multithreadedAsync(new Runnable() { - @SuppressWarnings({"NullableProblems"}) - @Override public void run() { - - Random rnd = new Random(); - - try { - while (running.get()) { - long putNum = keyCntr.incrementAndGet(); - - long key = rndKeys ? rnd.nextInt(keysCnt) : putNum; - - cache.put(key, "val" + key); - } - } - catch (IgniteCheckedException e) { - error("Unexpected exception in put thread", e); - - assert false; - } - } - }, threadCnt, "put"); - - long prevPutCnt = 0; - - while (System.currentTimeMillis() - start < runTime) { - // Print stats every minute. - U.sleep(60 * 1000); - - long cnt = keyCntr.get(); - long secondsElapsed = (System.currentTimeMillis() - start) / 1000; - - info(">>> Running for " + secondsElapsed + " seconds"); - info(">>> Puts: [total=" + cnt + ", avg=" + (cnt / secondsElapsed) + " (ops/sec), lastMinute=" + - ((cnt - prevPutCnt) / 60) + "(ops/sec)]"); - - prevPutCnt = cnt; - } - - running.set(false); - - fut.get(); - } - - /** - * @return Will return 0 to disable timeout. - */ - @Override protected long getTestTimeout() { - return 0; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/core/src/test/java/org/gridgain/loadtests/capacity/GridCapacityLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/loadtests/capacity/GridCapacityLoadTest.java b/modules/core/src/test/java/org/gridgain/loadtests/capacity/GridCapacityLoadTest.java deleted file mode 100644 index f9c5b5a..0000000 --- a/modules/core/src/test/java/org/gridgain/loadtests/capacity/GridCapacityLoadTest.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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.gridgain.loadtests.capacity; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.util.typedef.*; -import org.springframework.context.support.*; - -import java.lang.management.*; - -/** - * Continuous mapper load test. - */ -public class GridCapacityLoadTest { - /** Heap usage. */ - private static final MemoryMXBean mem = ManagementFactory.getMemoryMXBean(); - - /** - * Main method. - * - * @param args Parameters. - * @throws Exception If failed. - */ - public static void main(String[] args) throws Exception { - // Initialize Spring factory. - ClassPathXmlApplicationContext ctx = - new ClassPathXmlApplicationContext("org/gridgain/loadtests/capacity/spring-capacity-cache.xml"); - - IgniteConfiguration cfg = (IgniteConfiguration)ctx.getBean("grid.cfg"); - - try (Ignite g = G.start(cfg)) { - GridCache<Integer, Integer> c = g.cache(null); - - long init = mem.getHeapMemoryUsage().getUsed(); - - printHeap(init); - - int cnt = 0; - - for (; cnt < 3000000; cnt++) { - c.put(cnt, cnt); - - if (cnt % 10000 == 0) { - X.println("Stored count: " + cnt); - - printHeap(init); - - if (cnt > 2100000 && cnt % 100000 == 0) - System.gc(); - } - } - - System.gc(); - - Thread.sleep(1000); - - printHeap(init); - - MemoryUsage heap = mem.getHeapMemoryUsage(); - - long used = heap.getUsed() - init; - - long entrySize = cnt > 0 ? used / cnt : 0; - - X.println("Average entry size: " + entrySize); - } - } - - private static void printHeap(long init) { - MemoryUsage heap = mem.getHeapMemoryUsage(); - - long max = heap.getMax() - init; - long used = heap.getUsed() - init; - long left = max - used; - - X.println("Heap left: " + (left / (1024 * 1024)) + "MB"); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/core/src/test/java/org/gridgain/loadtests/capacity/spring-capacity-cache.xml ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/loadtests/capacity/spring-capacity-cache.xml b/modules/core/src/test/java/org/gridgain/loadtests/capacity/spring-capacity-cache.xml deleted file mode 100644 index 1b9bf75..0000000 --- a/modules/core/src/test/java/org/gridgain/loadtests/capacity/spring-capacity-cache.xml +++ /dev/null @@ -1,124 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - 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. - --> - -<!-- - GridGain Spring configuration file to startup grid cache. - - When starting a standalone GridGain node, you need to execute the following command: - {GRIDGAIN_HOME}/bin/ggstart.{bat|sh} path-to-this-file/example-cache.xml - - When starting GridGain from Java IDE, pass path to this file into GridGain: - GridGain.start("path-to-this-file/example-benchmark.xml"); ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - <!-- - Optional description. - --> - <description> - Spring file for grid configuration with benchmark. - </description> - - <!-- - Configuration below demonstrates how to setup caches within grid nodes. - --> - <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> - <property name="deploymentMode" value="SHARED"/> - - <!-- Set to local host address just for examples. --> - <property name="localHost" value="127.0.0.1"/> - - <property name="cacheConfiguration"> - <!-- - Specify list of cache configurations here. Any property from - CacheConfiguration interface can be configured here. - Note that absolutely all configuration properties are optional. - --> - <list> - <!-- - Partitioned cache example configuration. - --> - <bean class="org.apache.ignite.cache.CacheConfiguration"> - <property name="cacheMode" value="PARTITIONED"/> - - <!-- Initial cache size. --> - <property name="startSize" value="10000000"/> - - <!-- - Setting this to true FULL_SYNC will cause local node to wait for remote commits. - --> - <property name="writeSynchronizationMode" value="FULL_ASYNC"/> - - <property name="distributionMode" value="PARTITIONED_ONLY"/> - - <!-- Get rid of value byte buffers once not needed. --> - <property name="storeValueBytes" value="false"/> - - <!-- - This shows how to configure number of backups. The below configuration - sets the number of backups to 0 to ensure maximum capacity.. - --> - <property name="affinity"> - <bean class="org.apache.ignite.cache.affinity.consistenthash.GridCacheConsistentHashAffinityFunction"> - <property name="keyBackups" value="0"/> <!-- No backups. --> - </bean> - </property> - - <!-- Set synchronous preloading (default is asynchronous). --> - <property name="preloadMode" value="SYNC"/> - </bean> - </list> - </property> - - <!-- - Uncomment this to provide TCP discovery SPI (predefined addresses). - Use the addresses list to provide IP addresses of initial nodes in the grid - (at least one address must be provided). - --> - <property name="discoverySpi"> - <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> - <property name="ipFinder"> - <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> - <property name="addresses"> - <list> - <!-- - List all IP/port configurations that potentially - can be started first in examples. We are assuming - grid of size 10 or less. - --> - <value>127.0.0.1:47500</value> - <value>127.0.0.1:47501</value> - <value>127.0.0.1:47502</value> - <value>127.0.0.1:47503</value> - <value>127.0.0.1:47504</value> - <value>127.0.0.1:47505</value> - <value>127.0.0.1:47506</value> - <value>127.0.0.1:47507</value> - <value>127.0.0.1:47508</value> - <value>127.0.0.1:47509</value> - </list> - </property> - </bean> - </property> - </bean> - </property> - </bean> -</beans> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/core/src/test/java/org/gridgain/loadtests/colocation/GridTestCacheStore.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/loadtests/colocation/GridTestCacheStore.java b/modules/core/src/test/java/org/gridgain/loadtests/colocation/GridTestCacheStore.java deleted file mode 100644 index 94fd931..0000000 --- a/modules/core/src/test/java/org/gridgain/loadtests/colocation/GridTestCacheStore.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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.gridgain.loadtests.colocation; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cache.store.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.resources.*; -import org.jdk8.backport.*; - -import javax.cache.*; -import javax.cache.integration.*; -import java.util.concurrent.*; - -/** - * Accenture cache store. - */ -public class GridTestCacheStore extends CacheStoreAdapter<GridTestKey, Long> { - /** */ - @IgniteInstanceResource - private Ignite ignite; - - /** */ - @IgniteLoggerResource - private IgniteLogger log; - - /** - * Preload data from store. In this case we just auto-generate random values. - * - * @param clo Callback for every key. - * @param args Optional arguments. - */ - @Override public void loadCache(final IgniteBiInClosure<GridTestKey, Long> clo, Object... args) { - // Number of threads is passed in as argument by caller. - final int numThreads = (Integer)args[0]; - int entryCnt = (Integer)args[1]; - - log.info("Number of load threads: " + numThreads); - log.info("Number of cache entries to load: " + entryCnt); - - ExecutorService execSvc = Executors.newFixedThreadPool(numThreads); - - try { - ExecutorCompletionService<Object> completeSvc = new ExecutorCompletionService<>(execSvc); - - GridCache<GridTestKey, Long> cache = ignite.cache("partitioned"); - - assert cache != null; - - // Get projection just to check affinity for Integer. - final GridCacheProjection<Integer, Long> prj = cache.projection(Integer.class, Long.class); - - final LongAdder adder = new LongAdder(); - - for (int i = 0; i < numThreads; i++) { - final int threadId = i; - - final int perThreadKeys = entryCnt / numThreads; - - final int mod = entryCnt % numThreads; - - completeSvc.submit(new Callable<Object>() { - @Override public Object call() throws Exception { - int start = threadId * perThreadKeys; - int end = start + perThreadKeys; - - if (threadId + 1 == numThreads) - end += mod; - - for (long i = start; i < end; i++) { - if (prj.cache().affinity().mapKeyToNode(GridTestKey.affinityKey(i)).isLocal()) { // Only add if key is local. - clo.apply(new GridTestKey(i), i); - - adder.increment(); - } - - if (i % 10000 == 0) - log.info("Loaded " + adder.intValue() + " keys."); - } - - return null; - } - }); - } - - // Wait for threads to complete. - for (int i = 0; i < numThreads; i++) { - try { - completeSvc.take().get(); - } - catch (InterruptedException | ExecutionException e) { - throw new CacheLoaderException(e); - } - } - - // Final print out. - log.info("Loaded " + adder.intValue() + " keys."); - } - finally { - execSvc.shutdown(); - } - } - - /** {@inheritDoc} */ - @Override public Long load(GridTestKey key) { - return null; // No-op. - } - - /** {@inheritDoc} */ - @Override public void write(Cache.Entry<? extends GridTestKey, ? extends Long> e) { - // No-op. - } - - /** {@inheritDoc} */ - @Override public void delete(Object key) { - // No-op. - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/core/src/test/java/org/gridgain/loadtests/colocation/GridTestConstants.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/loadtests/colocation/GridTestConstants.java b/modules/core/src/test/java/org/gridgain/loadtests/colocation/GridTestConstants.java deleted file mode 100644 index 56e2183..0000000 --- a/modules/core/src/test/java/org/gridgain/loadtests/colocation/GridTestConstants.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.gridgain.loadtests.colocation; - -/** - * Set of constants for this project. - */ -public class GridTestConstants { - /** Number of modulo regions to partition keys into. */ - public static final int MOD_COUNT = 1024; - - /** Number of entries to put in cache. */ - public static final int ENTRY_COUNT = 2000000; - - /** Cache init size - add some padding to avoid resizing. */ - public static final int CACHE_INIT_SIZE = (int)(1.5 * ENTRY_COUNT); - - /** Number of threads to load cache. */ - public static final int LOAD_THREADS = Runtime.getRuntime().availableProcessors() * 2; -}