activities.documents-api.http-docsapi-crud-dataset.yaml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of driver-http Show documentation
Show all versions of driver-http Show documentation
A HTTP nosqlbench ActivityType (AT) driver module;
This provides the ability to generate HTTP requests with nosqlbench
# nb -v run driver=http yaml=http-docsapi-crud-dataset tags=phase:schema stargate_host=my_stargate_host auth_token=$AUTH_TOKEN dataset_file=path/to/data.json
description: |
This workload emulates CRUD operations for the Stargate Documents API.
It requires a data set file, where each line is a single JSON document to be used for writes and updates.
Note that stargate_port should reflect the port where the Docs API is exposed (defaults to 8082).
scenarios:
default:
schema: run driver=http tags==phase:schema threads==1 cycles==UNDEF
write: run driver=http tags==phase:main,type:write cycles===TEMPLATE(write-cycles,TEMPLATE(docscount,10000000)) threads=auto errors=timer,warn
read: run driver=http tags==phase:main,type:read cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) threads=auto errors=timer,warn
update: run driver=http tags==phase:main,type:update cycles===TEMPLATE(update-cycles,TEMPLATE(docscount,10000000)) threads=auto errors=timer,warn
delete: run driver=http tags==phase:main,type:delete cycles===TEMPLATE(delete-cycles,TEMPLATE(docscount,10000000)) threads=auto errors=timer,warn
bindings:
# To enable an optional weighted set of hosts in place of a load balancer
# Examples
# single host: stargate_host=host1
# multiple hosts: stargate_host=host1,host2,host3
# multiple weighted hosts: stargate_host=host1:3,host2:7
weighted_hosts: WeightedStrings('<>')
# http request id
request_id: ToHashedUUID(); ToString();
seq_key: Mod(<>); ToString() -> String
random_key: Uniform(0,<>); ToString() -> String
blocks:
- tags:
phase: schema
statements:
- create-keyspace: POST <>://{weighted_hosts}:<><>/v2/schemas/keyspaces
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<>"
Content-Type: "application/json"
body: |
{
"name": "<>",
"replicas": <>
}
tags:
name: create-keyspace
- delete-docs-collection: DELETE <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<>"
tags:
name: delete-table
ok-status: "[2-4][0-9][0-9]"
- create-docs-collection: POST <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<>"
Content-Type: "application/json"
body: |
{
"name": "<>"
}
tags:
name: create-table
- name: main-write
tags:
phase: main
type: write
statements:
- write-document: PUT <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>/{seq_key}
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<>"
Content-Type: "application/json"
body: "{document_json}"
tags:
name: write-document
bindings:
document_json: ModuloLineToString('<>');
- name: main-read
tags:
phase: main
type: read
statements:
- read-document: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>/{random_key}
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<>"
ok-status: "[2-4][0-9][0-9]"
tags:
name: read-document
- name: main-update
tags:
phase: main
type: update
statements:
- update-document: PUT <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>/{random_key}
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<>"
Content-Type: "application/json"
body: "{document_json}"
tags:
name: update-document
bindings:
document_json: ModuloLineToString('<>');
- name: main-delete
tags:
phase: main
type: delete
statements:
- update-document: DELETE <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>/{seq_key}
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<>"
ok-status: "[2-4][0-9][0-9]"
tags:
name: delete-document
© 2015 - 2025 Weber Informatics LLC | Privacy Policy