A newer version of this documentation is available.

View Latest

cbworkloadgen

      +

      Generates random data and performs reads and writes

      SYNOPSIS

      cbworkloadgen [--node <host>] [--username <user>] [--password <password>]
                      [--bucket <bucket>] [--ssl] [--threads <num>]
                      [--ratio-sets <ratio>] [--max-items <num>] [--prefix <str>]
                      [--size <bytes>] [--json] [--low-compression] [--loop]
                      [--xattr] [--collection <id>] [--verbose] [--help]

      DESCRIPTION

      The cbworkloadgen tool is useful to test a Couchbase cluster as well as to generate test data sets. The tool is installed in the following locations:

      Operating system Location

      Linux

      /opt/couchbase/bin/

      Windows

      C:\Program Files\Couchbase\Server\bin\

      Mac OS X

      /Applications/Couchbase Server.app/Contents/Resources/couchbase-core/bin/

      Options

      -n,--node <host>

      Target node address in the form ip:port or hostname:port for example -n 127.0.0.1:8091. If non provided it will default to 127.0.0.1:8091.

      -u,--username <user>

      Specifies the username of the user executing the command. If you do not have a user account with permission to execute the command then it will fail with an unauthorized error.

      -p,--password <password>

      Specifies the password of the user executing the command. If you do not have a user account with permission to execute the command then it will fail with an unauthorized error.

      -b,--bucket <bucket>

      Specifies the bucket to operate on. If non provided it will use default.

      --ssl

      Use SSL for transferring and reading data.

      -t,--threads <num>

      Number of concurrent threads use to insert or get data. By default it will use 1.

      -r,--ratio-sets <ratio>

      The percentage of the workload that are writes; the remainder will be reads. By default it is set to 0.95.

      -i,--max-items<num>

      Number of inserted items. The default is 10000.

      --prefix <prefix>

      Prefixed to use for the document keys. The default is pymc.

      --s,--size <bytes>

      Minimum value size in bytes, it defaults to to bytes.

      --json

      When specified the program will insert json documents.

      --low-compression

      When specified the generated documents will be difficult to compress.

      --loop

      The process will loop forever until the user interrupts it.

      --xattr

      When specified the inserted documents will have extended attributes.

      -c,--collection <id>

      The collection ID to perform the operations on. A collection with the given ID must exist. The ID is expected to be a number in hex format for example '0x16'.

      -v,--verbose

      Verbose logging; more -Vs provide more verbosity.

      -h,--help

      Shows help message.

      Examples

      To generate workload on a given Couchbase Server use:

      $ cbworkloadgen -n 10.5.2.45:8091 -b my-bucket -u Administrator -p password

      This command will create 10000 binary documents with keys prefixed by pymc in the target bucket. The output of the command would look as follows:

      [####################] 100.0% (1111110/estimated 1111110 msgs)
      bucket: default, msgs transferred...
            :                total |       last |    per sec
      byte  :            111111000 |  111111000 |   636622.5
      done

      To generate a data set of one million JSON documents on a cluster use:

      $ cbworkloadgen -n 10.5.2.45:8091 -b my-bucket -u Administrator -p password \
       -i 1000000 -j -r 1

      By default the documents generated by the tool are very compressible which may not be ideal for some case scenarios to change this use the --low-compression flag as follows:

      $ cbworkloadgen -n 10.5.2.45:8091 -b my-bucket -u Administrator -p password \
       -i 1000000 -j -r 1 --low-compression -s 20480

      The command above will create documents with bodies of at least 20480 bytes (20Kb) that are hard to compress.

      To generate documents into the collection my_collection you first must find the collection ID. This can be done by using the command below:

      $ cbstats -u Administrator -p Password -b my-bucket 10.5.2.45:11210 collections | grep ":name:.*my_collection"
       0x0:0x8:name:                 my_collection

      We can see that the collection ID is 0x08, so we can now use the -c flag to generate the documents as shown below.

      $ cbworkloadgen -n 10.5.2.45:8091 -b my-bucket -u Administrator -p password \
       -i 1000000 -j -r 1 -c 0x08