Search in sources :

Example 16 with SampleValue

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

the class IgniteInvokeTxBenchmark method setUp.

/**
 * {@inheritDoc}
 */
@Override
public void setUp(BenchmarkConfiguration cfg) throws Exception {
    super.setUp(cfg);
    if (!IgniteSystemProperties.getBoolean("SKIP_MAP_CHECK"))
        ignite().compute().broadcast(new WaitMapExchangeFinishCallable());
    txs = ignite().transactions();
    clo = new Callable<Void>() {

        @Override
        public Void call() throws Exception {
            int key = nextRandom(args.range());
            IgniteCache<Integer, Object> cache = cacheForOperation();
            cache.invoke(key, new SetValueEntryProcessor(new SampleValue(key)));
            return null;
        }
    };
}
Also used : SampleValue(org.apache.ignite.yardstick.cache.model.SampleValue) IgniteCache(org.apache.ignite.IgniteCache)

Example 17 with SampleValue

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

the class IgnitePutGetBatchBenchmark method test.

/**
 * {@inheritDoc}
 */
@Override
public boolean test(Map<Object, Object> ctx) throws Exception {
    IgniteCache<Integer, Object> cache = cacheForOperation();
    Set<Integer> keys = new TreeSet<>();
    while (keys.size() < args.batch()) keys.add(nextRandom(args.range()));
    Map<Integer, Object> vals = cache.getAll(keys);
    Map<Integer, SampleValue> updates = new TreeMap<>();
    for (Integer key : keys) {
        Object val = vals.get(key);
        if (val != null)
            key = nextRandom(args.range());
        updates.put(key, new SampleValue(key));
    }
    cache.putAll(updates);
    return true;
}
Also used : SampleValue(org.apache.ignite.yardstick.cache.model.SampleValue) TreeSet(java.util.TreeSet) TreeMap(java.util.TreeMap)

Example 18 with SampleValue

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

the class IgnitePutRemoveBenchmark method test.

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

Example 19 with SampleValue

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

the class IgnitePutTxSkipLocalBackupBenchmark method test.

/**
 * {@inheritDoc}
 */
@Override
public boolean test(Map<Object, Object> ctx) throws Exception {
    IgniteCache<Integer, Object> cache = cacheForOperation();
    int key;
    Affinity<Object> aff = ignite().affinity("tx");
    ClusterNode locNode = ignite().cluster().localNode();
    for (; ; ) {
        key = nextRandom(args.range());
        // Skip key if local node is backup.
        if (!aff.isBackup(locNode, key))
            break;
    }
    // Implicit transaction is used.
    cache.put(key, new SampleValue(key));
    return true;
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) SampleValue(org.apache.ignite.yardstick.cache.model.SampleValue)

Example 20 with SampleValue

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

the class IgniteJdbcStorePutGetBenchmark method test.

/**
 * {@inheritDoc}
 */
@Override
public boolean test(Map<Object, Object> ctx) throws Exception {
    int id = nextRandom(args.range());
    Object val = cache.get(new SampleKey(id));
    if (val != null)
        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)

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