Search in sources :

Example 11 with SampleValue

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

the class IgnitePutTxImplicitBenchmark method test.

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

Example 12 with SampleValue

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

the class IgnitePutTxPrimaryOnlyBenchmark 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());
        // Exit only if primary.
        if (aff.isPrimary(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 13 with SampleValue

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

the class IgnitePutGetBenchmark method test.

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

Example 14 with SampleValue

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

the class IgnitePutGetEntryBenchmark method test.

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

Example 15 with SampleValue

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

the class IgniteBinaryIdentityPutBenchmark method test.

/**
 * {@inheritDoc}
 */
@Override
public boolean test(Map<Object, Object> ctx) throws Exception {
    int key = nextRandom(args.range());
    cache.put(createKey(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