Running the stress client involves three steps:
 - setting up the table and indexes
 - populating it with data
 - run stress clients to generate the test load

Workloads to select can be found in the 'stress_workloads' subdirectory.
Some workloads take parameters in environment variables:

X_MAX_KEY - the largest key currently in the database
X_MAX_KEY_FILE - the file to use to keep track of the largest key currently in the database
 - this file is shared between read and write workloads so that read knows the highest key it can query
X_WRITE_BATCH_SIZE - the number of rows to write at once in a write workload
X_END_DATE - the most recent date to use when getting time ranges
X_DATE_INTERVAL - the interval to use when selecting time ranges, by power law

x_read - X_MAX_KEY, X_MAX_KEY_FILE
x_write - X_MAX_KEY, X_MAX_KEY_FILE, X_WRITE_BATCH_SIZE
x_between - X_END_DATE, X_DATE_INTERVAL
x_map_reduce - X_END_DATE, X_DATE_INTERVAL
x_get_all - none
x_connect - none

Below are example bash scripts for both table setup and running the stress client.

----------------------------------------------------------
#!/usr/bin/env bash
# Table population
# Before you run this, create a table with secondary indexes as follows (JS code):
#   r.tableCreate("stress")
#   r.table("stress").indexCreate("datetime")
#   r.table("stress").indexCreate("customer_id")
#   r.table("stress").indexCreate("compound", function(x) { return r.expr([x('customer_id'), x('datetime')]); } )
#   r.table("stress").indexWait("datetime", "customer_id", "compound")

X_STRESS_SCRIPT=./stress
HOST_PORT=localhost:28015
DB_TABLE=test.stress
X_OPTIONS="--host $HOST_PORT --table $DB_TABLE"

export X_MAX_KEY=0
export X_MAX_KEY_FILE=$DB_TABLE.max_key

rm $X_MAX_KEY_FILE

# The total number of documents inserted
OP_COUNT=100000

$X_STRESS_SCRIPT $X_OPTIONS --clients 128 -w x_write --op-count $OP_COUNT > populate.out

-----------------------------------------------------------
#!/usr/bin/env bash
# Stress test, runs 'workload x' from issue #1369

X_STRESS_SCRIPT=./stress
HOST_PORT=localhost:28015
DB_TABLE=test.stress
X_OPTIONS="--host $HOST_PORT --table $DB_TABLE"

export X_MAX_KEY_FILE=$DB_TABLE.max_key
export X_END_DATE=`date +%Y-%m-%d`
export X_DATE_INTERVAL="1 day"

echo "Running traffic..."
$X_STRESS_SCRIPT $X_OPTIONS --ops-per-conn 1 --clients 16 --ops-per-sec 60 -w x_write > x_write.out &
$X_STRESS_SCRIPT $X_OPTIONS --ops-per-conn 10 --clients 32 --ops-per-sec 1000 -w x_read > x_read.out &
$X_STRESS_SCRIPT $X_OPTIONS --ops-per-conn 1 --clients 2 --ops-per-sec 1 -w x_between > x_between.out &
$X_STRESS_SCRIPT $X_OPTIONS --ops-per-conn 1 --clients 2 --ops-per-sec 1 -w x_map_reduce > x_map_reduce.out &
$X_STRESS_SCRIPT $X_OPTIONS --ops-per-conn 1 --clients 8 --ops-per-sec 10 -w x_get_all > x_get_all.out &
$X_STRESS_SCRIPT $X_OPTIONS --ops-per-conn 0 --clients 2 --ops-per-sec 2 -w x_connect > x_connect.out &

wait
