CBC-PILLOWFIGHT(1)
CBC-PILLOWFIGHT(1) π
so bestie, welcome to the General Commands Manual page for cbc-pillowfight β yes that's the whole name, iconic, no notes. it lives in section 1 and it's about to be your new favorite chaos gremlin. let's get into it π
β¨ NAME β¨
cbc-pillowfight β Stress Test for Couchbase Client and Cluster π₯ποΈ
β¨ SYNOPSIS β¨
cbc-pillowfight [OPTIONS]
that's it. that's the whole vibe. just options, go wild π
β¨ DESCRIPTION β¨
okay so cbc-pillowfight spins up a specified number of threads, and each one just loops forever doing get and set operations against the cluster. it is, literally, a pillow fight in your database. except the pillows are network buffers. ποΈ
the stress test operates in the following order:
- it will pre-load the items in the cluster (set by the
--num-itemsoption) - once the items are all loaded into the cluster, it will access all the items (within the
--num-itemsspecification), using a combination of storage and retrieval operations (the proportion of retrieval and storage operations are controlled via the--set-pctoption) - operations are scheduled in batches. the batches represent a single pipeline (or network buffer) which is filled with a certain amount of operations (see the
--batch-sizeoption). these batch sizes are then sent over to the cluster and the requests are serviced by it.
Tuning
ngl, getting the right benchmark numbers highly depends on the type of environment the client is being run in. here's the tea on specific settings which may make pillowfight generate more operations π
- increasing the batch size will typically speed up operations, but increasing the batch size too much will actually slow it down. additionally, very high batch sizes will cause high memory usage. π
- adding additional threads will create additional client objects and connections, potentially increasing performance. adding too many threads will cause local and network resource congestion. π«
- decreasing the item sizes (the
--min-sizeand--max-sizeoptions) will always yield higher performance in terms of operationd-per-second. - limiting the working set (i.e.
--num-items) will decrease the working set within the cluster, thereby increasing the chance that a given item will be inside the server's CPU cache (which is extremely fast), rather than in main memory (slower), or disk (much slower) π
the benchmark tool sets up SIGQUIT (CTRL-/) handler and dumps useful diagnostics and metrics to STDERR on this signal. so if you hit CTRL-/ you get the receipts β¨
β¨ OPTIONS β¨
options may be read either from the command line, or from a configuration file (see cbcrc(4)): π
the following options control workload generation:
-B,--batch-size=BATCHSIZEβ this controls how many commands are scheduled per cycles. want to simulate one operation at a time? set this value to1. π―-I,--num-items=NUMITEMSβ sets the total number of items the workload will access within the cluster. this also determines the working set size at the server and may affect disk latencies if set to a high number. β οΈ-p,--key-prefix=PREFIXβ sets the prefix to prepend to all keys in the cluster. useful if you do not wish the items to conflict with existing data. no accidental collisions, we love to see it π--collection=scopeName.collectionNameβ access data based on full collection name path. multiple--collectionfilters can specify the different scopes with different collection names. note that default collection will not be used if the collection was specified β to enable default collection along with the named ones, it should be specified explicitly as--collection=_default._default. iykyk π§-t,--num-threads=NTHREADSβ sets the number of threads (and thus the number of client instances) to run concurrently. each thread is assigned its own client object. very main character energy, every thread gets its own little life π-r,--set-pct=PERCENTAGEβ the percentage of operations which should be mutations. a value of100means only mutations while a value of0means only retrievals. pick your fighter π₯-n,--no-populationβ by defaultcbc-pillowfightwill load all the items (see--num-items) into the cluster and then begin performing the normal workload. specifying this option bypasses this stage. useful if the items have already been loaded in a previous run. β¨--populate-onlyβ stop after population. useful to populate buckets with large amounts of data. load it up and dip π«Ά-m,--min-size=MINSIZE:-M,--max-size=MAXSIZEβ specify the minimum and maximum value sizes to be stored into the cluster. this is typically a range, in which case each value generated will be between--min-sizeand--max-sizebytes. π-E,--pause-at-endβ when the workload completes, do not exit immediately, but wait for user input. this is helpful for analyzing open socket connections and state. it's giving "hold still, i'm looking at you" π-c,--num-cyclesβ specify the number of times the workload should cycle. during each cycle an amount of--batch-sizeoperations are executed. setting this to-1will cause the workload to run infinitely. π₯--sequentialβ specify that the access pattern should be done in a sequential manner. this is useful for bulk-loading many documents in a single server. π--start-atβ this specifies the starting offset for the items. the items by default are generated with the key prefix (--key-prefix) up to the number of items (--num-items). the--start-atvalue will increase the lower limit of the items. this is useful to resume a previously cancelled load operation. the "un-pause" button, basically β―οΈ-T,--timingsβ enabled timing recorded. timing histogram will be dumped toSTDERRonSIGQUIT(CTRL-/). when specified a second time, it will dump a histogram of command timings and latencies to the screen every second. π-e,--expiry=SECONDSβ set the expiration time on the document forSECONDSwhen performing each operation. note that setting this too low may cause not-found errors to appear on the screen. π
@@common-options.markdown@@
d,--durability=LEVELβ specify durability level for mutation operations. known values are:"none","majority","majority_and_persist_to_active","persist_to_majority". πΎp,--persist-to=NUMNODESβ wait until the item has been persisted to at leastNUMNODESnodes' disk. ifNUMNODESis1then wait until only the master node has persisted the item for this key. you may not specify a number greater than the number of nodes actually in the cluster.-1is a special value, which mean to use all available nodes. ποΈr,--replicate-to=NREPLICASβ wait until the item has been replicated to at leastNREPLICASreplica nodes. the bucket must be configured with at least one replica, and at leastNREPLICASreplica nodes must be online.-1is a special value, which mean to use all available replicas. πͺ--lock=TIMEβ this will retrieve and lock an item before update, making it inaccessible for modification until the update completed, orTIMEhas passed. π--jsonβ make pillowfight store document as JSON rather than binary. this will allow the documents to nominally be analyzed by other Couchbase services such as Query and MapReduce. π
JSON documents are created by creating an empty JSON object ({}) and then repeated populating it with Field_%d property names (where %d is 1 and higher), and setting its value to a repeating asterisk * up to 16 times:
{
"Field_1": "****************",
"Field_2": "****************",
"Field_3": "****************",
"Field_4": "****************",
"Field_5": "********"
}
when using document size constraints, be aware that the minimum and maximum sizes (--min-size and --max-size) are not strict limits, and that the resultant sizes may be bigger or smaller by a few bytes in order to satisfy the requirements of proper JSON syntax. β οΈ
--noopβ use couchbaseNOOPoperations when running the workload. this mode ignores population, and all other document operations. useful as the most lightweight workload. πͺΆ--subdocβ use couchbase sub-document operations when running the workload. in this mode pillowfight will use Couchbase sub-document operationshttp://blog.couchbase.com/2016/february/subdoc-explainedto perform gets and sets of data. this option must be used with--json. π§¬--pathcountβ specify the number of paths a single sub-document operation should contain. by default, each subdoc operation operates on only a single path within the document. you can specify multiple paths to atomically executed multiple subdoc operations within a single command. πΏ
this option does not affect the --batch-size option as a subdoc command is considered as a single command (with respect to batching) regardless of how many operations it contains. π
β¨ ADDITIONAL OPTIONS β¨
the following options may be included in the connection string (via the -U option) as URI-style query params (e.g. couchbase://host/bucket?option1=value1&option2=value2) or as individual key=value pairs passed to the -D switch (e.g. -Doption1=value1 -Doption2=value). the -D will internally build the connection string, and is provided as a convenience for options to be easily passed on the command-line. π
@@common-additional-options.markdown@@
(part 2 incoming, don't move π)
β¨ EXAMPLES β¨
okay bestie this is the part where it all comes together, like the montage scene before the finale π
π CONNECTION EXAMPLES π
these ones show you how to hook cbc-pillowfight up to basically every kind of cluster setup you could possibly have. pick your fighter:
connect to a bucket (a_bucket) on a cluster on a remote host β this is for servers version 5.x and up. it uses account 'myname' and it'll ask you for the password interactively, no spoilers:
cbc-pillowfight -U couchbase://192.168.33.101/a_bucket -u myname -P-
run against a password-less bucket (a_bucket) on a cluster on a remote host β this one's for servers older than 5.x, so keep that in mind:
cbc-pillowfight -U couchbase://192.168.33.101/a_bucket
connect to an SSL cluster at secure.net where the cert is chillin locally at /home/couchbase/couchbase_cert.pem:
cbc-pillowfight -U couchbases://secure.net/topsecret_bucket?certpath=/home/couchbase/couchbase_cert.pem
connect to an SSL cluster at secure.net but ignore certificate verification β look, this is insecure, full stop, but it's handy for testing so we're not judging:
cbc-pillowfight -U couchbases://secure.net/topsecret_bucket?ssl=no_verify
connect to a password protected bucket (protected) on a remote host β for servers older than 5.x. it'll prompt you and the dots won't tell anyone how long your password is:
cbc-pillowfight -U couchbase://remote.host.net/protected -P -
Bucket password:
......
connect to a password protected bucket (again, servers older than 5.x) but put the password right on the command line β this is INSECURE but useful for testing dummy environments, and honestly we've all done it:
cbc-pillowfight -U couchbase://remote.host.net/protected -P t0ps3cr3t
connect to a bucket running on a cluster with a custom REST API port:
cbc-pillowfight -U http://localhost:9000/default
connect to a bucket running on a cluster with a custom memcached port:
cbc-pillowfight -U couchbase://localhost:12000/default
connect to a memcached (<http://memcached.org>) cluster using the binary protocol β important lore: a vanilla memcached cluster is not the same thing as a memcached bucket living inside a couchbase cluster (use the normal couchbase:// scheme for that one, bestie):
cbc-pillowfight -U memcached://host1,host2,host3,host4
connect to an SSL cluster at secure.net:
cbc-pillowfight -U couchbases://secure.net/topsecret_bucket
run against a bucket (a_bucket) on a cluster on a remote host:
cbc-pillowfight -U couchbase://192.168.33.101/a_bucket
run against a bucket (a_bucket) and use collections app.users and backup.stage β look at you, all fancy with multiple collections:
cbc-pillowfight --spec couchbase://127.0.0.1/a_bucket --username Administrator --password password \
--collection app.users --collection backup.stage
π BENCHMARK EXAMPLES π
now for the part where you actually put it to work. these show you how to configure different types of workloads, so you can vibe-check your cluster properly π₯
run with 20 threads/instances, each doing one operation at a time:
cbc-pillowfight -t 20 -B 1
run 100 iterations of 2MB item sizes, using a dataset of 50 items:
cbc-pillowfight -M $(1024*1024) -m $(1024*1024) -c 100 -I 50
use JSON documents of 100k each:
cbc-pillowfight --json -m 100000 -M 100000
stress-test sub-document mutations:
cbc-pillowfight --json --subdoc --set-pct 100
π± TODO π±
okay so here's the wishlist: instead of spawning threads for multiple instances, the goal is to offer a way to have multiple instances function cooperatively inside an event loop. one day, bestie, one day π«Ά
π BUGS π
this command's options are subject to change. yes, for real. brace yourself, no cap.
π SEE ALSO π
go read those too, iykyk π
π HISTORY π
the cbc-pillowfight tool was first introduced in libcouchbase 2.0.7. a true icon, born in that era, still slaying π
okay that's literally the whole page, you made it to the end and i'm so proud of you ππ this whole thing is from CBC-PILLOWFIGHT(1), dated July 2024 β so like, reasonably recent, she's fresh. go forth and pillowfight responsibly, bestie π¦π
π¦ where this page comes from
- alpine 3.24: libcouchbase-doc 3.3.18-r0 Β· Apache-2.0
- fedora 43: libcouchbase-tools 3.3.17-2.fc43 Β· Apache-2.0
- fedora 44: libcouchbase-tools 3.3.18-3.fc44 Β· Apache-2.0
- nixos 26.05: libcouchbase 3.3.18
- nixpkgs unstable: libcouchbase 3.3.19
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms