com.yahoo.ycsb.workloads
Class MemcachedCoreWorkload

java.lang.Object
  extended by com.yahoo.ycsb.Workload
      extended by com.yahoo.ycsb.workloads.MemcachedCoreWorkload

public class MemcachedCoreWorkload
extends Workload

The core benchmark scenario. Represents a set of clients doing simple CRUD operations. The relative proportion of different kinds of operations, and other properties of the workload, are controlled by parameters specified at runtime. Properties to control the client:


Field Summary
static java.lang.String ADD_PROPORTION_PROPERTY
           
static java.lang.String ADD_PROPORTION_PROPERTY_DEFAULT
           
static java.lang.String APPEND_PROPORTION_PROPERTY
           
static java.lang.String APPEND_PROPORTION_PROPERTY_DEFAULT
           
static java.lang.String CAS_PROPORTION_PROPERTY
           
static java.lang.String CAS_PROPORTION_PROPERTY_DEFAULT
           
static java.lang.String CHURN_WORKING_SET_DELTA_PROPERTY
           
static java.lang.String CHURN_WORKING_SET_DELTA_PROPERTY_DEFAULT
           
static java.lang.String CHURN_WORKING_SET_PROPERTY
           
static java.lang.String CHURN_WORKING_SET_PROPERTY_DEFAULT
           
static java.lang.String DECR_PROPORTION_PROPERTY
           
static java.lang.String DECR_PROPORTION_PROPERTY_DEFAULT
           
static java.lang.String DELETE_PROPORTION_PROPERTY
           
static java.lang.String DELETE_PROPORTION_PROPERTY_DEFAULT
           
static java.lang.String FIELD_COUNT_PROPERTY
          The name of the property for the number of fields in a record.
static java.lang.String FIELD_COUNT_PROPERTY_DEFAULT
          Default number of fields in a record.
static java.lang.String GET_PROPORTION_PROPERTY
           
static java.lang.String GET_PROPORTION_PROPERTY_DEFAULT
           
static java.lang.String GETS_PROPORTION_PROPERTY
           
static java.lang.String GETS_PROPORTION_PROPERTY_DEFAULT
           
static java.lang.String INCR_PROPORTION_PROPERTY
           
static java.lang.String INCR_PROPORTION_PROPERTY_DEFAULT
           
static java.lang.String INSERT_ORDER_PROPERTY
          The name of the property for the order to insert records.
static java.lang.String INSERT_ORDER_PROPERTY_DEFAULT
          Default insert order.
static java.lang.String KEY_PREFIX_PROPERTY
           
static java.lang.String KEY_PREFIX_PROPERTY_DEFAULT
           
static java.lang.String keyprefix
           
static java.lang.String MAX_SCAN_LENGTH_PROPERTY
          The name of the property for the max scan length (number of records)
static java.lang.String MAX_SCAN_LENGTH_PROPERTY_DEFAULT
          The default max scan length.
static java.lang.String PREPEND_PROPORTION_PROPERTY
           
static java.lang.String PREPEND_PROPORTION_PROPERTY_DEFAULT
           
static java.lang.String REPLACE_PROPORTION_PROPERTY
           
static java.lang.String REPLACE_PROPORTION_PROPERTY_DEFAULT
           
static java.lang.String REQUEST_DISTRIBUTION_PROPERTY
          The name of the property for the the distribution of requests across the keyspace.
static java.lang.String REQUEST_DISTRIBUTION_PROPERTY_DEFAULT
          The default distribution of requests across the keyspace
static java.lang.String SCAN_LENGTH_DISTRIBUTION_PROPERTY
          The name of the property for the scan length distribution.
static java.lang.String SCAN_LENGTH_DISTRIBUTION_PROPERTY_DEFAULT
          The default max scan length.
static java.lang.String SET_PROPORTION_PROPERTY
           
static java.lang.String SET_PROPORTION_PROPERTY_DEFAULT
           
static java.lang.String VALUE_LENGTH_PROPERTY
           
static java.lang.String VALUE_LENGTH_PROPERTY_DEFAULT
           
 
Fields inherited from class com.yahoo.ycsb.Workload
INSERT_START_PROPERTY, INSERT_START_PROPERTY_DEFAULT
 
Constructor Summary
MemcachedCoreWorkload()
           
 
Method Summary
 boolean doInsert(DataStore memcached, java.lang.Object threadstate)
          Do one insert operation.
 boolean doTransaction(DataStore memcached, java.lang.Object threadstate)
          Do one transaction operation.
 void doTransactionAdd(Memcached memcached)
           
 void doTransactionAppend(Memcached memcached)
           
 void doTransactionCas(Memcached memcached)
           
 void doTransactionDecr(Memcached memcached)
           
 void doTransactionDelete(Memcached memcached)
           
 void doTransactionGet(Memcached memcached)
           
 long doTransactionGets(Memcached memcached)
           
 void doTransactionIncr(Memcached memcached)
           
 void doTransactionPrepend(Memcached memcached)
           
 void doTransactionReplace(Memcached memcached)
           
 void doTransactionSet(Memcached memcached)
           
 void init(java.util.Properties p)
          Initialize the scenario.
 
Methods inherited from class com.yahoo.ycsb.Workload
cleanup, initThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_PREFIX_PROPERTY

public static final java.lang.String KEY_PREFIX_PROPERTY
See Also:
Constant Field Values

KEY_PREFIX_PROPERTY_DEFAULT

public static final java.lang.String KEY_PREFIX_PROPERTY_DEFAULT
See Also:
Constant Field Values

keyprefix

public static java.lang.String keyprefix

ADD_PROPORTION_PROPERTY

public static final java.lang.String ADD_PROPORTION_PROPERTY
See Also:
Constant Field Values

ADD_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String ADD_PROPORTION_PROPERTY_DEFAULT
See Also:
Constant Field Values

APPEND_PROPORTION_PROPERTY

public static final java.lang.String APPEND_PROPORTION_PROPERTY
See Also:
Constant Field Values

APPEND_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String APPEND_PROPORTION_PROPERTY_DEFAULT
See Also:
Constant Field Values

CAS_PROPORTION_PROPERTY

public static final java.lang.String CAS_PROPORTION_PROPERTY
See Also:
Constant Field Values

CAS_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String CAS_PROPORTION_PROPERTY_DEFAULT
See Also:
Constant Field Values

DECR_PROPORTION_PROPERTY

public static final java.lang.String DECR_PROPORTION_PROPERTY
See Also:
Constant Field Values

DECR_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String DECR_PROPORTION_PROPERTY_DEFAULT
See Also:
Constant Field Values

DELETE_PROPORTION_PROPERTY

public static final java.lang.String DELETE_PROPORTION_PROPERTY
See Also:
Constant Field Values

DELETE_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String DELETE_PROPORTION_PROPERTY_DEFAULT
See Also:
Constant Field Values

GET_PROPORTION_PROPERTY

public static final java.lang.String GET_PROPORTION_PROPERTY
See Also:
Constant Field Values

GET_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String GET_PROPORTION_PROPERTY_DEFAULT
See Also:
Constant Field Values

GETS_PROPORTION_PROPERTY

public static final java.lang.String GETS_PROPORTION_PROPERTY
See Also:
Constant Field Values

GETS_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String GETS_PROPORTION_PROPERTY_DEFAULT
See Also:
Constant Field Values

INCR_PROPORTION_PROPERTY

public static final java.lang.String INCR_PROPORTION_PROPERTY
See Also:
Constant Field Values

INCR_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String INCR_PROPORTION_PROPERTY_DEFAULT
See Also:
Constant Field Values

PREPEND_PROPORTION_PROPERTY

public static final java.lang.String PREPEND_PROPORTION_PROPERTY
See Also:
Constant Field Values

PREPEND_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String PREPEND_PROPORTION_PROPERTY_DEFAULT
See Also:
Constant Field Values

REPLACE_PROPORTION_PROPERTY

public static final java.lang.String REPLACE_PROPORTION_PROPERTY
See Also:
Constant Field Values

REPLACE_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String REPLACE_PROPORTION_PROPERTY_DEFAULT
See Also:
Constant Field Values

SET_PROPORTION_PROPERTY

public static final java.lang.String SET_PROPORTION_PROPERTY
See Also:
Constant Field Values

SET_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String SET_PROPORTION_PROPERTY_DEFAULT
See Also:
Constant Field Values

VALUE_LENGTH_PROPERTY

public static final java.lang.String VALUE_LENGTH_PROPERTY
See Also:
Constant Field Values

VALUE_LENGTH_PROPERTY_DEFAULT

public static final java.lang.String VALUE_LENGTH_PROPERTY_DEFAULT
See Also:
Constant Field Values

CHURN_WORKING_SET_PROPERTY

public static final java.lang.String CHURN_WORKING_SET_PROPERTY
See Also:
Constant Field Values

CHURN_WORKING_SET_PROPERTY_DEFAULT

public static final java.lang.String CHURN_WORKING_SET_PROPERTY_DEFAULT

CHURN_WORKING_SET_DELTA_PROPERTY

public static final java.lang.String CHURN_WORKING_SET_DELTA_PROPERTY
See Also:
Constant Field Values

CHURN_WORKING_SET_DELTA_PROPERTY_DEFAULT

public static final java.lang.String CHURN_WORKING_SET_DELTA_PROPERTY_DEFAULT
See Also:
Constant Field Values

FIELD_COUNT_PROPERTY

public static final java.lang.String FIELD_COUNT_PROPERTY
The name of the property for the number of fields in a record.

See Also:
Constant Field Values

FIELD_COUNT_PROPERTY_DEFAULT

public static final java.lang.String FIELD_COUNT_PROPERTY_DEFAULT
Default number of fields in a record.

See Also:
Constant Field Values

REQUEST_DISTRIBUTION_PROPERTY

public static final java.lang.String REQUEST_DISTRIBUTION_PROPERTY
The name of the property for the the distribution of requests across the keyspace. Options are "uniform", "zipfian" and "latest"

See Also:
Constant Field Values

REQUEST_DISTRIBUTION_PROPERTY_DEFAULT

public static final java.lang.String REQUEST_DISTRIBUTION_PROPERTY_DEFAULT
The default distribution of requests across the keyspace

See Also:
Constant Field Values

MAX_SCAN_LENGTH_PROPERTY

public static final java.lang.String MAX_SCAN_LENGTH_PROPERTY
The name of the property for the max scan length (number of records)

See Also:
Constant Field Values

MAX_SCAN_LENGTH_PROPERTY_DEFAULT

public static final java.lang.String MAX_SCAN_LENGTH_PROPERTY_DEFAULT
The default max scan length.

See Also:
Constant Field Values

SCAN_LENGTH_DISTRIBUTION_PROPERTY

public static final java.lang.String SCAN_LENGTH_DISTRIBUTION_PROPERTY
The name of the property for the scan length distribution. Options are "uniform" and "zipfian" (favoring short scans)

See Also:
Constant Field Values

SCAN_LENGTH_DISTRIBUTION_PROPERTY_DEFAULT

public static final java.lang.String SCAN_LENGTH_DISTRIBUTION_PROPERTY_DEFAULT
The default max scan length.

See Also:
Constant Field Values

INSERT_ORDER_PROPERTY

public static final java.lang.String INSERT_ORDER_PROPERTY
The name of the property for the order to insert records. Options are "ordered" or "hashed"

See Also:
Constant Field Values

INSERT_ORDER_PROPERTY_DEFAULT

public static final java.lang.String INSERT_ORDER_PROPERTY_DEFAULT
Default insert order.

See Also:
Constant Field Values
Constructor Detail

MemcachedCoreWorkload

public MemcachedCoreWorkload()
Method Detail

init

public void init(java.util.Properties p)
          throws WorkloadException
Initialize the scenario. Called once, in the main client thread, before any operations are started.

Overrides:
init in class Workload
Throws:
WorkloadException

doInsert

public boolean doInsert(DataStore memcached,
                        java.lang.Object threadstate)
Do one insert operation. Because it will be called concurrently from multiple client threads, this function must be thread safe. However, avoid synchronized, or the threads will block waiting for each other, and it will be difficult to reach the target throughput. Ideally, this function would have no side effects other than DB operations.

Specified by:
doInsert in class Workload

doTransaction

public boolean doTransaction(DataStore memcached,
                             java.lang.Object threadstate)
Do one transaction operation. Because it will be called concurrently from multiple client threads, this function must be thread safe. However, avoid synchronized, or the threads will block waiting for each other, and it will be difficult to reach the target throughput. Ideally, this function would have no side effects other than DB operations.

Specified by:
doTransaction in class Workload
Returns:
false if the workload knows it is done for this thread. Client will terminate the thread. Return true otherwise. Return true for workloads that rely on operationcount. For workloads that read traces from a file, return true when there are more to do, false when you are done.

doTransactionAdd

public void doTransactionAdd(Memcached memcached)

doTransactionAppend

public void doTransactionAppend(Memcached memcached)

doTransactionCas

public void doTransactionCas(Memcached memcached)

doTransactionDecr

public void doTransactionDecr(Memcached memcached)

doTransactionDelete

public void doTransactionDelete(Memcached memcached)

doTransactionGet

public void doTransactionGet(Memcached memcached)

doTransactionGets

public long doTransactionGets(Memcached memcached)

doTransactionIncr

public void doTransactionIncr(Memcached memcached)

doTransactionPrepend

public void doTransactionPrepend(Memcached memcached)

doTransactionReplace

public void doTransactionReplace(Memcached memcached)

doTransactionSet

public void doTransactionSet(Memcached memcached)