Search in sources :

Example 6 with SampleValue

use of org.apache.ignite.yardstick.cache.model.SampleValue in project ignite by apache.

the class IgniteJdbcStorePutTxBenchmark method test.

/**
 * {@inheritDoc}
 */
@Override
public boolean test(Map<Object, Object> ctx) throws Exception {
    int id = nextRandom(args.range());
    cache.put(new SampleKey(id), new SampleValue(id));
    return true;
}
Also used : SampleValue(org.apache.ignite.yardstick.cache.model.SampleValue) SampleKey(org.apache.ignite.yardstick.cache.model.SampleKey)

Example 7 with SampleValue

use of org.apache.ignite.yardstick.cache.model.SampleValue in project ignite by apache.

the class IgniteBinaryIdentityBenchmark method setUp.

/**
 * {@inheritDoc}
 */
@Override
public void setUp(BenchmarkConfiguration cfg) throws Exception {
    super.setUp(cfg);
    println(cfg, "Populating data...");
    long start = System.nanoTime();
    try (IgniteDataStreamer<BinaryObject, Object> dataLdr = ignite().dataStreamer(cache.getName())) {
        for (int i = 0; i < args.range() && !Thread.currentThread().isInterrupted(); ) {
            dataLdr.addData(createKey(i), new SampleValue(i));
            if (++i % 100000 == 0)
                println(cfg, "Items populated: " + i);
        }
    }
    println(cfg, "Finished populating data in " + ((System.nanoTime() - start) / 1_000_000) + " ms.");
}
Also used : SampleValue(org.apache.ignite.yardstick.cache.model.SampleValue) BinaryObject(org.apache.ignite.binary.BinaryObject) BinaryObject(org.apache.ignite.binary.BinaryObject)

Example 8 with SampleValue

use of org.apache.ignite.yardstick.cache.model.SampleValue in project ignite by apache.

the class IgniteGetAndPutBenchmark method test.

/**
 * {@inheritDoc}
 */
@Override
public boolean test(Map<Object, Object> ctx) throws Exception {
    int key = nextRandom(args.range());
    IgniteCache<Integer, Object> cache = cacheForOperation();
    cache.getAndPut(key, new SampleValue(key));
    return true;
}
Also used : SampleValue(org.apache.ignite.yardstick.cache.model.SampleValue)

Example 9 with SampleValue

use of org.apache.ignite.yardstick.cache.model.SampleValue in project ignite by apache.

the class IgniteGetFromComputeBenchmark method setUp.

/**
 * {@inheritDoc}
 */
@Override
public void setUp(BenchmarkConfiguration cfg) throws Exception {
    super.setUp(cfg);
    if (args.preloadAmount() > args.range())
        throw new IllegalArgumentException("Preloading amount (\"-pa\", \"--preloadAmount\") " + "must by less then the range (\"-r\", \"--range\").");
    String cacheName = cache().getName();
    println(cfg, "Loading data for cache: " + cacheName);
    long start = System.nanoTime();
    try (IgniteDataStreamer<Object, Object> dataLdr = ignite().dataStreamer(cacheName)) {
        for (int i = 0; i < args.preloadAmount(); i++) {
            dataLdr.addData(i, new SampleValue(i));
            if (i % 100000 == 0) {
                if (Thread.currentThread().isInterrupted())
                    break;
                println("Loaded entries: " + i);
            }
        }
    }
    println(cfg, "Finished populating data [time=" + ((System.nanoTime() - start) / 1_000_000) + "ms, " + "amount=" + args.preloadAmount() + ']');
    compute = ignite().compute();
    asyncCache = cache().withAsync();
}
Also used : SampleValue(org.apache.ignite.yardstick.cache.model.SampleValue)

Example 10 with SampleValue

use of org.apache.ignite.yardstick.cache.model.SampleValue in project ignite by apache.

the class IgnitePutBenchmark method test.

/**
 * {@inheritDoc}
 */
@Override
public boolean test(Map<Object, Object> ctx) throws Exception {
    int key = nextRandom(args.range());
    IgniteCache<Integer, Object> cache = cacheForOperation();
    cache.put(key, new SampleValue(key));
    return true;
}
Also used : SampleValue(org.apache.ignite.yardstick.cache.model.SampleValue)

Aggregations

SampleValue (org.apache.ignite.yardstick.cache.model.SampleValue)20 SampleKey (org.apache.ignite.yardstick.cache.model.SampleKey)4 ArrayList (java.util.ArrayList)2 Callable (java.util.concurrent.Callable)2 Future (java.util.concurrent.Future)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 ClusterNode (org.apache.ignite.cluster.ClusterNode)2 TreeMap (java.util.TreeMap)1 TreeSet (java.util.TreeSet)1 IgniteCache (org.apache.ignite.IgniteCache)1 BinaryObject (org.apache.ignite.binary.BinaryObject)1