stress: a stressful tool

Running the stress client now involves two steps:
 - the table is populated
 - stress clients are then run

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

X_STRESS_SCRIPT=./x_stress
HOST_PORT=newton:59435
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

# This script should create the table and any secondary indexes
./setup_table.py $HOST_PORT $DB_TABLE

$X_STRESS_SCRIPT $X_OPTIONS --clients 64 --ops-per-sec 4000 -w x_write > populate.out

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

X_STRESS_SCRIPT=./x_stress
HOST_PORT=newton:59435
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=2013-09-03
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

