Skip to content

Commit

Permalink
# IGNITE-102: Renaming + debug.
Browse files Browse the repository at this point in the history
  • Loading branch information
akuznetsov-gridgain committed Jan 29, 2015
1 parent 641a4c8 commit fa4ac59
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 19 deletions.
Expand Up @@ -78,7 +78,7 @@ public abstract class IgniteAbstractBenchmark extends BenchmarkDriverAdapter {
/** /**
* @return Grid. * @return Grid.
*/ */
protected Ignite grid() { protected Ignite ignite() {
return node.ignite(); return node.ignite();
} }


Expand All @@ -88,7 +88,7 @@ protected Ignite grid() {
private void waitForNodes() throws Exception { private void waitForNodes() throws Exception {
final CountDownLatch nodesStartedLatch = new CountDownLatch(1); final CountDownLatch nodesStartedLatch = new CountDownLatch(1);


grid().events().localListen(new IgnitePredicate<IgniteEvent>() { ignite().events().localListen(new IgnitePredicate<IgniteEvent>() {
@Override public boolean apply(IgniteEvent gridEvt) { @Override public boolean apply(IgniteEvent gridEvt) {
if (nodesStarted()) if (nodesStarted())
nodesStartedLatch.countDown(); nodesStartedLatch.countDown();
Expand All @@ -108,7 +108,7 @@ private void waitForNodes() throws Exception {
* @return {@code True} if all nodes are started, {@code false} otherwise. * @return {@code True} if all nodes are started, {@code false} otherwise.
*/ */
private boolean nodesStarted() { private boolean nodesStarted() {
return grid().cluster().nodes().size() >= args.nodes(); return ignite().cluster().nodes().size() >= args.nodes();
} }


/** /**
Expand Down
Expand Up @@ -36,6 +36,6 @@ public class IgniteGetBenchmark extends IgniteCacheAbstractBenchmark {


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override protected IgniteCache<Integer, Object> cache() { @Override protected IgniteCache<Integer, Object> cache() {
return grid().jcache("atomic"); return ignite().jcache("atomic");
} }
} }
Expand Up @@ -37,6 +37,6 @@ public class IgnitePutBenchmark extends IgniteCacheAbstractBenchmark {


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override protected IgniteCache<Integer, Object> cache() { @Override protected IgniteCache<Integer, Object> cache() {
return grid().jcache("atomic"); return ignite().jcache("atomic");
} }
} }
Expand Up @@ -42,6 +42,6 @@ public class IgnitePutGetBenchmark extends IgniteCacheAbstractBenchmark {


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override protected IgniteCache<Integer, Object> cache() { @Override protected IgniteCache<Integer, Object> cache() {
return grid().jcache("atomic"); return ignite().jcache("atomic");
} }
} }
Expand Up @@ -31,22 +31,30 @@ public class IgnitePutGetTxBenchmark extends IgniteCacheAbstractBenchmark {
@Override public boolean test(Map<Object, Object> ctx) throws Exception { @Override public boolean test(Map<Object, Object> ctx) throws Exception {
int key = nextRandom(0, args.range() / 2); int key = nextRandom(0, args.range() / 2);


try (IgniteTx tx = grid().transactions().txStart()) { ignite().log().debug("IgnitePutGetTxBenchmark - key: " + key);

try (IgniteTx tx = ignite().transactions().txStart()) {
ignite().log().debug("IgnitePutGetTxBenchmark: txStart()");

Object val = cache.get(key); Object val = cache.get(key);


ignite().log().debug("IgnitePutGetTxBenchmark - get():" + val);

if (val != null) if (val != null)
key = nextRandom(args.range() / 2, args.range()); key = nextRandom(args.range() / 2, args.range());


cache.put(key, new SampleValue(key)); cache.put(key, new SampleValue(key));


tx.commit(); tx.commit();

ignite().log().debug("IgnitePutGetTxBenchmark - txCommit");
} }


return true; return true;
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override protected IgniteCache<Integer, Object> cache() { @Override protected IgniteCache<Integer, Object> cache() {
return grid().jcache("tx"); return ignite().jcache("tx");
} }
} }
Expand Up @@ -38,6 +38,6 @@ public class IgnitePutTxBenchmark extends IgniteCacheAbstractBenchmark {


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override protected IgniteCache<Integer, Object> cache() { @Override protected IgniteCache<Integer, Object> cache() {
return grid().jcache("tx"); return ignite().jcache("tx");
} }
} }
Expand Up @@ -42,7 +42,7 @@ public class IgniteSqlQueryBenchmark extends IgniteCacheAbstractBenchmark {


long start = System.nanoTime(); long start = System.nanoTime();


try (IgniteDataLoader<Integer, Person> dataLdr = grid().dataLoader(cache.getName())) { try (IgniteDataLoader<Integer, Person> dataLdr = ignite().dataLoader(cache.getName())) {
for (int i = 0; i < args.range() && !Thread.currentThread().isInterrupted(); i++) { for (int i = 0; i < args.range() && !Thread.currentThread().isInterrupted(); i++) {
dataLdr.addData(i, new Person(i, "firstName" + i, "lastName" + i, i * 1000)); dataLdr.addData(i, new Person(i, "firstName" + i, "lastName" + i, i * 1000));


Expand Down Expand Up @@ -89,6 +89,6 @@ private Collection<Map.Entry<Integer, Person>> executeQuery(double minSalary, do


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override protected IgniteCache<Integer, Object> cache() { @Override protected IgniteCache<Integer, Object> cache() {
return grid().jcache("query"); return ignite().jcache("query");
} }
} }
Expand Up @@ -42,7 +42,7 @@ public class IgniteSqlQueryJoinBenchmark extends IgniteCacheAbstractBenchmark {


long start = System.nanoTime(); long start = System.nanoTime();


try (IgniteDataLoader<Object, Object> dataLdr = grid().dataLoader(cache.getName())) { try (IgniteDataLoader<Object, Object> dataLdr = ignite().dataLoader(cache.getName())) {
final int orgRange = args.range() / 10; final int orgRange = args.range() / 10;


// Populate organizations. // Populate organizations.
Expand Down Expand Up @@ -113,6 +113,6 @@ private Collection<List<?>> executeQueryJoin(double minSalary, double maxSalary)


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override protected IgniteCache<Integer, Object> cache() { @Override protected IgniteCache<Integer, Object> cache() {
return grid().jcache("query"); return ignite().jcache("query");
} }
} }
Expand Up @@ -81,6 +81,6 @@ private Collection<Map.Entry<Integer, Person>> executeQuery(double minSalary, do


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override protected IgniteCache<Integer, Object> cache() { @Override protected IgniteCache<Integer, Object> cache() {
return grid().jcache("query"); return ignite().jcache("query");
} }
} }
Expand Up @@ -29,7 +29,7 @@
public class IgniteAffinityCallBenchmark extends IgniteAbstractBenchmark { public class IgniteAffinityCallBenchmark extends IgniteAbstractBenchmark {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception { @Override public boolean test(Map<Object, Object> ctx) throws Exception {
grid().compute().affinityCall("compute", ThreadLocalRandom.current().nextInt(), new NoopCallable()); ignite().compute().affinityCall("compute", ThreadLocalRandom.current().nextInt(), new NoopCallable());


return true; return true;
} }
Expand Down
Expand Up @@ -45,7 +45,7 @@ public class IgniteApplyBenchmark extends IgniteAbstractBenchmark {


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception { @Override public boolean test(Map<Object, Object> ctx) throws Exception {
grid().compute().apply(new NoopClosure(), applyArgs); ignite().compute().apply(new NoopClosure(), applyArgs);


return true; return true;
} }
Expand Down
Expand Up @@ -28,7 +28,7 @@
public class IgniteBroadcastBenchmark extends IgniteAbstractBenchmark { public class IgniteBroadcastBenchmark extends IgniteAbstractBenchmark {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception { @Override public boolean test(Map<Object, Object> ctx) throws Exception {
grid().compute().broadcast(new NoopCallable()); ignite().compute().broadcast(new NoopCallable());


return true; return true;
} }
Expand Down
Expand Up @@ -28,7 +28,7 @@
public class IgniteExecuteBenchmark extends IgniteAbstractBenchmark { public class IgniteExecuteBenchmark extends IgniteAbstractBenchmark {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception { @Override public boolean test(Map<Object, Object> ctx) throws Exception {
grid().compute().execute(new NoopTask(args.jobs()), null); ignite().compute().execute(new NoopTask(args.jobs()), null);


return true; return true;
} }
Expand Down
Expand Up @@ -44,7 +44,7 @@ public class IgniteRunBenchmark extends IgniteAbstractBenchmark {


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception { @Override public boolean test(Map<Object, Object> ctx) throws Exception {
grid().compute().run(jobs); ignite().compute().run(jobs);


return true; return true;
} }
Expand Down

0 comments on commit fa4ac59

Please sign in to comment.