com.yahoo.ycsb.workloads
Class CoreWorkload

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

public class CoreWorkload
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 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 FIELD_LENGTH_PROPERTY
          The name of the property for the length of a field in bytes.
static java.lang.String FIELD_LENGTH_PROPERTY_DEFAULT
          The default length of a field in bytes.
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 INSERT_PROPORTION_PROPERTY
          The name of the property for the proportion of transactions that are inserts.
static java.lang.String INSERT_PROPORTION_PROPERTY_DEFAULT
          The default proportion of transactions that are inserts.
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 READ_ALL_FIELDS_PROPERTY
          The name of the property for deciding whether to read one field (false) or all fields (true) of a record.
static java.lang.String READ_ALL_FIELDS_PROPERTY_DEFAULT
          The default value for the readallfields property.
static java.lang.String READ_PROPORTION_PROPERTY
          The name of the property for the proportion of transactions that are reads.
static java.lang.String READ_PROPORTION_PROPERTY_DEFAULT
          The default proportion of transactions that are reads.
static java.lang.String READMODIFYWRITE_PROPORTION_PROPERTY
          The name of the property for the proportion of transactions that are read-modify-write.
static java.lang.String READMODIFYWRITE_PROPORTION_PROPERTY_DEFAULT
          The default proportion of transactions that are scans.
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 SCAN_PROPORTION_PROPERTY
          The name of the property for the proportion of transactions that are scans.
static java.lang.String SCAN_PROPORTION_PROPERTY_DEFAULT
          The default proportion of transactions that are scans.
static java.lang.String TABLENAME
          The name of the database table to run queries against.
static java.lang.String UPDATE_PROPORTION_PROPERTY
          The name of the property for the proportion of transactions that are updates.
static java.lang.String UPDATE_PROPORTION_PROPERTY_DEFAULT
          The default proportion of transactions that are updates.
 
Fields inherited from class com.yahoo.ycsb.Workload
INSERT_START_PROPERTY, INSERT_START_PROPERTY_DEFAULT
 
Constructor Summary
CoreWorkload()
           
 
Method Summary
 boolean doInsert(DB db, java.lang.Object threadstate)
          Do one insert operation.
 boolean doTransaction(DB db, java.lang.Object threadstate)
          Do one transaction operation.
 void doTransactionInsert(DB db)
           
 void doTransactionRead(DB db)
           
 void doTransactionReadModifyWrite(DB db)
           
 void doTransactionScan(DB db)
           
 void doTransactionUpdate(DB db)
           
 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

TABLENAME

public static final java.lang.String TABLENAME
The name of the database table to run queries against.

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

FIELD_LENGTH_PROPERTY

public static final java.lang.String FIELD_LENGTH_PROPERTY
The name of the property for the length of a field in bytes.

See Also:
Constant Field Values

FIELD_LENGTH_PROPERTY_DEFAULT

public static final java.lang.String FIELD_LENGTH_PROPERTY_DEFAULT
The default length of a field in bytes.

See Also:
Constant Field Values

READ_ALL_FIELDS_PROPERTY

public static final java.lang.String READ_ALL_FIELDS_PROPERTY
The name of the property for deciding whether to read one field (false) or all fields (true) of a record.

See Also:
Constant Field Values

READ_ALL_FIELDS_PROPERTY_DEFAULT

public static final java.lang.String READ_ALL_FIELDS_PROPERTY_DEFAULT
The default value for the readallfields property.

See Also:
Constant Field Values

READ_PROPORTION_PROPERTY

public static final java.lang.String READ_PROPORTION_PROPERTY
The name of the property for the proportion of transactions that are reads.

See Also:
Constant Field Values

READ_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String READ_PROPORTION_PROPERTY_DEFAULT
The default proportion of transactions that are reads.

See Also:
Constant Field Values

UPDATE_PROPORTION_PROPERTY

public static final java.lang.String UPDATE_PROPORTION_PROPERTY
The name of the property for the proportion of transactions that are updates.

See Also:
Constant Field Values

UPDATE_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String UPDATE_PROPORTION_PROPERTY_DEFAULT
The default proportion of transactions that are updates.

See Also:
Constant Field Values

INSERT_PROPORTION_PROPERTY

public static final java.lang.String INSERT_PROPORTION_PROPERTY
The name of the property for the proportion of transactions that are inserts.

See Also:
Constant Field Values

INSERT_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String INSERT_PROPORTION_PROPERTY_DEFAULT
The default proportion of transactions that are inserts.

See Also:
Constant Field Values

SCAN_PROPORTION_PROPERTY

public static final java.lang.String SCAN_PROPORTION_PROPERTY
The name of the property for the proportion of transactions that are scans.

See Also:
Constant Field Values

SCAN_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String SCAN_PROPORTION_PROPERTY_DEFAULT
The default proportion of transactions that are scans.

See Also:
Constant Field Values

READMODIFYWRITE_PROPORTION_PROPERTY

public static final java.lang.String READMODIFYWRITE_PROPORTION_PROPERTY
The name of the property for the proportion of transactions that are read-modify-write.

See Also:
Constant Field Values

READMODIFYWRITE_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String READMODIFYWRITE_PROPORTION_PROPERTY_DEFAULT
The default proportion of transactions that are scans.

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

CoreWorkload

public CoreWorkload()
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(DB db,
                        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(DB db,
                             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.

doTransactionRead

public void doTransactionRead(DB db)

doTransactionReadModifyWrite

public void doTransactionReadModifyWrite(DB db)

doTransactionScan

public void doTransactionScan(DB db)

doTransactionUpdate

public void doTransactionUpdate(DB db)

doTransactionInsert

public void doTransactionInsert(DB db)