basho/basho_bench — pull request #17 by rustyio (2011-12-09 17:21:52+00:00)
Title: Add measurements and parameterized operations (AZ1001)

This pull request adds two new features to Basho Bench, 1) measurements and 2) parameterized operations.

It also updates the 2i driver.

## Measurements

Take cluster-wide measurements for things like CPU, memory, #
processes, and # filehandles.

To enable measurements:

```erlang
{measurement_driver,
basho_bench_measurement_erlangvm}.

{measurements, [
{memory, 1000},
{cpu, 1000},
{processes, 1000},
{filehandles, 1000}
]}.

{nodes, ['riak@127.0.0.1']}.
{cookie, riak}.
```

Measurements are written to files **cpu_measurements.csv**,
**memory_measurements.csv**, **processes_measurements.csv**, and
**filehandles_measurements.csv**.

Measurements are tied into the same statistics tracking as
operations,which means that each call to a measurement counts
towards the overall "ops/sec" of the system.

## Parameterized Operations

Make drivers more flexible by allowing config files to specify
operations as tuples rather than atoms.

For example:

```erlang
{operations, [
{get_pb, 1},
{{put_pb, 5}, 20},
{{query_http, 10}, 1},
{{query_mr, 10}, 1},
{{query_pb, 10}, 1}
]}.
```

The driver file can then match the operation tuple and extract
parameters. For example, the following operation creates a Riak
object with N index entries:

```erlang
run({put_pb, N}, KeyGen, ValueGen, State) ->
%% code here
```

The tuple is converted to the statistic file name by replacing
all commas with dashes. So `{put_pb, 5}` creates a statistic file
called `put-pb-5_latencies.csv`.

This makes it easy to compare the latencies of multiple
operations in a single test run. For example, defining operations
of `{put_pb, 5}` and {`put_pb, 500}` to see how much of an impact
index entries have on put speed.

## Testing

Perhaps the best way to convince yourself that this all works is
to stand up a Riak cluster, set the backend to
`riak_kv_eleveldb_backend`, and then run the 2i driver using
`./basho_bench examples/2i.config`.

This will exercise all new functionality in the system.