### Run NoSQLBench with Advanced Options Source: https://docs.nosqlbench.io/getting-started/00-get-nosqlbench Demonstrates a detailed NoSQLBench command execution with multiple parameters: specifying workload, scenario, output filename, format, cycle count, rate, and progress reporting. ```bash 1| ./nb5 examples/bindings-basics default \ ---|--- 2| filename=exampledata.out \ 3| format=csv \ 4| cycles=10000 \ 5| rate=100 \ 6| --progress console:1s ``` -------------------------------- ### Run DSE in Docker Source: https://docs.nosqlbench.io/getting-started/01-test-target Starts a DataStax Enterprise (DSE) server instance using Docker. This command pulls the specified DSE image and runs it in detached mode, exposing the CQL port (9042). Ensure Docker is installed and running. ```docker docker run -e DS_LICENSE=accept --name my-dse -p 9042:9042 -d datastax/dse-server:6.8.17-ubi7 ``` -------------------------------- ### Run a Simple Built-in Workload Source: https://docs.nosqlbench.io/getting-started Executes a basic NoSQLBench workload using a built-in scenario named 'bindings-basics'. This command assumes the nb5 binary is in the current directory or in the system's PATH. ```bash ./nb5 examples/bindings-basics ``` -------------------------------- ### Download and Execute Latest nb5 Binary (Linux) Source: https://docs.nosqlbench.io/getting-started Downloads the latest nb5 Linux binary using curl, makes it executable with chmod, and verifies the installation by printing the version. This is the recommended method for Linux users. ```bash # download the latest nb5 binary and make it executable curl -L -O https://github.com/nosqlbench/nosqlbench/releases/latest/download/nb5 chmod +x nb5 ./nb5 --version ``` -------------------------------- ### Advanced NoSQLBench Command with Options Source: https://docs.nosqlbench.io/getting-started Demonstrates a detailed NoSQLBench command with multiple options to customize workload execution. It specifies the workload, scenario, output filename, format, cycle count, rate, and progress reporting. ```bash 1| ./nb5 examples/bindings-basics default \ 2| filename=exampledata.out \ 3| format=csv \ 4| cycles=10000 \ 5| rate=100 \ 6| --progress console:1s ``` -------------------------------- ### Run Workload with Docker Metrics Dashboard Source: https://docs.nosqlbench.io/getting-started Executes a NoSQLBench workload and enables a live metrics dashboard using the `--docker-metrics` option. This requires Docker to be installed and the user to have permissions to use it. ```bash ./nb5 examples/bindings-basics default \ filename=exampledata.out \ format=csv \ cycles=10000 \ rate=100 \ --progress console:1s \ --docker-metrics ``` -------------------------------- ### Execute a Command with Arguments (CLI) Source: https://docs.nosqlbench.io/user-guide This example demonstrates executing the 'start' command with named arguments 'driver' and 'alias'. Commands are single words without dashes, and named arguments follow the command in 'name=value' format. ```bash nb5 start driver=diag alias=example ``` -------------------------------- ### Start an Activity Asynchronously Source: https://docs.nosqlbench.io/user-guide/cli-scripting The `start` command initiates an activity without blocking the scenario script. It runs asynchronously, allowing multiple activities to start concurrently. Requires a driver and optionally an alias for later interaction. ```bash start driver= alias= ... ``` -------------------------------- ### CQLd4 Op Template Examples Source: https://docs.nosqlbench.io/reference/drivers/cqld4 Demonstrates various statement forms for the CQLd4 driver in NoSQLBench. Includes examples for prepared, simple, raw, gremlin, and fluent statements, showcasing their syntax and intended use cases. ```yaml ops: # prepared statement # allows for parameterization via bindings, and uses prepared statements internally example-prepared-cql-stmt: prepared: | select one, two from buckle.myshoe where ... # prepared statement (verbose form) example-prepared-cql-stmt-verbose: type: prepared stmt: | select one, two from buckle.myshoe where ... # simple statement # allows for parameterization via bindings, but does not use prepared statements internally example-simple-cql-stmt: simple: | select three, four from knock.onthedoor where ... # raw statement # pre-renders the statement into a string, with no driver-supervised parameterization # useful for testing variant DDL where some fields are not parameterizable # NOTE: the raw form does its best to quote non-literals where needed, but you may # have to inject single or double quotes in special cases. example-raw-cql-stmt: raw: | create table if not exist {ksname}.{tblname} ... # gremlin statement using the fluent API, as it would be written in a client application example-fluent-graph-stmt: fluent: >- g.V().hasLabel("device").has("deviceid", UUID.fromString({deviceid})) # if imports are not specified, the following is auto imported. # if imports are specified, you must also provide the __ class if needed imports: - org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__ # gremlin statement using string API (not recommended) example-raw-gremlin-stmt: gremlin: >- g.V().hasLabel("device").has("deviceid", UUID.fromString('{deviceid}') ``` -------------------------------- ### Download Latest nb5 JAR Source: https://docs.nosqlbench.io/getting-started Downloads the latest nb5 JAR file using curl and verifies the download by printing the version using `java -jar nb5.jar --version`. This method is suitable for systems where the Linux binary is not preferred or available. ```bash # download the latest nb5 jar curl -L -O https://github.com/nosqlbench/nosqlbench/releases/latest/download/nb5.jar java -jar nb5.jar --version ``` -------------------------------- ### Run a Specific Scenario within a Workload Source: https://docs.nosqlbench.io/getting-started Executes a specific scenario named 'default' from the 'bindings-basics' workload template. This command explicitly specifies both the workload template and the scenario name. ```bash ./nb5 examples/bindings-basics default ``` -------------------------------- ### Configure NoSQLBench for AstraDB Connection Source: https://docs.nosqlbench.io/getting-started/01-test-target Provides configuration patterns for NoSQLBench to connect to DataStax AstraDB. It demonstrates using driver settings and referencing secure connect bundles and user/password files for credential management. This is useful for keeping sensitive information out of logs. ```properties ... driver=cqld4 scb= userfile= passfile= ... ``` ```properties ... driver=cqld4 scb=creds1/scb-somename.zip userfile=creds1/userfile passfile=creds1/passfile ... ``` -------------------------------- ### Run stdout Activity Source: https://docs.nosqlbench.io/reference/drivers/stdout This example demonstrates how to run a basic stdout activity named 'stdout-test'. It utilizes the 'driver=stdout' and 'workload=stdout-test' parameters to initiate the activity. ```bash nb5 driver=stdout workload=stdout-test ``` -------------------------------- ### Run Activity to Completion Source: https://docs.nosqlbench.io/user-guide/cli-scripting The `run` command executes an activity and waits for its completion before proceeding with the scenario script. It's equivalent to starting an activity and then awaiting its completion. ```bash run driver= alias= ... ``` -------------------------------- ### Simple Op Template Example Source: https://docs.nosqlbench.io/user-guide/op-templates A basic example of an op template using a simple string format. It demonstrates how to define an operation with a dynamic component using a placeholder. ```yaml op: "example {{Combinations('a-z')}} body" ``` -------------------------------- ### Enable Docker Metrics Infrastructure Source: https://docs.nosqlbench.io/user-guide/cli-options Enlist NoSQLBench to stand up your metrics infrastructure using a local Docker runtime. This automatically starts and configures Graphite, Prometheus, and Grafana. ```bash --docker-metrics ``` -------------------------------- ### SpecTest Formatting Example - YAML, JSON, Ops Source: https://docs.nosqlbench.io/reference/workload_definition/01-spectest-formatting Demonstrates the required sequence and format markers for SpecTest examples. This includes a YAML workload, its JSON representation, and an Ops section, all enclosed in fenced code blocks with specific prefixes. ```markdown _format:_ Copy```yaml # some yaml here ``` _json:_ Copy```json [] ``` _ops:_ Copy```json [] ``` ``` -------------------------------- ### Multi-Document YAML Workload Example Source: https://docs.nosqlbench.io/workloads-101/08-multi-docs This example demonstrates how to define two distinct YAML documents within a single file, separated by '---'. Each document has its own bindings and statements, allowing for parameterized and tagged operations to be organized separately. The output shows how NoSQLBench processes these documents. ```yaml # stdout-test.yaml bindings: docval: WeightedStrings('doc1.1:1;doc1.2:2;') statements: - "doc1.form1 {docval}\n" - "doc1.form2 {docval}\n" --- bindings: numname: NumberNameToString() statements: - "doc2.number {numname}\n" ``` ```bash [test]$ ./nb5 run driver=stdout workload=stdout-test cycles=10 ``` -------------------------------- ### NB S4J Driver Configuration File Example Source: https://docs.nosqlbench.io/reference/drivers/s4j This is an example of a NoSQLBench S4J driver configuration file. It includes settings for the S4J API, Pulsar client, producers, and consumers. The comments provide links to relevant documentation for each section. ```properties ########### # Overview: Starlight for JMS (S4J) API configuration items are listed at: # https://docs.datastax.com/en/fast-pulsar-jms/docs/1.1/pulsar-jms-reference.html#_configuration_options enableTransaction=true #### # S4J API specific configurations (non Pulsar specific) - jms.*** jms.enableClientSideEmulation=true jms.usePulsarAdmin=false #... ##### # Pulsar client related configurations - client.*** # - Valid settings: http://pulsar.apache.org/docs/en/client-libraries-java/#client # # - These Pulsar client settings (without the "client." prefix) will be # directly used as S4J configuration settings, on a 1-to-1 basis. #-------------------------------------- # only relevant when authentication is enabled client.authPlugin=org.apache.pulsar.client.impl.auth.AuthenticationToken client.authParams=file:///path/to/authentication/jwt/file # only relevant when in-transit encryption is enabled client.tlsTrustCertsFilePath=/path/to/certificate/file #... ##### # Producer related configurations (global) - producer.*** # - Valid settings: http://pulsar.apache.org/docs/en/client-libraries-java/#configure-producer # # - These Pulsar producer settings (without "producer." prefix) will be collectively (as a map) # mapped to S4J connection setting of "producerConfig" #-------------------------------------- producer.blockIfQueueFull=true # disable producer batching #producer.batchingEnabled=false #... ##### # Consumer related configurations (global) - consumer.*** # - Valid settings: http://pulsar.apache.org/docs/en/client-libraries-java/#configure-consumer # ``` -------------------------------- ### NoSQLBench Workload Progress Output Source: https://docs.nosqlbench.io/getting-started/02-scenarios Example output from NoSQLBench during a workload run, showing the progress of the 'cql-keyvalue' workload. It displays the number of remaining, active, and completed operations, along with the percentage completion. ```text Configured scenario log at ... cql-keyvalue (remaining,active,completed)=(47168,1,2832) 006% cql-keyvalue (remaining,active,completed)=(42059,2,7941) 016% cql-keyvalue (remaining,active,completed)=(37107,2,12895) 026% cql-keyvalue (remaining,active,completed)=(32060,1,17941) 036% cql-keyvalue (remaining,active,completed)=(27060,2,22940) 046% cql-keyvalue (remaining,active,completed)=(22058,2,27943) 056% cql-keyvalue (remaining,active,completed)=(17058,1,32942) 066% cql-keyvalue (remaining,active,completed)=(12059,2,37942) 076% cql-keyvalue (remaining,active,completed)=(7059,1,42942) 086% cql-keyvalue (remaining,active,completed)=(2060,1,47941) 096% cql-keyvalue (remaining,active,completed)=(0,0,50000) 100% (last report) ``` -------------------------------- ### Statement Forms and Examples Source: https://docs.nosqlbench.io/reference/drivers Explains the syntax for specifying statement types (`execute`, `query`, `update`) and provides examples of operation templates. ```APIDOC ## Statement Forms and Examples ### Description Details the simplified syntax for specifying statement types and provides examples of operation templates for DDL and DML operations. ### Statement Forms - **Simplified Syntax**: Uses a single `type` field with values `execute`, `query`, or `update`, and specifies the raw statements in the `stmt` field. - **Direct Syntax**: Alternatively, one can directly use one of the types (`execute`, `query`, `update`) and provide the raw query directly. ### Op Template Examples #### `drop-database` - **Type**: `execute` - **Statement**: `DROP DATABASE IF EXISTS TEMPLATE(database,baselines);` #### `create-table` - **Type**: `execute` - **Statement**: `CREATE TABLE IF NOT EXISTS TEMPLATE(database,baselines).TEMPLATE(table,keyvalue);` #### `select-table` - **Type**: `query` - **Statement**: `SELECT one, two, three FROM TEMPLATE(database,baselines).TEMPLATE(table,keyvalue) WHERE ...;` #### `insert-table` - **Type**: `update` - **Statement**: `UPDATE TABLE TEMPLATE(database,baselines).TEMPLATE(table,keyvalue) SET key = 'value' WHERE ...;` ### Request Example (YAML Snippet) ```yaml ops: drop-database: type: execute stmt: | DROP DATABASE IF EXISTS TEMPLATE(database,baselines); create-table: execute: | CREATE TABLE IF NOT EXISTS TEMPLATE(database,baselines).TEMPLATE(table,keyvalue); select-table: query: | SELECT one, two, three FROM TEMPLATE(database,baselines).TEMPLATE(table,keyvalue) WHERE ...; insert-table: update: | UPDATE TABLE TEMPLATE(database,baselines).TEMPLATE(table,keyvalue) SET key = 'value' WHERE ...; ``` ### Response N/A (These are configuration examples for workload definition.) ``` -------------------------------- ### Detailed Op Template Example (YAML, JSON, Ops) Source: https://docs.nosqlbench.io/reference/workload_definition/04-op-template-basics Provides a comprehensive example of a detailed op template, including properties like name, operation statement, bindings, tags, parameters, and description. This is demonstrated across YAML, JSON, and the 'ops' format. ```yaml ops: op1: name: special-op-name op: select * from ks1.tb1; bindings: binding1: NumberNameToString(); tags: block: schema params: prepared: false description: This is just an example operation ``` ```json { "ops": { "op1": { "bindings": { "binding1": "NumberNameToString();" }, "description": "This is just an example operation", "name": "special-op-name", "op": "select * from ks1.tb1;", "params": { "prepared": false }, "tags": { "block": "schema" } } } } ``` ```json [ { "bindings": { "binding1": "NumberNameToString();" }, "description": "This is just an example operation", "name": "block0--special-op-name", "op": { "stmt": "select * from ks1.tb1;" }, "params": { "prepared": false }, "tags": { "block": "schema", "name": "block0--special-op-name", "block": "block0" } } ] ``` -------------------------------- ### Show Version Information Source: https://docs.nosqlbench.io/user-guide/cli-options Show version, long form, with artifact coordinates. This option displays detailed version information about the NoSQLBench installation. ```bash --version ``` -------------------------------- ### Executing JDBC Workload Source: https://docs.nosqlbench.io/reference/drivers This section provides an example of how to invoke a JDBC workload using the NoSQLBench command-line tool. It outlines the necessary parameters for the JDBC driver and other NoSQLBench engine parameters. ```APIDOC ## Executing JDBC Workload ### Description An example of invoking a JDBC workload using the NoSQLBench command-line tool, including driver-specific and engine parameters. ### Method Command Line Tool ### Endpoint N/A ### Parameters #### Command Line Arguments - **run** - The command to execute a workload. - **driver** (string) - Must be `jdbc`. Required. - **workload** (string) - Path to the workload YAML file. Required. - **cycles** (integer) - Number of cycles to run. Optional. Default depends on workload. - **threads** (integer) - Number of threads to use. Optional. Default depends on workload. - **url** (string) - URL of the database cluster. Default is `jdbc:postgresql://`. Optional. - **serverName** (string) - Hostname of the database server. Default is `localhost`. Optional. - **portNumber** (integer) - Port number of the database server. Default is `5432`. Optional. - **databaseName** (string) - Name of the database to connect to. Default is the user name. Optional. - **-vv** - Verbose logging flag. Optional. - **--show-stacktraces** - Flag to show stack traces on error. Optional. ### Request Example ```bash run driver=jdbc workload="/path/to/workload.yaml" cycles=1000 threads=100 url="jdbc:postgresql://" serverName=localhost portNumber=5432 databaseName=defaultdb ... -vv --show-stacktraces ``` ### Response N/A (This is a command-line execution example) ### Notes - `` can be `./nb` (binary) or `java -jar nb5.jar`. - The `threads` parameter determines the number of clients created, which share connections from the Hikari Connection Pool. ``` -------------------------------- ### Command Line Parameter Syntax Source: https://docs.nosqlbench.io/user-guide/core-activity-params Demonstrates the basic syntax for passing activity parameters as named arguments on the command line. Parameters are specified in a '=' format. ```bash ... = ... ``` -------------------------------- ### Error Handler Chain Configuration Example Source: https://docs.nosqlbench.io/user-guide/error-handlers This example demonstrates a handler chain with multiple error patterns and corresponding handler verbs. It shows how different error types can be handled distinctly, including ignoring specific errors, warning on others, and applying a default handler. ```yaml errors=Invalid.*:ignore;Runtime.*:warn,histogram;counter,42 ``` -------------------------------- ### Display Help Information (CLI) Source: https://docs.nosqlbench.io/user-guide The '--help' option displays general help information for the NoSQLBench CLI. Short options like '-v' increase verbosity, while long options like '--help' modify general behavior or provide more details. Un-dashed words are commands, and 'option=value' pairs are arguments to the preceding command. ```bash --help ``` -------------------------------- ### Define Multiple Named Scenario Steps (YAML) Source: https://docs.nosqlbench.io/reference/workload_definition/02-workload-structure This YAML example illustrates defining a scenario named 'default' with multiple, sequentially named steps ('step1', 'step2'). Each step executes a command with specific aliases and parameters. ```yaml scenarios: default: step1: run alias=first driver=diag cycles=10 step2: run alias=second driver=diag cycles=10 ``` -------------------------------- ### Get Milliseconds at Start of Year Source: https://docs.nosqlbench.io/reference/bindings/funcref-datetime Returns the epoch milliseconds representing the start of the year for a given epoch millisecond timestamp. The function supports specifying a timezone for accurate year-start calculation. ```Java long ToMillisAtStartOfYear(); long ToMillisAtStartOfYear(String timezoneId); ``` -------------------------------- ### Run MongoDB Activity with YAML Definition Source: https://docs.nosqlbench.io/reference/drivers/mongodb This example demonstrates how to execute a MongoDB activity using NoSQLBench, specifying the driver and a YAML file for activity definitions. It requires the `mongodb` driver and a valid YAML file path. ```bash nb5 driver=mongodb yaml=activities/mongo-basic.yaml ``` -------------------------------- ### Get Milliseconds at Start of Next Named Weekday Source: https://docs.nosqlbench.io/reference/bindings/funcref-datetime Determines the epoch milliseconds at the start of the next occurrence of a specified weekday, excluding the current day. The calculation can be localized to a specific timezone. ```Java long ToMillisAtStartOfNextNamedWeekDay(); long ToMillisAtStartOfNextNamedWeekDay(String weekday); long ToMillisAtStartOfNextNamedWeekDay(String weekday, String timezoneId); ``` -------------------------------- ### Get Milliseconds at Start of Named Weekday Source: https://docs.nosqlbench.io/reference/bindings/funcref-datetime Calculates the epoch milliseconds at the start of the most recent occurrence of a specified weekday, optionally considering a given timezone. It can include the current day if it matches the criteria. ```Java long ToMillisAtStartOfNamedWeekDay(); long ToMillisAtStartOfNamedWeekDay(String weekday); long ToMillisAtStartOfNamedWeekDay(String weekday, String timezoneId); ``` -------------------------------- ### Get Milliseconds at Start of Month Source: https://docs.nosqlbench.io/reference/bindings/funcref-datetime Returns the epoch milliseconds at the start of the month for a given epoch millisecond value. It supports timezone specification or defaults to UTC, useful for month-aligned time operations. ```Java long ToMillisAtStartOfMonth() long ToMillisAtStartOfMonth(String timezoneId) ``` -------------------------------- ### List Available Drivers (CLI) Source: https://docs.nosqlbench.io/user-guide The '--list-drivers' option is used to discover and list all available database drivers that NoSQLBench can utilize. ```bash --list-drivers ``` -------------------------------- ### Get Milliseconds at Start of Minute Source: https://docs.nosqlbench.io/reference/bindings/funcref-datetime Returns the epoch milliseconds at the start of the minute for a given epoch millisecond value. This function can use a specified timezone or default to UTC, facilitating minute-level time alignment. ```Java long ToMillisAtStartOfMinute() long ToMillisAtStartOfMinute(String timezoneId) ``` -------------------------------- ### Get Milliseconds at Start of Hour Source: https://docs.nosqlbench.io/reference/bindings/funcref-datetime Returns the epoch milliseconds at the start of the hour for a given epoch millisecond value. It allows for timezone specification or defaults to UTC, enabling precise hour-aligned time calculations. ```Java long ToMillisAtStartOfHour() long ToMillisAtStartOfHour(String timezoneId) ``` -------------------------------- ### List Available Scenarios (CLI) Source: https://docs.nosqlbench.io/user-guide Use the '--list-scenarios' option to retrieve a list of all predefined or custom scenarios available for execution within NoSQLBench. ```bash --list-scenarios ``` -------------------------------- ### Get Milliseconds at Start of Day Source: https://docs.nosqlbench.io/reference/bindings/funcref-datetime Returns the epoch milliseconds at the start of the day for a given epoch millisecond value. It supports specifying a timezone ID or defaults to UTC. This is useful for aligning time values to the beginning of a day. ```Java long ToMillisAtStartOfDay() long ToMillisAtStartOfDay(String timezoneId) ``` -------------------------------- ### Get Elapsed Nanoseconds with ElapsedNanoTime Source: https://docs.nosqlbench.io/reference/bindings/funcref-general ElapsedNanoTime returns the elapsed nanosecond time since the process started. Caution: This function does not produce deterministic test data. ```Java long ElapsedNanoTime() ``` -------------------------------- ### NoSQLBench Scenario Script Example Source: https://docs.nosqlbench.io/user-guide/cli-scripting This code snippet demonstrates a multi-line NoSQLBench scenario script. It shows how to chain commands using backslashes for readability, defining activities, wait times, and stop conditions. Each line represents a distinct command in the scenario. ```bash 1| ./nb5 \ ---|--- 2| start driver=stdout alias=a cycles=100K workload=cql-iot tags=block:main \ 3| start driver=stdout alias=b cycles=200K workload=cql-iot tags=block:main \ 4| waitmillis 10000 \ 5| await a \ 6| stop b ``` -------------------------------- ### Get Milliseconds at Start of Second Source: https://docs.nosqlbench.io/reference/bindings/funcref-datetime Calculates the epoch milliseconds corresponding to the beginning of the second for a given epoch millisecond timestamp. This operation can be performed with or without specifying a timezone. ```Java long ToMillisAtStartOfSecond(); long ToMillisAtStartOfSecond(String timezoneId); ``` -------------------------------- ### Cycles Configuration Source: https://docs.nosqlbench.io/user-guide/core-activity-params The `cycles` parameter defines the range of cycle counts for an activity. It can be a single count or a range (min..max), specifying the starting and ending point for operations. ```APIDOC ## cycles ### Description Determines the starting and ending point for an activity's cycles, defining the range of values used as seed values for each operation. ### Method Not Applicable (Configuration Parameter) ### Endpoint Not Applicable (Configuration Parameter) ### Parameters #### Query Parameters - **cycles** (string) - Optional - The cycle count or range. Can be a single count (e.g., `500`), a large number with suffix (e.g., `20M`), or a range (e.g., `2k..3k`). The range is a closed-open interval [min, max). ### Request Example ``` cycles=500 cycles=20M cycles=2k..3k ``` ### Response #### Success Response (200) Not Applicable (Configuration Parameter) #### Response Example Not Applicable (Configuration Parameter) ``` -------------------------------- ### Create CQL Keyspace and Table Source: https://docs.nosqlbench.io/getting-started/02-scenarios This snippet shows how to create a new keyspace named 'baselines' with simple replication and a 'keyvalue' table within it. The table has a text key and a text value. ```cql CREATE KEYSPACE baselines WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true; CREATE TABLE baselines.keyvalue ( key text PRIMARY KEY, value text ) ``` -------------------------------- ### Get Milliseconds at Start of Next Day Source: https://docs.nosqlbench.io/reference/bindings/funcref-datetime Returns the epoch milliseconds at the beginning of the day immediately following the day represented by the input epoch milliseconds. This function can also specify a timezone for the calculation. ```Java long ToMillisAtStartOfNextDay(); long ToMillisAtStartOfNextDay(String timezoneId); ``` -------------------------------- ### Copy Built-in Workload with nb5 CLI Source: https://docs.nosqlbench.io/workloads-101/00-designing-workloads Demonstrates how to copy a built-in NoSQLBench workload to a local directory using the nb5 command-line interface. This is useful for using existing workloads as a starting point for new designs. ```bash # find a workload you want to copy nb5 --list-workloads # copy a workload to your local directory nb5 --copy cql-iot ``` -------------------------------- ### Execute NoSQLBench Workload from Command Line Source: https://docs.nosqlbench.io/workloads-101/03-data-bindings This command executes the 'stdout-test' workload using the 'stdout' driver for 10 cycles. It demonstrates how to run a NoSQLBench workload and shows the expected output based on the defined statements and bindings. ```bash [test]$ ./nb5 run driver=stdout workload=stdout-test cycles=10 ``` -------------------------------- ### Workload Definition with Driver Configuration (YAML) Source: https://docs.nosqlbench.io/user-guide/core-activity-params An example of a workload definition in YAML format, specifying the 'stdout' driver and an operation template. This illustrates how to assign a driver to an op template within a workload file. ```yaml # file test.yaml ops: op1: op: driver: stdout stmt: "example {{Identity()}}" ``` -------------------------------- ### Define a Basic Op Template in NoSQLBench Source: https://docs.nosqlbench.io/workloads-101/07-more-op-templates This example shows a basic operation template structure in NoSQLBench. It defines an operation type 'GET' and specifies an identifier with a unique ID and group. This structure is fundamental for defining operations within NoSQLBench workloads. ```yaml ops: s1: type: GET ident: uid: 234 group: 2 ``` -------------------------------- ### Start and Stop Timers for Operations Source: https://docs.nosqlbench.io/user-guide/core-op-fields Instrument operations by starting and stopping named timers immediately before and after operations. These timers are started and stopped unconditionally, including failed operations. Measurements are aggregated across all threads for a given timer name. ```yaml ops: op1: op: "example stmt1" start-timers: stanza1, stanza2 op2: op: "example stmt2" stop-timers: stanza1 op3: op: "example stmt" stop-timers: stanza2 ``` -------------------------------- ### CSVSampler Example Usage Source: https://docs.nosqlbench.io/reference/bindings/funcref-general An example demonstrating how to use the CSVSampler function with specific column names and data sources. ```Java CSVSampler('USPS','n/a','name','census_state_abbrev') ``` -------------------------------- ### TCP Sessions and Client Instances Source: https://docs.nosqlbench.io/reference/drivers/http Explains how TCP sessions and native client instances are managed based on the 'space' binding. ```APIDOC ## TCP Sessions & Clients ### Description Details the management of TCP sessions and native HTTP client instances within NoSQLBench. ### Client Instantiation Client instances are created per unique `space` value. By default, the `space` is set to `default`, meaning all threads share a single HTTP client instance. ### Per-Thread Clients To create a new HTTP client instance per thread, configure the `space` binding as follows: - Using an op template parameter: `space: {space}` where `space` is bound to `ThreadNumToInteger()`. - Using an inline op field: `space: {(ThreadNumToInteger())}`. ### Binding Functions Any binding function can be used for the `space` op field. However, using functions like `Identity()` can lead to excessive client instantiation and should be avoided. ``` -------------------------------- ### Detailed Op Template Example with Bindings Source: https://docs.nosqlbench.io/user-guide/op-templates An example of a more detailed op template that utilizes bindings and blocks for defining operations. This structure allows for more complex configurations and reusability of defined bindings. ```yaml bindings: binding1: Combinations('a-z') blocks: warmup-block: ops: op1: op: prepared: "example {binding1} body" ``` -------------------------------- ### Specify Single-Op Workload via Command Line Source: https://docs.nosqlbench.io/index Illustrates how to define and execute a single-operation workload directly from the command line using the 'op="..."' parameter. This simplifies testing and utility usage. ```shell nb5 op="" ``` -------------------------------- ### Use Bindings with Stdout Activity Source: https://docs.nosqlbench.io/workloads-101/03-data-bindings This example demonstrates how to use the defined bindings with the stdout activity type in NoSQLBench. It shows a complete activity YAML configuration that includes the bindings section and illustrates how the stdout activity can construct a statement template from these bindings, outputting generated data in CSV format. ```yaml [test]$ cat > stdout-test.yaml bindings: alpha: Identity() beta: NumberNameToString() gamma: Combinations('0-9A-F;0-9;A-Z;_;p;r;o;') delta: WeightedStrings('one:1;six:6;three:3;') # EOF (control-D in your terminal) [test]$ ./nb5 run driver=stdout workload=stdout-test cycles=10 0,zero,00A_pro,six 1,one,00B_pro,six 2,two,00C_pro,three 3,three,00D_pro,three 4,four,00E_pro,six 5,five,00F_pro,six 6,six,00G_pro,six 7,seven,00H_pro,six 8,eight,00I_pro,six 9,nine,00J_pro,six ``` -------------------------------- ### Example Workload with Op Tags - NoSQLBench Source: https://docs.nosqlbench.io/workloads-101/05-op-tags An example of a workload configuration in YAML that includes Op Tags ('name: foxtrot', 'unit: bravo') and a simple statement. This serves as a basis for demonstrating tag filtering. ```yaml # stdout-test.yaml tags: name: foxtrot unit: bravo statements: - "I'm alive!\n" ``` -------------------------------- ### Run Mixed Read/Write Workload with NoSQLBench Source: https://docs.nosqlbench.io/getting-started/02-scenarios Executes a mixed read/write workload using the nb5 command-line tool. It specifies the driver, workload, tags for query blocks, number of cycles, cycle rate, and threads for concurrency. The output shows progress and completion status of the workload. ```bash ./nb5 run driver=cql workload=cql-keyvalue tags='block:main.*' \ cycles=50k cyclerate=5000 threads=50 --progress console:1s ... ``` -------------------------------- ### Execute a NoSQLBench Scenario Script Source: https://docs.nosqlbench.io/user-guide/advanced-topics/scenario-scripting This command executes a NoSQLBench scenario defined in a JavaScript file. It allows users to run custom testing configurations and leverage the full programmatic power of NoSQLBench. ```bash nb5 script myfile.js ```