mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
Schema and rampup phase working
This commit is contained in:
@@ -0,0 +1,172 @@
|
|||||||
|
# nb -v run driver=http yaml=http-docsapi-search-basic tags=phase:schema stargate_host=my_stargate_host auth_token=$AUTH_TOKEN
|
||||||
|
|
||||||
|
description: |
|
||||||
|
This workload emulates basic search operations for the Stargate Documents API.
|
||||||
|
During the rampup phase, it generates documents, writes them to a table, and then warms up the search paths.
|
||||||
|
During the main phase it performs various basic search filters and times their execution.
|
||||||
|
Note that stargate_port should reflect the port where the Docs API is exposed (defaults to 8082).
|
||||||
|
|
||||||
|
scenarios:
|
||||||
|
schema: run driver=http tags==phase:schema threads==<<threads:1>> cycles==UNDEF
|
||||||
|
rampup-write: run driver=http tags==phase:rampup-write cycles===TEMPLATE(docscount,10000000) docsize=TEMPLATE(docsize,15) match-ratio=TEMPLATE(match-ratio,0.01) threads=<<threads:auto>> errors=timer,warn
|
||||||
|
rampup-read: run driver=http tags==phase:rampup-read cycles===TEMPLATE(rampup-cycles, 10000000) page-size=TEMPLATE(page-size,3) threads=<<threads:auto>> errors=timer,warn
|
||||||
|
read-eq: run driver=http tags==phase:main,type:write cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields, UNSET) threads=auto errors=timer,warn
|
||||||
|
# read-lt: run driver=http tags==phase:main,type:read cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) match-ratio=TEMPLATE(match-ratio,0.01) fields=TEMPLATE(fields, UNSET) threads=auto errors=timer,warn
|
||||||
|
# read-and: run driver=http tags==phase:main,type:read cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) match-ratio=TEMPLATE(match-ratio,0.01) fields=TEMPLATE(fields, UNSET) threads=auto errors=timer,warn
|
||||||
|
# read-or: run driver=http tags==phase:main,type:read cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) match-ratio=TEMPLATE(match-ratio,0.01) fields=TEMPLATE(fields, UNSET) 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('<<stargate_host:stargate>>')
|
||||||
|
# http request id
|
||||||
|
request_id: ToHashedUUID(); ToString();
|
||||||
|
|
||||||
|
seq_key: Mod(<<docscount:10000000>>); ToString() -> String
|
||||||
|
random_key: Uniform(0,<<docscount:10000000>>); ToString() -> String
|
||||||
|
|
||||||
|
user_id: ToHashedUUID(); ToString() -> String
|
||||||
|
created_on: Uniform(1262304000,1577836800) -> long
|
||||||
|
gender: WeightedStrings('M:10;F:10;O:1')
|
||||||
|
full_name: FullNames()
|
||||||
|
married: ModuloToBoolean()
|
||||||
|
city: Cities()
|
||||||
|
country_code: CountryCodes()
|
||||||
|
lat: Uniform(-180d, 180d)
|
||||||
|
lng: Hash() -> long; Uniform(-180d, 180d)
|
||||||
|
friend_id: Add(-1); ToHashedUUID(); ToString() -> String
|
||||||
|
|
||||||
|
match1: Expr('if (cycle % (int)(1 / <<match-ratio>>) == 0) { return 0; } return (int)(Math.random() * 10000 + 1000);') -> long
|
||||||
|
match2: Expr('if (cycle % (int)(1 / <<match-ratio>>) == 0) { return "match" } return "no match";') -> String
|
||||||
|
additional_fields: Expr('str="";for (int i=0; i < TEMPLATE(docsize,15) - 15; i++) { if (str == "") { str = "," }; str+="\"value"+i+"\":0"; if (i < TEMPLATE(docsize,15) - 16) {str += ","}} return str;') -> String
|
||||||
|
|
||||||
|
blocks:
|
||||||
|
- tags:
|
||||||
|
phase: schema
|
||||||
|
statements:
|
||||||
|
- create-keyspace: POST <<protocol:http>>://{weighted_hosts}:<<stargate_port:8082>><<path_prefix:>>/v2/schemas/keyspaces
|
||||||
|
Accept: "application/json"
|
||||||
|
X-Cassandra-Request-Id: "{request_id}"
|
||||||
|
X-Cassandra-Token: "<<auth_token:my_auth_token>>"
|
||||||
|
Content-Type: "application/json"
|
||||||
|
body: |
|
||||||
|
{
|
||||||
|
"name": "<<keyspace:docs_search_basic>>",
|
||||||
|
"replicas": <<rf:1>>
|
||||||
|
}
|
||||||
|
tags:
|
||||||
|
name: create-keyspace
|
||||||
|
|
||||||
|
- delete-docs-collection: DELETE <<protocol:http>>://{weighted_hosts}:<<stargate_port:8082>><<path_prefix:>>/v2/namespaces/<<keyspace:docs_search_basic>>/collections/<<table:docs_collection>>
|
||||||
|
Accept: "application/json"
|
||||||
|
X-Cassandra-Request-Id: "{request_id}"
|
||||||
|
X-Cassandra-Token: "<<auth_token:my_auth_token>>"
|
||||||
|
tags:
|
||||||
|
name: delete-table
|
||||||
|
ok-status: "[2-4][0-9][0-9]"
|
||||||
|
|
||||||
|
- create-docs-collection: POST <<protocol:http>>://{weighted_hosts}:<<stargate_port:8082>><<path_prefix:>>/v2/namespaces/<<keyspace:docs_search_basic>>/collections
|
||||||
|
Accept: "application/json"
|
||||||
|
X-Cassandra-Request-Id: "{request_id}"
|
||||||
|
X-Cassandra-Token: "<<auth_token:my_auth_token>>"
|
||||||
|
Content-Type: "application/json"
|
||||||
|
body: |
|
||||||
|
{
|
||||||
|
"name": "<<table:docs_collection>>"
|
||||||
|
}
|
||||||
|
tags:
|
||||||
|
name: create-table
|
||||||
|
|
||||||
|
- name: rampup-write
|
||||||
|
tags:
|
||||||
|
phase: rampup-write
|
||||||
|
statements:
|
||||||
|
- rampup-insert: PUT <<protocol:http>>://{weighted_hosts}:<<stargate_port:8082>><<path_prefix:>>/v2/namespaces/<<keyspace:docs_search_basic>>/collections/<<table:docs_collection>>/{seq_key}
|
||||||
|
Accept: "application/json"
|
||||||
|
X-Cassandra-Request-Id: "{request_id}"
|
||||||
|
X-Cassandra-Token: "<<auth_token:my_auth_token>>"
|
||||||
|
Content-Type: "application/json"
|
||||||
|
body: |
|
||||||
|
{
|
||||||
|
"user_id": "{user_id}",
|
||||||
|
"created_on": {created_on},
|
||||||
|
"gender": "{gender}",
|
||||||
|
"full_name": "{full_name}",
|
||||||
|
"married": {married},
|
||||||
|
"address": {
|
||||||
|
"primary": {
|
||||||
|
"city": "{city}",
|
||||||
|
"cc": "{country_code}"
|
||||||
|
},
|
||||||
|
"secondary": {}
|
||||||
|
},
|
||||||
|
"coordinates": [
|
||||||
|
{lat},
|
||||||
|
{lng}
|
||||||
|
],
|
||||||
|
"children": [],
|
||||||
|
"friends": [
|
||||||
|
"{friend_id}"
|
||||||
|
],
|
||||||
|
"debt": null,
|
||||||
|
"match1": {match1},
|
||||||
|
"match2": "{match2}"
|
||||||
|
{additional_fields}
|
||||||
|
}
|
||||||
|
tags:
|
||||||
|
name: rampup-insert
|
||||||
|
|
||||||
|
- name: rampup-eq
|
||||||
|
tags:
|
||||||
|
phase: rampup-read
|
||||||
|
filter: eq
|
||||||
|
statements:
|
||||||
|
- rampup-eq: GET <<protocol:http>>://{weighted_hosts}:<<stargate_port:8082>><<path_prefix:>>/v2/namespaces/<<keyspace:docs_search_basic>>/collections/<<table:docs_collection>>?where=%7B%22match1%22%3A%7B%22%24eq%22%3A0%7D%7D&page-size=<<page-size,3>>
|
||||||
|
Accept: "application/json"
|
||||||
|
X-Cassandra-Request-Id: "{request_id}"
|
||||||
|
X-Cassandra-Token: "<<auth_token:my_auth_token>>"
|
||||||
|
Content-Type: "application/json"
|
||||||
|
tags:
|
||||||
|
name: rampup-eq
|
||||||
|
|
||||||
|
- name: rampup-lt
|
||||||
|
tags:
|
||||||
|
phase: rampup-read
|
||||||
|
filter: lt
|
||||||
|
statements:
|
||||||
|
- rampup-lt: GET <<protocol:http>>://{weighted_hosts}:<<stargate_port:8082>><<path_prefix:>>/v2/namespaces/<<keyspace:docs_search_basic>>/collections/<<table:docs_collection>>?where=%7B%22match1%22%3A%7B%22%24eq%22%3A1%7D%7D&page-size=<<page-size,3>>
|
||||||
|
Accept: "application/json"
|
||||||
|
X-Cassandra-Request-Id: "{request_id}"
|
||||||
|
X-Cassandra-Token: "<<auth_token:my_auth_token>>"
|
||||||
|
Content-Type: "application/json"
|
||||||
|
tags:
|
||||||
|
name: rampup-lt
|
||||||
|
|
||||||
|
- name: rampup-and
|
||||||
|
tags:
|
||||||
|
phase: rampup-read
|
||||||
|
filter: and
|
||||||
|
statements:
|
||||||
|
- rampup-and: GET <<protocol:http>>://{weighted_hosts}:<<stargate_port:8082>><<path_prefix:>>/v2/namespaces/<<keyspace:docs_search_basic>>/collections/<<table:docs_collection>>?where=%7B%22match1%22%3A%7B%22%24lt%22%3A1%7D%2C%22match2%22%3A%7B%22%24eq%22%3A%22match%22%7D%7D&page-size=<<page-size,3>>
|
||||||
|
Accept: "application/json"
|
||||||
|
X-Cassandra-Request-Id: "{request_id}"
|
||||||
|
X-Cassandra-Token: "<<auth_token:my_auth_token>>"
|
||||||
|
Content-Type: "application/json"
|
||||||
|
tags:
|
||||||
|
name: rampup-and
|
||||||
|
|
||||||
|
- name: rampup-or
|
||||||
|
tags:
|
||||||
|
phase: rampup-read
|
||||||
|
filter: or
|
||||||
|
statements:
|
||||||
|
- rampup-or: GET <<protocol:http>>://{weighted_hosts}:<<stargate_port:8082>><<path_prefix:>>/v2/namespaces/<<keyspace:docs_search_basic>>/collections/<<table:docs_collection>>?where=%7B%22%24or%22%3A%5B%7B%22match1%22%3A%7B%22%24lt%22%3A1%7D%7D%2C%7B%22match2%22%3A%7B%22%24eq%22%3A%22match%22%7D%7D%5D%7D&page-size=<<page-size,3>>
|
||||||
|
Accept: "application/json"
|
||||||
|
X-Cassandra-Request-Id: "{request_id}"
|
||||||
|
X-Cassandra-Token: "<<auth_token:my_auth_token>>"
|
||||||
|
Content-Type: "application/json"
|
||||||
|
tags:
|
||||||
|
name: rampup-or
|
||||||
Reference in New Issue
Block a user