Generates random data and performs reads and writes
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]
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:
Mac OS X
- -n,--node <host>
Target node address in the form
-n 127.0.0.1:8091. If non provided it will default to
- -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.
Use SSL for transferring and reading data. You can also use SSL encryption by specifying the cluster host name using either couchbases:// or https://. Each of these connection schemes will ensure that the connection is encrypted with SSL. You may then use either --no-ssl-verify or --cacert in order to customize how your SSL connection is set up.
Specifies that SSL verification should be used but that verifying that the cluster certificate is valid should be skipped. Use of this flag is not recommended for production environments because it does not protect the user from a man-in-the-middle attack.
- --cacert <path>
Specifies that the SSL connection should use the cacert provided when connecting to the cluster. This argument takes the path the certificate file as its value. This is the most secure way to connect to your cluster.
- -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.
Number of inserted items. The default is 10000.
- --prefix <prefix>
Prefixed to use for the document keys. The default is
- --s,--size <bytes>
Minimum value size in bytes, it defaults to to bytes.
When specified the program will insert json documents.
When specified the generated documents will be difficult to compress.
The process will loop forever until the user interrupts it.
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'.
Verbose logging; more -Vs provide more verbosity.
Shows help message.
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
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