Token management (#1201)

* http-rest-starter w/ Stargate data gateway
* Token management w/ Token() binding function
* Expansion of Token usage to scenarios
* Version requirements updated for http-rest scenarios
This commit is contained in:
Jeff Banks 2023-04-13 13:57:20 -05:00 committed by GitHub
parent 8fef3f4b88
commit 11613268a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 668 additions and 522 deletions

View File

@ -1,6 +1,6 @@
min_version: "5.17.1" min_version: "5.17.3"
description: | description: >2
This workload emulates a key-value data model and access patterns. This workload emulates a key-value data model and access patterns.
This should be identical to the cql variant except for: This should be identical to the cql variant except for:
- There is no instrumentation with the http driver. - There is no instrumentation with the http driver.
@ -15,9 +15,9 @@ scenarios:
bindings: bindings:
weighted_hosts: ToString(); WeightedStrings('<<restapi_host:stargate>>'); ToString(); weighted_hosts: ToString(); WeightedStrings('<<stargate_host:stargate>>'); ToString();
request_id: ToHashedUUID(); ToString(); request_id: ToHashedUUID(); ToString();
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString(); token: Discard(); Token('<<auth_token:>>','<<auth_uri:http://localhost:8081/v1/auth>>', '<<auth_uid:cassandra>>', '<<auth_pswd:cassandra>>');
seq_key: Mod(<<keycount:10000000>>); ToString() -> String seq_key: Mod(<<keycount:10000000>>); ToString() -> String
seq_value: Hash(); Mod(<<valuecount:1000000000>>); ToString() -> String seq_value: Hash(); Mod(<<valuecount:1000000000>>); ToString() -> String
@ -33,7 +33,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -45,7 +45,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables/<<table:keyvalue>> uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables/<<table:keyvalue>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
ok-status: "[2-4][0-9][0-9]" ok-status: "[2-4][0-9][0-9]"
@ -54,7 +54,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -84,7 +84,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -113,7 +113,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:keyvalue>> uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:keyvalue>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -130,7 +130,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:keyvalue>>/{rw_key} uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:keyvalue>>/{rw_key}
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
ok-status: "[2-4][0-9][0-9]" ok-status: "[2-4][0-9][0-9]"
@ -143,7 +143,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:keyvalue>> uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:keyvalue>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {

View File

@ -0,0 +1,123 @@
min_version: "5.17.3"
description: |
This starter workload uses an open source data gateway called Stargate,
which works with a simple key-value data model.
1. Create a keyspace.
2. Drop table if existing.
3. Create table
scenarios:
default:
schema: run driver=http tags==block:"schema.*" threads==1 cycles==UNDEF
rampup: run driver=http tags==block:"rampup.*" cycles===10 threads=auto
main: run driver=http tags==block:"main.*" cycles===10 threads=auto
bindings:
request_id: ToHashedUUID(); ToString();
token: Discard(); Token('<<auth_token:>>','<<auth_uri:http://localhost:8081/v1/auth>>', '<<auth_uid:cassandra>>', '<<auth_pswd:cassandra>>');
seq_key: Mod(10000000); ToString() -> String
seq_value: Hash(); Mod(1000000000); ToString() -> String
rw_key: Uniform(0,10000000)->int; ToString() -> String
rw_value: Hash(); Uniform(0,1000000000)->int; ToString() -> String
blocks:
schema:
ops:
create-keyspace:
method: POST
uri: http://<<stargate_host>>:8082/v2/schemas/keyspaces
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "{token}"
Content-Type: "application/json"
body: >2
{
"name": "starter",
"replicas": 1
}
drop-table:
method: DELETE
uri: http://<<stargate_host>>:8082/v2/schemas/keyspaces/starter/tables/http_rest_starter
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "{token}"
Content-Type: "application/json"
ok-status: "[2-4][0-9][0-9]"
create-table:
method: POST
uri: http://<<stargate_host>>:8082/v2/schemas/keyspaces/starter/tables
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "{token}"
Content-Type: "application/json"
body: >2
{
"name": "http_rest_starter",
"columnDefinitions": [
{
"name": "key",
"typeDefinition": "text"
},
{
"name": "value",
"typeDefinition": "text"
}
],
"primaryKey": {
"partitionKey": [
"key"
]
},
"ifNotExists": true
}
rampup:
ops:
rampup-insert:
method: POST
uri: http://<<stargate_host>>:8082/v2/keyspaces/starter/http_rest_starter
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "{token}"
Content-Type: "application/json"
body: >2
{
"key": "{seq_key}",
"value": "{seq_value}"
}
main-read:
params:
ratio: 5
ops:
main-select:
method: GET
uri: http://<<stargate_host>>:8082/v2/keyspaces/starter/http_rest_starter/{rw_key}
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "{token}"
Content-Type: "application/json"
ok-status: "[2-4][0-9][0-9]"
main-write:
params:
ratio: 5
ops:
main-write:
method: POST
uri: http://<<stargate_host>>:8082/v2/keyspaces/starter/http_rest_starter
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "{token}"
Content-Type: "application/json"
body: >2
{
"key": "{rw_key}",
"value": "{rw_value}"
}

View File

@ -1,4 +1,4 @@
min_version: "5.17.1" min_version: "5.17.3"
description: | description: |
This workload emulates a tabular workload with partitions, clusters, and data fields. This workload emulates a tabular workload with partitions, clusters, and data fields.
@ -15,9 +15,9 @@ scenarios:
main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,10) threads=auto main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,10) threads=auto
bindings: bindings:
weighted_hosts: WeightedStrings('<<restapi_host:stargate>>') weighted_hosts: WeightedStrings('<<stargate_host:stargate>>')
request_id: ToHashedUUID(); ToString(); request_id: ToHashedUUID(); ToString();
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString(); token: Discard(); Token('<<auth_token:>>','<<auth_uri:http://localhost:8081/v1/auth>>', '<<auth_uid:cassandra>>', '<<auth_pswd:cassandra>>');
# for ramp-up and verify # for ramp-up and verify
part_layout: Div(<<partsize:1000000>>); ToString() -> String part_layout: Div(<<partsize:1000000>>); ToString() -> String
@ -42,7 +42,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -55,7 +55,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables/<<table:tabular>> uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables/<<table:tabular>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
ok-status: "[2-4][0-9][0-9]" ok-status: "[2-4][0-9][0-9]"
@ -64,7 +64,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -101,7 +101,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:tabular>> uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:tabular>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -119,7 +119,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:tabular>>/{part_read}&page-size={limit} uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:tabular>>/{part_read}&page-size={limit}
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
main-write: main-write:
@ -131,7 +131,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:tabular>> uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:tabular>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {

View File

@ -1,6 +1,6 @@
min_version: "5.17.1" min_version: "5.17.3"
description: | description: >2
NOTE: THIS VERSION IS NOT FUNCTIONING FULLY AND HAS AN OPEN TICKET TO INVESTIGATE: NOTE: THIS VERSION IS NOT FUNCTIONING FULLY AND HAS AN OPEN TICKET TO INVESTIGATE:
See here: https://github.com/nosqlbench/nosqlbench/issues/1148 See here: https://github.com/nosqlbench/nosqlbench/issues/1148
@ -17,14 +17,13 @@ description: |
scenarios: scenarios:
default: default:
schema: run driver=http tags==block:"schema.*" threads==1 cycles==UNDEF schema: run driver=http tags==block:"schema.*" threads==1 cycles==UNDEF
rampup: run driver=http tags==block:"rampup.*" cycles===TEMPLATE(rampup-cycles,1) threads=auto rampup: run driver=http tags==block:"rampup.*" cycles===TEMPLATE(rampup-cycles,3) threads=auto
main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,10) threads=auto main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,10) threads=auto
bindings: bindings:
weighted_hosts: WeightedStrings('<<restapi_host:stargate>>') weighted_hosts: WeightedStrings('<<stargate_host:stargate>>')
request_id: ToHashedUUID(); ToString(); request_id: ToHashedUUID(); ToString();
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString(); token: Discard(); Token('<<auth_token:>>', '<<auth_uri:http://localhost:8081/v1/auth>>', '<<auth_uid:cassandra>>', '<<auth_pswd:cassandra>>');
machine_id: Mod(<<sources:10000>>); ToHashedUUID() -> java.util.UUID machine_id: Mod(<<sources:10000>>); ToHashedUUID() -> java.util.UUID
sensor_name: HashedLineToString('data/variable_words.txt'); sensor_name: HashedLineToString('data/variable_words.txt');
time: Mul(<<timespeed:100>>L); Div(<<sources:10000>>L); StringDateWrapper("yyyy-MM-dd'T'hh:mm:ss'Z"); time: Mul(<<timespeed:100>>L); Div(<<sources:10000>>L); StringDateWrapper("yyyy-MM-dd'T'hh:mm:ss'Z");
@ -40,7 +39,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:iot>> uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:iot>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -51,6 +50,7 @@ blocks:
"station_id": "{station_id}", "station_id": "{station_id}",
"data": "{data}" "data": "{data}"
} }
schema: schema:
ops: ops:
create-keyspace: create-keyspace:
@ -58,7 +58,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -71,7 +71,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables/<<table:iot>> uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables/<<table:iot>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
ok-status: "[2-4][0-9][0-9]" ok-status: "[2-4][0-9][0-9]"
@ -80,12 +80,12 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
"name": "<<table:iot>>", "name": "<<table:iot>>",
"columnDefinitions": |- "columnDefinitions":
[ [
{ {
"name": "machine_id", "name": "machine_id",
@ -112,21 +112,21 @@ blocks:
"typeDefinition": "text" "typeDefinition": "text"
} }
], ],
"primaryKey": |- "primaryKey":
{ {
"partitionKey": |- "partitionKey":
[ [
"machine_id", "machine_id",
"sensor_name" "sensor_name"
], ],
"clusteringKey": |- "clusteringKey":
[ [
"time" "time"
] ]
}, },
"tableOptions": |- "tableOptions":
{ {
"clusteringExpression": |- "clusteringExpression":
[ [
{ {
"column": "time", "column": "time",
@ -146,7 +146,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:iot>>?where=URLENCODE[[{"machine_id":{"$eq":"{machine_id}"},"sensor_name":{"$eq":"{sensor_name}"}}]]&page-size=<<limit:10>> uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:iot>>?where=URLENCODE[[{"machine_id":{"$eq":"{machine_id}"},"sensor_name":{"$eq":"{sensor_name}"}}]]&page-size=<<limit:10>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
main-write: main-write:
@ -158,7 +158,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:iot>> uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:iot>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {

View File

@ -16,13 +16,15 @@ Currently supporting Stargate, with plans to make more generic where REST tokens
can be commented out. Otherwise, the default automatic token generation is used. can be commented out. Otherwise, the default automatic token generation is used.
### auto_gen_token ### auto_gen_token
Use the `StargateToken('url')` unary string binding function, which auto-generates, caches, and returns a token with automatic refresh upon expiry. Use the `Token('<<auth_token:>>','<<auth_uri:http://localhost:8081/v1/auth>>', '<<auth_uid:cassandra>>', '<<auth_pswd:cassandra>>');` string binding function, which auto-generates, caches, and returns a token with automatic refresh upon expiry.
When the `auth_token` is provided only that token value will be used (i.e. not auto-generated) and the rest of the passed in values for uri, uid, and pswd are ignored.
### Example ### Example using all defaults.
* auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); token=Discard(); Token('<<auth_token:>>','<<auth_uri:http://localhost:8081/v1/auth>>', '<<auth_uid:cassandra>>', '<<auth_pswd:cassandra>>');
Here `Discard()` will ignore the long input value received (by default for the binding), then the StargateToken function automates a check for a cached Stargate token. Here `Discard()` will ignore the long input value received (by default for the binding), then the Token function automates a check for a cached tokens from the endpoint provided.
If not already discovered, a request to the local running Stargate service will be invoked. Each subsequent cycles utilizes the cached value until a timeout occurs or the workload is restarted. If not already discovered, a request to the local running token service will be invoked.
Each subsequent cycles utilizes the cached value until a timeout occurs (default 30m) or the workload is restarted.
Regardless of the option used, both will be considered to determine the value for the following: Regardless of the option used, both will be considered to determine the value for the following:
```yaml ```yaml

View File

@ -1,6 +1,6 @@
min_version: "5.17.1" min_version: "5.17.3"
description: | description: >2
This workload emulates CRUD operations for the Stargate Documents API. This workload emulates CRUD operations for the Stargate Documents API.
It generates a simple JSON document to be used for writes and updates. It generates a simple JSON document to be used for writes and updates.
Note that docsapi_port should reflect the port where the Docs API is exposed (defaults to 8180). Note that docsapi_port should reflect the port where the Docs API is exposed (defaults to 8180).
@ -22,7 +22,7 @@ bindings:
weighted_hosts: WeightedStrings('<<docsapi_host:stargate>>') weighted_hosts: WeightedStrings('<<docsapi_host:stargate>>')
# http request id # http request id
request_id: ToHashedUUID(); ToString(); request_id: ToHashedUUID(); ToString();
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString(); token: Discard(); Token('<<auth_token:>>','<<auth_uri:http://localhost:8081/v1/auth>>', '<<auth_uid:cassandra>>', '<<auth_pswd:cassandra>>');
seq_key: Mod(<<docscount:10000000>>); ToString() -> String seq_key: Mod(<<docscount:10000000>>); ToString() -> String
random_key: Uniform(0,<<docscount:10000000>>); ToString() -> String random_key: Uniform(0,<<docscount:10000000>>); ToString() -> String
@ -46,7 +46,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/schemas/namespaces uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/schemas/namespaces
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -60,7 +60,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_basic>>/collections/<<collection:docs_collection>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_basic>>/collections/<<collection:docs_collection>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
ok-status: "[2-4][0-9][0-9]" ok-status: "[2-4][0-9][0-9]"
create-docs-collection: create-docs-collection:
@ -68,7 +68,7 @@ blocks:
method: POST method: POST
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -82,7 +82,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_basic>>/collections/<<collection:docs_collection>>/{seq_key} uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_basic>>/collections/<<collection:docs_collection>>/{seq_key}
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -116,7 +116,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_basic>>/collections/<<collection:docs_collection>>/{random_key} uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_basic>>/collections/<<collection:docs_collection>>/{random_key}
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
ok-status: "[2-4][0-9][0-9]" ok-status: "[2-4][0-9][0-9]"
update: update:
@ -126,7 +126,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_basic>>/collections/<<collection:docs_collection>>/{random_key} uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_basic>>/collections/<<collection:docs_collection>>/{random_key}
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -159,5 +159,5 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_basic>>/collections/<<collection:docs_collection>>/{seq_key} uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_basic>>/collections/<<collection:docs_collection>>/{seq_key}
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
ok-status: "[2-4][0-9][0-9]" ok-status: "[2-4][0-9][0-9]"

View File

@ -1,4 +1,4 @@
min_version: "5.17.1" min_version: "5.17.3"
description: | description: |
This workload emulates CRUD operations for the Stargate Documents API. This workload emulates CRUD operations for the Stargate Documents API.
@ -9,21 +9,12 @@ scenarios:
default: default:
schema: run driver=http tags==block:"schema.*" threads==1 cycles==UNDEF schema: run driver=http tags==block:"schema.*" threads==1 cycles==UNDEF
main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,TEMPLATE(docscount,10)) threads=auto errors=timer,warn main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,TEMPLATE(docscount,10)) threads=auto errors=timer,warn
# write: run driver=http tags==block:"write.*" cycles===TEMPLATE(write-cycles,TEMPLATE(docscount,10)) threads=auto errors=timer,warn
# read: run driver=http tags==block:"read.*" cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10)) threads=auto errors=timer,warn
# update: run driver=http tags==block:"update.*" cycles===TEMPLATE(update-cycles,TEMPLATE(docscount,10)) threads=auto errors=timer,warn
# delete: run driver=http tags==block:"delete.*" cycles===TEMPLATE(delete-cycles,TEMPLATE(docscount,10)) threads=auto errors=timer,warn
bindings: bindings:
# To enable an optional weighted set of hosts in place of a load balancer
# Examples
# single host: docsapi_host=host1
# multiple hosts: docsapi_host=host1,host2,host3
# multiple weighted hosts: docsapi_host=host1:3,host2:7
weighted_hosts: WeightedStrings('<<docsapi_host:stargate>>') weighted_hosts: WeightedStrings('<<docsapi_host:stargate>>')
# http request id # http request id
request_id: ToHashedUUID(); ToString(); request_id: ToHashedUUID(); ToString();
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString(); token: Discard(); Token('<<auth_token:>>','<<auth_uri:http://localhost:8081/v1/auth>>', '<<auth_uid:cassandra>>', '<<auth_pswd:cassandra>>');
seq_key: Mod(<<docscount:10000000>>); ToString() -> String seq_key: Mod(<<docscount:10000000>>); ToString() -> String
random_key: Uniform(0,<<docscount:10000000>>); ToString() -> String random_key: Uniform(0,<<docscount:10000000>>); ToString() -> String
@ -37,7 +28,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/schemas/namespaces uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/schemas/namespaces
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -51,7 +42,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_dataset>>/collections/<<collection:docs_collection>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_dataset>>/collections/<<collection:docs_collection>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
ok-status: "[2-4][0-9][0-9]" ok-status: "[2-4][0-9][0-9]"
create-docs-collection: create-docs-collection:
@ -59,7 +50,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_dataset>>/collections uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_dataset>>/collections
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -72,7 +63,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_dataset>>/collections/<<collection:docs_collection>>/{seq_key} uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_dataset>>/collections/<<collection:docs_collection>>/{seq_key}
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: "{document_json}" body: "{document_json}"
@ -81,7 +72,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_dataset>>/collections/<<collection:docs_collection>>/{random_key} uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_dataset>>/collections/<<collection:docs_collection>>/{random_key}
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
ok-status: "[2-4][0-9][0-9]" ok-status: "[2-4][0-9][0-9]"
# TODO - what is the purpose of this? does it overwrite? is there a way to make sure it is actually overwriting existing documents? # TODO - what is the purpose of this? does it overwrite? is there a way to make sure it is actually overwriting existing documents?
@ -90,7 +81,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_dataset>>/collections/<<collection:docs_collection>>/{random_key} uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_dataset>>/collections/<<collection:docs_collection>>/{random_key}
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: "{document_json}" body: "{document_json}"
@ -99,5 +90,5 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_dataset>>/collections/<<collection:docs_collection>>/{seq_key} uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_dataset>>/collections/<<collection:docs_collection>>/{seq_key}
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
ok-status: "[2-4][0-9][0-9]" ok-status: "[2-4][0-9][0-9]"

View File

@ -1,4 +1,4 @@
min_version: "5.17.1" min_version: "5.17.3"
description: | description: |
This workload emulates a key-value data model and access patterns. This workload emulates a key-value data model and access patterns.
@ -11,21 +11,13 @@ description: |
scenarios: scenarios:
default: default:
schema: run driver=http tags==block:"schema.*" threads==1 cycles==UNDEF schema: run driver=http tags==block:"schema.*" threads==1 cycles==UNDEF
rampup: run driver=http tags==block:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto rampup: run driver=http tags==block:rampup cycles===TEMPLATE(rampup-cycles,3) threads=auto
main: run driver=http tags==block:main cycles===TEMPLATE(main-cycles,10000000) threads=auto main: run driver=http tags==block:main cycles===TEMPLATE(main-cycles,10) threads=auto
bindings: bindings:
# To enable an optional weighted set of hosts in place of a load balancer
# Examples
# single host: docsapi_host=host1
# multiple hosts: docsapi_host=host1,host2,host3
# multiple weighted hosts: docsapi_host=host1:3,host2:7
weighted_hosts: WeightedStrings('<<docsapi_host:stargate>>') weighted_hosts: WeightedStrings('<<docsapi_host:stargate>>')
# http request id
request_id: ToHashedUUID(); ToString(); request_id: ToHashedUUID(); ToString();
token: Discard(); Token('<<auth_token:>>','<<auth_uri:http://localhost:8081/v1/auth>>', '<<auth_uid:cassandra>>', '<<auth_pswd:cassandra>>');
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString();
seq_key: Mod(<<keycount:10000000>>); ToString() -> String seq_key: Mod(<<keycount:10000000>>); ToString() -> String
seq_value: Hash(); Mod(<<valuecount:10000000>>); ToString() -> String seq_value: Hash(); Mod(<<valuecount:10000000>>); ToString() -> String
rw_key: <<keydist:Uniform(0,<<keycount:10000000>>)->int>>; ToString() -> String rw_key: <<keydist:Uniform(0,<<keycount:10000000>>)->int>>; ToString() -> String
@ -39,7 +31,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/schemas/namespaces uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/schemas/namespaces
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -53,7 +45,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_keyvalue>>/collections/<<collection:docs_collection>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_keyvalue>>/collections/<<collection:docs_collection>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
ok-status: "[2-4][0-9][0-9]" ok-status: "[2-4][0-9][0-9]"
create-docs-collection: create-docs-collection:
@ -61,7 +53,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_keyvalue>>/collections uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_keyvalue>>/collections
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -75,7 +67,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_keyvalue>>/collections/<<collection:docs_collection>>/{seq_key} uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_keyvalue>>/collections/<<collection:docs_collection>>/{seq_key}
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -91,7 +83,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_keyvalue>>/collections/<<collection:docs_collection>>/{rw_key} uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_keyvalue>>/collections/<<collection:docs_collection>>/{rw_key}
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
ok-status: "[2-4][0-9][0-9]" ok-status: "[2-4][0-9][0-9]"
main-write: main-write:
@ -99,10 +91,9 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_keyvalue>>/collections/<<collection:docs_collection>>/{rw_key} uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_keyvalue>>/collections/<<collection:docs_collection>>/{rw_key}
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
"{rw_key}":"{rw_value}" "{rw_key}":"{rw_value}"
} }

View File

@ -1,6 +1,6 @@
min_version: "5.17.1" min_version: "5.17.3"
description: | description: >2
This workload emulates advanced search filter combinations for the Stargate Documents API. This workload emulates advanced search filter combinations for the Stargate Documents API.
During the rampup phase, it generates documents, writes them to a collection, and then warms up the search paths. During the rampup phase, it generates documents, writes them to a collection, and then warms up the search paths.
During the main phase it performs various basic search filters and times their execution. During the main phase it performs various basic search filters and times their execution.
@ -16,27 +16,41 @@ description: |
# complex3: (match1 LTE 0 AND match2 EQ "true") OR (match2 EQ "false" AND match3 EQ true) # complex3: (match1 LTE 0 AND match2 EQ "true") OR (match2 EQ "false" AND match3 EQ true)
scenarios: scenarios:
schema: run driver=http tags==block:"schema.*" threads==<<threads:1>> cycles==UNDEF schema: run driver=http tags==block:"schema.*" threads==<<threads:1>> cycles==UNDEF
rampup:
write: run driver=http tags==block:"rampup-put.*" cycles===TEMPLATE(docscount,10) docpadding=TEMPLATE(docpadding,0) match-ratio=TEMPLATE(match-ratio,0.01) threads=<<threads:auto>> errors=timer,warn rampup-write: >-
read: run driver=http tags==block:"rampup-get.*" cycles===TEMPLATE(rampup-cycles, 10) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn run driver=http tags==block:"rampup-put.*" cycles===TEMPLATE(docscount,10) docpadding=TEMPLATE(docpadding,0)
main: match-ratio=TEMPLATE(match-ratio,0.01) threads=<<threads:auto>> errors=timer,warn
all: run driver=http tags==block:"main.*" cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn rampup-read: >-
get-in: run driver=http tags==block:main-get-in,filter:in cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn run driver=http tags==block:"rampup-get.*" cycles===TEMPLATE(rampup-cycles,10) page-size=TEMPLATE(page-size,3)
get-not-in: run driver=http tags==block:main-get-not-in cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn
get-mem-and: run driver=http tags==block:main-get-mem-and cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn
get-mem-or: run driver=http tags==block:main-get-mem-or cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn main-all: >-
get-complex1: run driver=http tags==block:main-get-complex1 cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn run driver=http tags==block:"main-get.*" cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10))
get-complex2: run driver=http tags==block:main-get-complex2 cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn
get-complex3: run driver=http tags==block:main-get-complex3 cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn main-get-in: >-
run driver=http tags==block:"main-get-in.*" cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10))
page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn
main-get-not-in: >-
run driver=http tags==block:"main-get-not-in.*" cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10))
page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn
main-get-mem-and: >-
run driver=http tags==block:"main-get-mem-and.*" cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10))
page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn
main-get-mem-or: >-
run driver=http tags==block:"main-get-mem-or.*" cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10))
page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn
main-get-complex1: >-
run driver=http tags==block:"main-get-complex1.*" cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10))
page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn
main-get-complex2: >-
run driver=http tags==block:"main-get-complex2.*" cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10))
page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn
main-get-complex3: >-
run driver=http tags==block:"main-get-complex3.*" cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10))
page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn
bindings: bindings:
# To enable an optional weighted set of hosts in place of a load balancer
# Examples
# single host: docsapi_host=host1
# multiple hosts: docsapi_host=host1,host2,host3
# multiple weighted hosts: docsapi_host=host1:3,host2:7
weighted_hosts: WeightedStrings('<<docsapi_host:stargate>>') weighted_hosts: WeightedStrings('<<docsapi_host:stargate>>')
# http request id
request_id: ToHashedUUID(); ToString(); request_id: ToHashedUUID(); ToString();
seq_key: Mod(<<docscount:10000000>>); ToString() -> String seq_key: Mod(<<docscount:10000000>>); ToString() -> String
@ -56,8 +70,8 @@ bindings:
match2: Identity(); CoinFunc(<<match-ratio>>, FixedValue("true"), FixedValue("false")) match2: Identity(); CoinFunc(<<match-ratio>>, FixedValue("true"), FixedValue("false"))
match3: Identity(); CoinFunc(<<match-ratio>>, FixedValue("true"), FixedValue("false")) match3: Identity(); CoinFunc(<<match-ratio>>, FixedValue("true"), FixedValue("false"))
token: Discard(); Token('<<auth_token:>>','<<auth_uri:http://localhost:8081/v1/auth>>', '<<auth_uid:cassandra>>', '<<auth_pswd:cassandra>>');
additional_fields: ListSizedStepped(<<docpadding:0>>,Template("\"{}\":{}",Identity(),Identity())); ToString(); ReplaceAll('\[\"', ',\"'); ReplaceAll('\[', ''); ReplaceAll('\]', '') -> String additional_fields: ListSizedStepped(<<docpadding:0>>,Template("\"{}\":{}",Identity(),Identity())); ToString(); ReplaceAll('\[\"', ',\"'); ReplaceAll('\[', ''); ReplaceAll('\]', '') -> String
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString();
blocks: blocks:
schema: schema:
@ -67,7 +81,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/schemas/namespaces uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/schemas/namespaces
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -81,7 +95,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
ok-status: "[2-4][0-9][0-9]" ok-status: "[2-4][0-9][0-9]"
create-docs-collection: create-docs-collection:
@ -89,21 +103,21 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: | body: >2
{ {
"name": "<<collection:docs_collection>>" "name": "<<collection:docs_collection>>"
} }
rampup: rampup-put:
ops: ops:
rampup-put: action:
method: PUT method: PUT
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>/{seq_key} uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>/{seq_key}
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -133,131 +147,156 @@ blocks:
{additional_fields} {additional_fields}
} }
# where={"match1":{"$in":[0]}} # where={"match1":{"$in":[0]}}
rampup-get-in: rampup-get-in:
driver: http ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match1":{"$in":[0]}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match1":{"$in":[0]}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
# where={"match2":{"$nin":["false"]}} # where={"match2":{"$nin":["false"]}}
rampup-get-not-in: rampup-get-not-in:
ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match2":{"$nin":["false"]}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match2":{"$nin":["false"]}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
# where={"match2":{"$eq":"true"},"match3":{"$ne": false}} # where={"match2":{"$eq":"true"},"match3":{"$ne": false}}
rampup-get-mem-and: rampup-get-mem-and:
ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match2":{"$eq":"true"},"match3":{"$ne":false}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match2":{"$eq":"true"},"match3":{"$ne":false}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
rampup-get-mem-or: rampup-get-mem-or:
ops:
action:
# where={"$or":[{"match1":{"$lt":1}},{"match3":{"$exists":true}}]} # where={"$or":[{"match1":{"$lt":1}},{"match3":{"$exists":true}}]}
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match3":{"$exists":true}}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match3":{"$exists":true}}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
# where={"$and":[{"match1":{"$eq":0}},{"$or":[{"match2":{"$eq":"true"}},{"match3":{"$eq":false}}]}]} # where={"$and":[{"match1":{"$eq":0}},{"$or":[{"match2":{"$eq":"true"}},{"match3":{"$eq":false}}]}]}
rampup-get-complex1: rampup-get-complex1:
ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$and":[{"match1":{"$eq":0}},{"$or":[{"match2":{"$eq":"true"}},{"match3":{"$eq":false}}]}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$and":[{"match1":{"$eq":0}},{"$or":[{"match2":{"$eq":"true"}},{"match3":{"$eq":false}}]}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
rampup-get-complex2: # where={"$and":[{"$or":[{"match1":{"$lte":0}},{"match2":{"$eq":"false"}}]},{"$or":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}
# where={"$and":[{"$or":[{"match1":{"$lte":0}},{"match2":{"$eq":"false"}}]},{"$or":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]} rampup-get-complex2:
ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$and":[{"$or":[{"match1":{"$lte":0}},{"match2":{"$eq":"false"}}]},{"$or":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$and":[{"$or":[{"match1":{"$lte":0}},{"match2":{"$eq":"false"}}]},{"$or":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
# where={"$or":[{"$and":[{"match1":{"$lte":0}},{"match2":{"$eq":"true"}}]},{"$and":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]} # where={"$or":[{"$and":[{"match1":{"$lte":0}},{"match2":{"$eq":"true"}}]},{"$and":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}
rampup-get-complex3: rampup-get-complex3:
ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"$and":[{"match1":{"$lte":0}},{"match2":{"$eq":"true"}}]},{"$and":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"$and":[{"match1":{"$lte":0}},{"match2":{"$eq":"true"}}]},{"$and":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
main: # where={"match1":{"$in":[0]}}
main-get-in:
ops: ops:
# where={"match1":{"$in":[0]}} action:
main-get-in:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match1":{"$in":[0]}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match1":{"$in":[0]}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
# where={"match2":{"$nin":["false"]}} # where={"match2":{"$nin":["false"]}}
main-get-not-in: main-get-not-in:
ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match2":{"$nin":["false"]}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match2":{"$nin":["false"]}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
# where={"match2":{"$eq":"true"},"match3":{"$ne": false}} # where={"match2":{"$eq":"true"},"match3":{"$ne": false}}
main-get-mem-and: main-get-mem-and:
oops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match2":{"$eq":"true"},"match3":{"$ne":false}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match2":{"$eq":"true"},"match3":{"$ne":false}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
# where={"$or":[{"match1":{"$lt":1}},{"match3":{"$exists":true}}]} # where={"$or":[{"match1":{"$lt":1}},{"match3":{"$exists":true}}]}
main-get-mem-or: main-get-mem-or:
ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match3":{"$exists":true}}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match3":{"$exists":true}}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
# where={"$and":[{"match1":{"$eq":0}},{"$or":[{"match2":{"$eq":"true"}},{"match3":{"$eq":false}}]}]} # where={"$and":[{"match1":{"$eq":0}},{"$or":[{"match2":{"$eq":"true"}},{"match3":{"$eq":false}}]}]}
main-get-complex1: main-get-complex1:
ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$and":[{"match1":{"$eq":0}},{"$or":[{"match2":{"$eq":"true"}},{"match3":{"$eq":false}}]}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$and":[{"match1":{"$eq":0}},{"$or":[{"match2":{"$eq":"true"}},{"match3":{"$eq":false}}]}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
# where={"$and":[{"$or":[{"match1":{"$lte":0}},{"match2":{"$eq":"false"}}]},{"$or":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]} # where={"$and":[{"$or":[{"match1":{"$lte":0}},{"match2":{"$eq":"false"}}]},{"$or":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}
main-get-complex2: main-get-complex2:
ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$and":[{"$or":[{"match1":{"$lte":0}},{"match2":{"$eq":"false"}}]},{"$or":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$and":[{"$or":[{"match1":{"$lte":0}},{"match2":{"$eq":"false"}}]},{"$or":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
# where={"$or":[{"$and":[{"match1":{"$lte":0}},{"match2":{"$eq":"true"}}]},{"$and":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]} # where={"$or":[{"$and":[{"match1":{"$lte":0}},{"match2":{"$eq":"true"}}]},{"$and":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}
main-get-complex3: main-get-complex3:
ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"$and":[{"match1":{"$lte":0}},{"match2":{"$eq":"true"}}]},{"$and":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"$and":[{"match1":{"$lte":0}},{"match2":{"$eq":"true"}}]},{"$and":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"

View File

@ -1,4 +1,4 @@
min_version: "5.17.1" min_version: "5.17.3"
description: | description: |
This workload emulates basic search operations for the Stargate Documents API. This workload emulates basic search operations for the Stargate Documents API.
@ -7,28 +7,39 @@ description: |
Note that docsapi_port should reflect the port where the Docs API is exposed (defaults to 8180). Note that docsapi_port should reflect the port where the Docs API is exposed (defaults to 8180).
scenarios: scenarios:
schema: run driver=http tags==block:"schema.*" threads==<<threads:1>> cycles==UNDEF schema: >-
rampup: run driver=http tags==block:"schema.*" threads==<<threads:1>> cycles==UNDEF
write: run driver=http tags==name:'rampup-put.*' cycles===TEMPLATE(docscount,10) docpadding=TEMPLATE(docpadding,0) match-ratio=TEMPLATE(match-ratio,0.01) threads=<<threads:auto>> errors=timer,warn rampup-write: >-
read: run driver=http tags==name:'rampup-get.*' cycles===TEMPLATE(rampup-cycles, 10) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn run driver=http tags==name:"rampup-put.*" cycles===TEMPLATE(docscount,10)
main: docpadding=TEMPLATE(docpadding,0) match-ratio=TEMPLATE(match-ratio,0.01) threads=<<threads:auto>> errors=timer,warn
all: run driver=http tags==block:main cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn rampup-read: >-
get-eq: run driver=http tags==name:main-get-eq,filter:eq cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn run driver=http tags==name:"rampup-get.*" cycles===TEMPLATE(rampup-cycles,10)
get-lt: run driver=http tags==name:main-get-lt cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn
get-and: run driver=http tags==name:main-get-and cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn main-all: >-
get-or: run driver=http tags==name:main-get-or cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn run driver=http tags==block:"main-get.*" cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10))
get-or-single-match: run driver=http tags==name:main-get-or-single-match cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn
main-get-equal: >-
run driver=http tags==name:"main-get-equal.*" cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10))
page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn
main-get-lt: >-
run driver=http tags==name:"main-get-lt.*" cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10))
page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn
main-get-and: >-
run driver=http tags==name:"main-get-and.*" cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10))
page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn
main-get-or: >-
run driver=http tags==name:"main-get-or.*" cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10))
page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn
main-get-or-single-match: >-
run driver=http tags==name:"main-get-or-single-match.*"
cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10)) page-size=TEMPLATE(page-size,3)
fields=TEMPLATE(fields,%5b%5d) threads=<<threads:auto>> errors=timer,warn
bindings: bindings:
# To enable an optional weighted set of hosts in place of a load balancer
# Examples
# single host: docsapi_host=host1
# multiple hosts: docsapi_host=host1,host2,host3
# multiple weighted hosts: docsapi_host=host1:3,host2:7
weighted_hosts: WeightedStrings('<<docsapi_host:stargate>>') weighted_hosts: WeightedStrings('<<docsapi_host:stargate>>')
# http request id # http request id
request_id: ToHashedUUID(); ToString(); request_id: ToHashedUUID(); ToString();
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString(); token: Discard(); Token('<<auth_token:>>','<<auth_uri:http://localhost:8081/v1/auth>>', '<<auth_uid:cassandra>>', '<<auth_pswd:cassandra>>');
seq_key: Mod(<<docscount:10000000>>); ToString() -> String seq_key: Mod(<<docscount:10000000>>); ToString() -> String
random_key: Uniform(0,<<docscount:10000000>>); ToString() -> String random_key: Uniform(0,<<docscount:10000000>>); ToString() -> String
@ -55,7 +66,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/schemas/namespaces uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/schemas/namespaces
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -69,7 +80,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
ok-status: "[2-4][0-9][0-9]" ok-status: "[2-4][0-9][0-9]"
create-docs-collection: create-docs-collection:
@ -77,21 +88,21 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
"name": "<<collection:docs_collection>>" "name": "<<collection:docs_collection>>"
} }
rampup: rampup-put:
ops: ops:
rampup-put: action:
method: PUT method: PUT
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>/{seq_key} uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>/{seq_key}
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -121,94 +132,101 @@ blocks:
{additional_fields} {additional_fields}
} }
# where={"match3":{"$eq":true}} # where={"match3":{"$eq":true}}
rampup-get-eq: rampup-get-eq:
ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match3":{"$eq":true}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match3":{"$eq":true}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
# where={"match1":{"$lt":1}} # where={"match1":{"$lt":1}}
rampup-get-lt: rampup-get-lt:
ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match1":{"$lt":1}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match1":{"$lt":1}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
# where={"match1":{"$lt":1},"match2":{"$eq":"true"}} # where={"match1":{"$lt":1},"match2":{"$eq":"true"}}
rampup-get-and: rampup-get-and:
ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match1":{"$lt":1},"match2":{"$eq":"true"}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match1":{"$lt":1},"match2":{"$eq":"true"}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
# where={"$or":[{"match1":{"$lt":1}},{"match3":{"$eq":true}}]} # where={"$or":[{"match1":{"$lt":1}},{"match3":{"$eq":true}}]}
rampup-get-or: rampup-get-or:
ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match3":{"$eq":true}}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match3":{"$eq":true}}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
# where={"$or":[{"match1":{"$lt":1}},{"match2":{"$eq":"notamatch"}}]} # where={"$or":[{"match1":{"$lt":1}},{"match2":{"$eq":"notamatch"}}]}
main-get-or-single-match: main-get-or-single-match:
ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match2":{"$eq":"notamatch"}}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match2":{"$eq":"notamatch"}}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
# where={"match3":{"$eq":true}} # where={"match3":{"$eq":true}}
main: main-get-equal:
ops: ops:
main-get-eq: action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match3":{"$eq":true}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match3":{"$eq":true}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
# where={"match1":{"$lt":1}} # where={"match1":{"$lt":1}}
main-get-lt: main-get-lt:
ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match1":{"$lt":1}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match1":{"$lt":1}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
# where={"match1":{"$lt":1},"match2":{"$eq":"true"}} # where={"match1":{"$lt":1},"match2":{"$eq":"true"}}
main-get-and: main-get-and:
ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match1":{"$lt":1},"match2":{"$eq":"true"}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match1":{"$lt":1},"match2":{"$eq":"true"}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
# where={"$or":[{"match1":{"$lt":1}},{"match3":{"$eq":true}}]} # where={"$or":[{"match1":{"$lt":1}},{"match3":{"$eq":true}}]}
main-get-or: main-get-or:
ops:
action:
method: GET method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match3":{"$eq":true}}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>> uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match3":{"$eq":true}}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json"
# where={"$or":[{"match1":{"$lt":1}},{"match2":{"$eq":"notamatch"}}]}
main-get-or-single-match:
method: GET
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match2":{"$eq":"notamatch"}}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
Content-Type: "application/json" Content-Type: "application/json"

View File

@ -1,4 +1,4 @@
min_version: "5.17.1" min_version: "5.17.3"
description: | description: |
This workload emulates a key-value data model and access patterns. This workload emulates a key-value data model and access patterns.
@ -10,19 +10,13 @@ description: |
scenarios: scenarios:
default: default:
schema: run driver=http tags==block:"schema.*" threads==1 cycles==UNDEF schema: run driver=http tags==block:"schema.*" threads==1 cycles==UNDEF
rampup: run driver=http tags==block:rampup cycles===TEMPLATE(rampup-cycles,10) threads=auto rampup: run driver=http tags==block:"rampup.*" cycles===TEMPLATE(rampup-cycles,10) threads=auto
main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,10) threads=auto main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,10) threads=auto
bindings: bindings:
# To enable an optional weighted set of hosts in place of a load balancer
# Examples
# single host: graphql_host=host1
# multiple hosts: graphql_host=host1,host2,host3
# multiple weighted hosts: graphql_host=host1:3,host2:7
weighted_hosts: WeightedStrings('<<graphql_host:stargate>>') weighted_hosts: WeightedStrings('<<graphql_host:stargate>>')
# http request id
request_id: ToHashedUUID(); ToString(); request_id: ToHashedUUID(); ToString();
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString(); token: Discard(); Token('<<auth_token:>>','<<auth_uri:http://localhost:8081/v1/auth>>', '<<auth_uid:cassandra>>', '<<auth_pswd:cassandra>>');
seq_key: Mod(<<keycount:10000000>>); ToString() -> String seq_key: Mod(<<keycount:10000000>>); ToString() -> String
seq_value: Hash(); Mod(<<valuecount:1000000000>>); ToString() -> String seq_value: Hash(); Mod(<<valuecount:1000000000>>); ToString() -> String
@ -37,17 +31,17 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{"quersy":"mutation {\n createKeyspace(name:\"<<keyspace:gqlcf_keyvalue>>\", replicas: <<rf:1>>, ifNotExists: true)\n}"} {"query":"mutation {\n createKeyspace(name:\"<<keyspace:gqlcf_keyvalue>>\", replicas: <<rf:1>>, ifNotExists: true)\n}"}
create-table: create-table:
method: POST method: POST
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: | body: |
{"query":"mutation {\n createTable(\n keyspaceName: \"<<keyspace:gqlcf_keyvalue>>\"\n tableName: \"<<table:keyvalue>>\"\n partitionKeys: [{ name: \"key\", type: { basic: TEXT } }]\n values: [{ name: \"value\", type: { basic: TEXT } }]\n ifNotExists: true\n )\n}"} {"query":"mutation {\n createTable(\n keyspaceName: \"<<keyspace:gqlcf_keyvalue>>\"\n tableName: \"<<table:keyvalue>>\"\n partitionKeys: [{ name: \"key\", type: { basic: TEXT } }]\n values: [{ name: \"value\", type: { basic: TEXT } }]\n ifNotExists: true\n )\n}"}
@ -59,7 +53,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_keyvalue>> uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_keyvalue>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: | body: |
{"query":"mutation {\n insert<<table:keyvalue>>( value: {key: \"{seq_key}\", value: \"{seq_value}\",}) {value {key, value}}}"} {"query":"mutation {\n insert<<table:keyvalue>>( value: {key: \"{seq_key}\", value: \"{seq_value}\",}) {value {key, value}}}"}
@ -73,7 +67,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_keyvalue>> uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_keyvalue>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: | body: |
{"query":"{<<table:keyvalue>>(value: {key: \"{rw_key}\"}) {values {key, value}}}"} {"query":"{<<table:keyvalue>>(value: {key: \"{rw_key}\"}) {values {key, value}}}"}
@ -87,7 +81,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_keyvalue>> uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_keyvalue>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: | body: |
{"query":"mutation {\n insert<<table:keyvalue>>( value: {key: \"{rw_key}\", value: \"{rw_value}\",}) {value {key, value}}}"} {"query":"mutation {\n insert<<table:keyvalue>>( value: {key: \"{rw_key}\", value: \"{rw_value}\",}) {value {key, value}}}"}

View File

@ -1,4 +1,4 @@
min_version: "5.17.1" min_version: "5.17.3"
description: | description: |
This workload emulates a tabular workload with partitions, clusters, and data fields. This workload emulates a tabular workload with partitions, clusters, and data fields.
@ -11,45 +11,38 @@ description: |
scenarios: scenarios:
default: default:
schema: run driver=http tags==block:"schema.*" threads==1 cycles==UNDEF schema: run driver=http tags==block:"schema.*" threads==1 cycles==UNDEF
rampup: run driver=http tags==block:rampup cycles===TEMPLATE(rampup-cycles,10) threads=auto rampup-insert: run driver=http tags==block:"rampup-insert.*" cycles===TEMPLATE(rampup-cycles,12) threads=auto
main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,10) threads=auto main-read: run driver=http tags==block:"main-read.*" cycles===TEMPLATE(main-cycles,12) threads=auto
main-write: run driver=http tags==block:"main-write.*" cycles===TEMPLATE(main-cycles,12) threads=auto
bindings: bindings:
# To enable an optional weighted set of hosts in place of a load balancer
# Examples
# single host: graphql_host=host1
# multiple hosts: graphql_host=host1,host2,host3
# multiple weighted hosts: graphql_host=host1:3,host2:7
weighted_hosts: WeightedStrings('<<graphql_host:stargate>>') weighted_hosts: WeightedStrings('<<graphql_host:stargate>>')
# http request id
request_id: ToHashedUUID(); ToString(); request_id: ToHashedUUID(); ToString();
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString(); token: Discard(); Token('<<auth_token:>>','<<auth_uri:http://localhost:8081/v1/auth>>', '<<auth_uid:cassandra>>', '<<auth_pswd:cassandra>>');
# for ramp-up and verify
part_layout: Div(<<partsize:1000000>>); ToString() -> String part_layout: Div(<<partsize:1000000>>); ToString() -> String
clust_layout: Mod(<<partsize:1000000>>); ToString() -> String clust_layout: Mod(<<partsize:1000000>>); ToString() -> String
data: HashedFileExtractToString('data/lorem_ipsum_full.txt',50,150); URLEncode(); data: HashedFileExtractToString('data/lorem_ipsum_full.txt',50,150); URLEncode();
# for read
limit: Uniform(1,10) -> int limit: Uniform(1,10) -> int
part_read: Uniform(0,<<partcount:100>>)->int; ToString() -> String part_read: Uniform(0,<<partcount:100>>)->int; ToString() -> String
clust_read: Add(1); Uniform(0,<<partsize:1000000>>)->int; ToString() -> String clust_read: Add(1); Uniform(0,<<partsize:1000000>>)->int; ToString() -> String
# for write
part_write: Hash(); Uniform(0,<<partcount:100>>)->int; ToString() -> String part_write: Hash(); Uniform(0,<<partcount:100>>)->int; ToString() -> String
clust_write: Hash(); Add(1); Uniform(0,<<partsize:1000000>>)->int; ToString() -> String clust_write: Hash(); Add(1); Uniform(0,<<partsize:1000000>>)->int; ToString() -> String
data_write: Hash(); HashedFileExtractToString('data/lorem_ipsum_full.txt',50,150); URLEncode(); data_write: Hash(); HashedFileExtractToString('data/lorem_ipsum_full.txt',50,150); URLEncode();
blocks: blocks:
schema: schema:
tags:
block: schema
ops: ops:
create-keyspace: create-keyspace:
method: POST method: POST
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: | body: >2
{"query":"mutation {\n createKeyspace(name:\"<<keyspace:gqlcf_tabular>>\", replicas: <<rf:1>>, ifNotExists: true)\n}"} {"query":"mutation {\n createKeyspace(name:\"<<keyspace:gqlcf_tabular>>\", replicas: <<rf:1>>, ifNotExists: true)\n}"}
create-table: create-table:
@ -57,47 +50,48 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: | body: >2
{"query":"mutation {\n createTable(\n keyspaceName: \"<<keyspace:gqlcf_tabular>>\"\n tableName: \"<<table:tabular>>\"\n partitionKeys: [{ name: \"part\", type: { basic: TEXT } }]\n clusteringKeys: [{ name: \"clust\", type: { basic: TEXT } }]\n values: [{ name: \"data\", type: { basic: TEXT } }]\n ifNotExists: true\n )\n}\n"} {"query":"mutation {\n createTable(\n keyspaceName: \"<<keyspace:gqlcf_tabular>>\"\n tableName: \"<<table:tabular>>\"\n partitionKeys: [{ name: \"part\", type: { basic: TEXT } }]\n clusteringKeys: [{ name: \"clust\", type: { basic: TEXT } }]\n values: [{ name: \"data\", type: { basic: TEXT } }]\n ifNotExists: true\n )\n}\n"}
rampup: rampup-insert:
ops: ops:
rampup-insert: action:
method: POST method: POST
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_tabular>> uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_tabular>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: | body: >2
{"query":"mutation {\n insert<<table:tabular>>( value: {part: \"{part_layout}\", clust: \"{clust_layout}\", data: \"{data}\"}) {value {part, clust, data}}}"} {"query":"mutation {\n insert<<table:tabular>>( value: {part: \"{part_layout}\", clust: \"{clust_layout}\", data: \"{data}\"}) {value {part, clust, data}}}"}
main-read: main-read:
params: params:
ratio: 5 ratio: 5
ops: ops:
main-select: action:
method: POST method: POST
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_tabular>> uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_tabular>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{"query":"{<<table:tabular>>(value: {part: \"{part_read}\"}, options: { pageSize: <<limit:10>> }) {values {part, clust, data}}}"} {"query":"{<<table:tabular>>(value: {part: \"{part_read}\"}, options: { pageSize: <<limit:10>> }) {values {part, clust, data}}}"}
main-write: main-write:
params: params:
ratio: 5 ratio: 5
ops: ops:
main-write: action:
method: POST method: POST
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_tabular>> uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_tabular>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{"query":"mutation {\n insert<<table:tabular>>( value: {part: \"{part_write}\", clust: \"{clust_write}\", data: \"{data_write}\"}) {value {part, clust, data}}}"} {"query":"mutation {\n insert<<table:tabular>>( value: {part: \"{part_write}\", clust: \"{clust_write}\", data: \"{data_write}\"}) {value {part, clust, data}}}"}

View File

@ -1,4 +1,4 @@
min_version: "5.17.1" min_version: "5.17.3"
description: | description: |
This workload emulates a time-series data model and access patterns. This workload emulates a time-series data model and access patterns.
@ -15,19 +15,14 @@ scenarios:
default: default:
schema: run driver=http tags==block:schema threads==1 cycles==UNDEF schema: run driver=http tags==block:schema threads==1 cycles==UNDEF
rampup: run driver=http tags==block:rampup cycles===TEMPLATE(rampup-cycles,10) threads=auto rampup: run driver=http tags==block:rampup cycles===TEMPLATE(rampup-cycles,10) threads=auto
main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,10) threads=auto main-read: run driver=http tags==block:"main-read.*" cycles===TEMPLATE(main-cycles,10) threads=auto
main-write: run driver=http tags==block:"main-write.*" cycles===TEMPLATE(main-cycles,10) threads=auto
bindings: bindings:
# To enable an optional weighted set of hosts in place of a load balancer
# Examples
# single host: graphql_host=host1
# multiple hosts: graphql_host=host1,host2,host3
# multiple weighted hosts: graphql_host=host1:3,host2:7
weighted_hosts: WeightedStrings('<<graphql_host:stargate>>') weighted_hosts: WeightedStrings('<<graphql_host:stargate>>')
# http request id
request_id: ToHashedUUID(); ToString(); request_id: ToHashedUUID(); ToString();
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString(); token: Discard(); Token('<<auth_token:>>','<<auth_uri:http://localhost:8081/v1/auth>>', '<<auth_uid:cassandra>>', '<<auth_pswd:cassandra>>');
machine_id: Mod(<<sources:10000>>); ToHashedUUID() -> java.util.UUID machine_id: Mod(<<sources:10000>>); ToHashedUUID() -> java.util.UUID
sensor_name: HashedLineToString('data/variable_words.txt') sensor_name: HashedLineToString('data/variable_words.txt')
@ -46,7 +41,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{"query":"mutation {\n createKeyspace(name:\"<<keyspace:gqlcf_iot>>\", replicas: <<rf:1>>, ifNotExists: true)\n}"} {"query":"mutation {\n createKeyspace(name:\"<<keyspace:gqlcf_iot>>\", replicas: <<rf:1>>, ifNotExists: true)\n}"}
@ -56,7 +51,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{"query":"mutation {\n createTable(\n keyspaceName: \"<<keyspace:gqlcf_iot>>\"\n tableName: \"<<table:iot>>\"\n partitionKeys: [{ name: \"machine_id\", type: { basic: UUID } }, { name: \"sensor_name\", type: { basic: TEXT } }]\n clusteringKeys: [{ name: \"time\", type: { basic: TIMESTAMP }, order: \"DESC\" }]\n values: [{ name: \"sensor_value\", type: { basic: FLOAT } }, { name: \"station_id\", type: { basic: UUID } }, { name: \"data\", type: { basic: TEXT } }]\n ifNotExists: true\n )\n}\n"} {"query":"mutation {\n createTable(\n keyspaceName: \"<<keyspace:gqlcf_iot>>\"\n tableName: \"<<table:iot>>\"\n partitionKeys: [{ name: \"machine_id\", type: { basic: UUID } }, { name: \"sensor_name\", type: { basic: TEXT } }]\n clusteringKeys: [{ name: \"time\", type: { basic: TIMESTAMP }, order: \"DESC\" }]\n values: [{ name: \"sensor_value\", type: { basic: FLOAT } }, { name: \"station_id\", type: { basic: UUID } }, { name: \"data\", type: { basic: TEXT } }]\n ifNotExists: true\n )\n}\n"}
@ -68,7 +63,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_iot>> uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_iot>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{"query":"mutation insertReading {\n reading: insert<<table:iot>>( value: {machine_id: \"{machine_id}\", sensor_name: \"{sensor_name}\", time: \"{time}\", data: \"{data}\", sensor_value: {sensor_value}, station_id: \"{station_id}\"}) {value {machine_id, sensor_name, time, data, sensor_value, station_id}}}"} {"query":"mutation insertReading {\n reading: insert<<table:iot>>( value: {machine_id: \"{machine_id}\", sensor_name: \"{sensor_name}\", time: \"{time}\", data: \"{data}\", sensor_value: {sensor_value}, station_id: \"{station_id}\"}) {value {machine_id, sensor_name, time, data, sensor_value, station_id}}}"}
@ -82,9 +77,9 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_iot>> uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_iot>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: | body: >2
{"query":"query readings {<<table:iot>>(value: {machine_id: \"{machine_id}\",sensor_name: \"{sensor_name}\"}, options: { pageSize: <<limit:10>> }) {values {machine_id, sensor_name, time, data, sensor_value, station_id}}}"} {"query":"query readings {<<table:iot>>(value: {machine_id: \"{machine_id}\",sensor_name: \"{sensor_name}\"}, options: { pageSize: <<limit:10>> }) {values {machine_id, sensor_name, time, data, sensor_value, station_id}}}"}
main-write: main-write:
@ -96,7 +91,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_iot>> uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_iot>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{"query":"mutation insertReading {\n reading: insert<<table:iot>>( value: {machine_id: \"{machine_id}\", sensor_name: \"{sensor_name}\", time: \"{time}\", data: \"{data}\", sensor_value: {sensor_value}, station_id: \"{station_id}\"}) {value {machine_id, sensor_name, time, data, sensor_value, station_id}}}"} {"query":"mutation insertReading {\n reading: insert<<table:iot>>( value: {machine_id: \"{machine_id}\", sensor_name: \"{sensor_name}\", time: \"{time}\", data: \"{data}\", sensor_value: {sensor_value}, station_id: \"{station_id}\"}) {value {machine_id, sensor_name, time, data, sensor_value, station_id}}}"}

View File

@ -1,4 +1,4 @@
min_version: "5.17.1" min_version: "5.17.3"
# TODO # TODO
# - do we need a truncate schema / namespace at the end # - do we need a truncate schema / namespace at the end
@ -18,16 +18,9 @@ scenarios:
main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,10) threads=auto main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,10) threads=auto
bindings: bindings:
# To enable an optional weighted set of hosts in place of a load balancer
# Examples
# single host: graphql_host=host1
# multiple hosts: graphql_host=host1,host2,host3
# multiple weighted hosts: graphql_host=host1:3,host2:7
weighted_hosts: WeightedStrings('<<graphql_host:stargate>>') weighted_hosts: WeightedStrings('<<graphql_host:stargate>>')
# http request id
request_id: ToHashedUUID(); ToString(); request_id: ToHashedUUID(); ToString();
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString(); token: Discard(); Token('<<auth_token:>>','<<auth_uri:http://localhost:8081/v1/auth>>', '<<auth_uid:cassandra>>', '<<auth_pswd:cassandra>>');
seq_key: Mod(<<keycount:10000000>>); ToString() -> String seq_key: Mod(<<keycount:10000000>>); ToString() -> String
seq_value: Hash(); Mod(<<valuecount:1000000000>>); ToString() -> String seq_value: Hash(); Mod(<<valuecount:1000000000>>); ToString() -> String
@ -43,7 +36,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -55,7 +48,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-admin uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-admin
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -69,7 +62,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_keyvalue>> uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_keyvalue>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -85,7 +78,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_keyvalue>> uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_keyvalue>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -101,7 +94,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_keyvalue>> uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_keyvalue>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {

View File

@ -1,4 +1,4 @@
min_version: "5.17.1" min_version: "5.17.3"
# TODO # TODO
# - do we need a truncate schema / namespace at the end # - do we need a truncate schema / namespace at the end
@ -20,26 +20,18 @@ scenarios:
main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,10) threads=auto main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,10) threads=auto
bindings: bindings:
# To enable an optional weighted set of hosts in place of a load balancer
# Examples
# single host: graphql_host=host1
# multiple hosts: graphql_host=host1,host2,host3
# multiple weighted hosts: graphql_host=host1:3,host2:7
weighted_hosts: WeightedStrings('<<graphql_host:stargate>>') weighted_hosts: WeightedStrings('<<graphql_host:stargate>>')
# http request id
request_id: ToHashedUUID(); ToString(); request_id: ToHashedUUID(); ToString();
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString(); token: Discard(); Token('<<auth_token:>>','<<auth_uri:http://localhost:8081/v1/auth>>', '<<auth_uid:cassandra>>', '<<auth_pswd:cassandra>>');
# for ramp-up and verify
part_layout: Div(<<partsize:1000000>>); ToString() -> String part_layout: Div(<<partsize:1000000>>); ToString() -> String
clust_layout: Mod(<<partsize:1000000>>); ToString() -> String clust_layout: Mod(<<partsize:1000000>>); ToString() -> String
data: HashedFileExtractToString('data/lorem_ipsum_full.txt',50,150); URLEncode(); data: HashedFileExtractToString('data/lorem_ipsum_full.txt',50,150); URLEncode();
# for read
limit: Uniform(1,10) -> int limit: Uniform(1,10) -> int
part_read: Uniform(0,<<partcount:100>>)->int; ToString() -> String part_read: Uniform(0,<<partcount:100>>)->int; ToString() -> String
clust_read: Add(1); Uniform(0,<<partsize:1000000>>)->int; ToString() -> String clust_read: Add(1); Uniform(0,<<partsize:1000000>>)->int; ToString() -> String
# for write
part_write: Hash(); Uniform(0,<<partcount:100>>)->int; ToString() -> String part_write: Hash(); Uniform(0,<<partcount:100>>)->int; ToString() -> String
clust_write: Hash(); Add(1); Uniform(0,<<partsize:1000000>>)->int; ToString() -> String clust_write: Hash(); Add(1); Uniform(0,<<partsize:1000000>>)->int; ToString() -> String
data_write: Hash(); HashedFileExtractToString('data/lorem_ipsum_full.txt',50,150); URLEncode(); data_write: Hash(); HashedFileExtractToString('data/lorem_ipsum_full.txt',50,150); URLEncode();
@ -52,7 +44,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -64,7 +56,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-admin uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-admin
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -78,7 +70,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_tabular>> uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_tabular>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -94,7 +86,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_tabular>> uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_tabular>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -110,7 +102,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_tabular>> uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_tabular>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {

View File

@ -1,4 +1,4 @@
min_version: "5.17.1" min_version: "5.17.3"
# TODO # TODO
# - do we need a truncate schema / namespace at the end # - do we need a truncate schema / namespace at the end
@ -24,16 +24,10 @@ scenarios:
main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,10) threads=auto main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,10) threads=auto
bindings: bindings:
# To enable an optional weighted set of hosts in place of a load balancer
# Examples
# single host: graphql_host=host1
# multiple hosts: graphql_host=host1,host2,host3
# multiple weighted hosts: graphql_host=host1:3,host2:7
weighted_hosts: WeightedStrings('<<graphql_host:stargate>>') weighted_hosts: WeightedStrings('<<graphql_host:stargate>>')
# http request id
request_id: ToHashedUUID(); ToString(); request_id: ToHashedUUID(); ToString();
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString(); token: Discard(); Token('<<auth_token:>>','<<auth_uri:http://localhost:8081/v1/auth>>', '<<auth_uid:cassandra>>', '<<auth_pswd:cassandra>>');
machine_id: Mod(<<sources:10000>>); ToHashedUUID() -> java.util.UUID machine_id: Mod(<<sources:10000>>); ToHashedUUID() -> java.util.UUID
sensor_name: HashedLineToString('data/variable_words.txt') sensor_name: HashedLineToString('data/variable_words.txt')
@ -50,7 +44,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -62,7 +56,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-admin uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-admin
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -76,7 +70,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_timeseries>> uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_timeseries>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -92,7 +86,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_timeseries>> uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_timeseries>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {
@ -108,7 +102,7 @@ blocks:
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_timeseries>> uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_timeseries>>
Accept: "application/json" Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>" X-Cassandra-Token: "{token}"
Content-Type: "application/json" Content-Type: "application/json"
body: >2 body: >2
{ {

View File

@ -2,7 +2,7 @@
# nb5 run driver=mongodb workload=/path/to/mongodb-keyvalue2.yaml tags=block:"schema.*" connection='mongodb+srv://user:pass@sample-db.host.mongodb.net/?retryWrites=true&w=majority' database=baselines -vv --show-stacktraces # nb5 run driver=mongodb workload=/path/to/mongodb-keyvalue2.yaml tags=block:"schema.*" connection='mongodb+srv://user:pass@sample-db.host.mongodb.net/?retryWrites=true&w=majority' database=baselines -vv --show-stacktraces
# nb5 run driver=mongodb workload=/path/to/mongodb-keyvalue2.yaml tags=block:rampup cycles=25 connection='mongodb+srv://user:pass@sample-db.host.mongodb.net/?retryWrites=true&w=majority' database=baselines -vv --show-stacktraces # nb5 run driver=mongodb workload=/path/to/mongodb-keyvalue2.yaml tags=block:rampup cycles=25 connection='mongodb+srv://user:pass@sample-db.host.mongodb.net/?retryWrites=true&w=majority' database=baselines -vv --show-stacktraces
# nb5 run driver=mongodb workload=/path/to/mongodb-keyvalue2.yaml tags='block:main-.*' cycles=25 connection='mongodb+srv://user:pass@sample-db.host.mongodb.net/?retryWrites=true&w=majority' database=baselines -vv --show-stacktraces # nb5 run driver=mongodb workload=/path/to/mongodb-keyvalue2.yaml tags='block:main-.*' cycles=25 connection='mongodb+srv://user:pass@sample-db.host.mongodb.net/?retryWrites=true&w=majority' database=baselines -vv --show-stacktraces
min_version: "5.17.1" min_version: "5.17.3"
description: | description: |
This workload is analogous to the cql-keyvalue2 workload, just implemented for MongoDB. This workload is analogous to the cql-keyvalue2 workload, just implemented for MongoDB.

View File

@ -35,60 +35,75 @@ import java.util.function.Function;
@ThreadSafeMapper @ThreadSafeMapper
@Categories({Category.general}) @Categories({Category.general})
public class StargateToken implements Function<Object, String> { public class Token implements Function<String, String> {
private static final Logger logger = LogManager.getLogger(StargateToken.class); private static final Logger logger = LogManager.getLogger(Token.class);
private final Credentials credentials; private Credentials credentials;
private final String url; private URI uri;
private final HttpClient httpClient; private String providedToken;
public StargateToken(String url) throws SecurityException { public Token(String token, String uri, String uid, String password) {
this(url, Credentials.defaultCredentials());
}
public StargateToken(String url, Credentials credentials) throws SecurityException { if (token != null && !token.trim().isEmpty()) {
this(url, credentials, HttpClient.newBuilder().build()); this.providedToken = token.trim();
} return;
}
if (uri == null || uri.trim().isEmpty()) {
throw new IllegalArgumentException("Expected uri to be specified for obtaining Token.");
}
this.uri = URI.create(uri.trim());
if (uid == null || uid.trim().isEmpty()) {
throw new IllegalArgumentException("Expected uid to be specified for obtaining Token.");
}
if (password == null || password.trim().isEmpty()) {
throw new IllegalArgumentException("Expected password to be specified for obtaining Token.");
}
this.credentials = Credentials.create(uid.trim(), password.trim());
public StargateToken(String url, Credentials credentials, HttpClient client) throws SecurityException {
this.url = url;
this.credentials = credentials;
this.httpClient = client;
if (TokenKeeper.isExpired()) { if (TokenKeeper.isExpired()) {
authTokenStargate(url, credentials); authTokenStargate(this.uri, this.credentials);
} }
} }
@Override @Override
public String apply(Object value) throws SecurityException { public String apply(String p1) {
if (TokenKeeper.isExpired()) {
authTokenStargate(url, credentials); if (this.providedToken != null) {
return this.providedToken;
} }
return TokenKeeper.token;
if (TokenKeeper.isExpired() || TokenKeeper.token == null || TokenKeeper.token.isEmpty()) {
authTokenStargate(this.uri, this.credentials);
}
return TokenKeeper.getToken();
} }
public static void setExpired() { public static void setExpired() {
TokenKeeper.isExpiredRequested = true; TokenKeeper.isExpiredRequested = true;
} }
private void authTokenStargate(String url, Credentials credentials) throws SecurityException { private static void authTokenStargate(URI uri, Credentials credentials) throws SecurityException {
if (credentials == null || url == null) { if (credentials == null || uri == null) {
throw new BasicError("Must provide url and credentials to obtain authTokenStargate"); throw new BasicError("Must provide url and credentials to obtain authTokenStargate");
} }
logger.debug("Received url for Stargate auth token request: {} ", url);
logger.debug(() -> "Received uri for auth token request: " + uri);
try { try {
final Gson gson = new Gson(); final Gson gson = new Gson();
HttpRequest.Builder builder = HttpRequest.newBuilder(); HttpRequest.Builder builder = HttpRequest.newBuilder();
builder = builder.uri(URI.create(url)); builder = builder.uri(uri);
builder = builder.POST(HttpRequest.BodyPublishers.ofString(gson.toJson(credentials))); builder = builder.POST(HttpRequest.BodyPublishers.ofString(gson.toJson(credentials)));
builder.setHeader("Content-Type", "application/json"); builder.setHeader("Content-Type", "application/json");
HttpRequest request = builder.build(); HttpRequest request = builder.build();
HttpClient httpClient = HttpClient.newBuilder().build();
HttpResponse<String> resp = httpClient.send(request, HttpResponse.BodyHandlers.ofString()); HttpResponse<String> resp = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
logger.debug(() -> "Stargate response status code: " + resp.statusCode()); logger.debug(() -> "Stargate response status code: " + resp.statusCode());
if (resp.statusCode() != 201) { if (resp.statusCode() != 201) {
@ -98,8 +113,8 @@ public class StargateToken implements Function<Object, String> {
throw new BasicError(errorMessage); throw new BasicError(errorMessage);
} }
Credentials retrievedToken = gson.fromJson(resp.body(), Credentials.class); final Credentials cred = gson.fromJson(resp.body(), Credentials.class);
TokenKeeper.setToken(retrievedToken.getAuthToken()); TokenKeeper.setToken(cred.getAuthToken());
} catch (Exception e) { } catch (Exception e) {
throw new SecurityException("Auth Token error, stargate-token retrieval failure", e); throw new SecurityException("Auth Token error, stargate-token retrieval failure", e);
@ -121,28 +136,31 @@ public class StargateToken implements Function<Object, String> {
lastTokenInstant = Instant.now(); lastTokenInstant = Instant.now();
} }
public static void setToken(String input) {
token = input;
}
public static String getToken() {
return token;
}
public static Instant lastTokenInstant() { public static Instant lastTokenInstant() {
return lastTokenInstant; return lastTokenInstant;
} }
public static boolean isExpired() { public static boolean isExpired() {
if (isExpiredRequested || Duration.between(Instant.now(), if (token == null || isExpiredRequested || Duration.between(Instant.now(),
lastTokenInstant).toMinutes() > TOKEN_EXPIRE_MIN) { lastTokenInstant).toMinutes() > TOKEN_EXPIRE_MIN) {
logger.trace("Token expiry detected."); logger.debug("Token expiry detected.");
lastTokenInstant = Instant.now(); lastTokenInstant = Instant.now();
isExpiredRequested = false; isExpiredRequested = false;
token = null;
return true; return true;
} }
logger.debug(() -> "Token not expired, reusing as: " + token);
return false; return false;
} }
public static synchronized void setToken(String value) {
token = value;
}
public static synchronized String getToken() {
return token;
}
} }
} }

View File

@ -18,23 +18,17 @@ package io.nosqlbench.virtdata.library.basics.shared.util;
public class Credentials { public class Credentials {
private static final String DEFAULT_IDENTITY = "cassandra"; private final String username;
private String username; private final String password;
private String password;
private String authToken; private String authToken;
public static Credentials defaultCredentials() {
return new Credentials(DEFAULT_IDENTITY, DEFAULT_IDENTITY);
}
public Credentials(String username, String password) { public Credentials(String username, String password) {
this.username = username; this.username = username;
this.password = password; this.password = password;
} }
// Added for support of auth tokens not obtained via defaultCredentials public static Credentials create(String username, String password) {
public Credentials(String authToken) { return new Credentials(username, password);
this.authToken = authToken;
} }
public String getUsername() { public String getUsername() {
@ -48,4 +42,5 @@ public class Credentials {
public String getAuthToken() { public String getAuthToken() {
return authToken; return authToken;
} }
} }

View File

@ -1,148 +0,0 @@
/*
* Copyright (c) 2023 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.nosqlbench.virtdata.library.basics.shared.unary_string;
import io.nosqlbench.virtdata.library.basics.shared.util.Credentials;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.internal.util.reflection.FieldReader;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.junit.jupiter.MockitoSettings;
import org.mockito.quality.Strictness;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Instant;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
@MockitoSettings(strictness = Strictness.LENIENT)
class StargateTokenTest extends TokenTest {
private static final String TEST_AUTH_TOKEN = "8675309";
private static final String VALID_TEST_URL = "http://foobar.com:8675";
private static final String VALID_STARGATE_AUTH_TOKEN_RESPONSE_JSON =
"{ 'authToken': " + "\"" + TEST_AUTH_TOKEN + "\"" + "}";
private static final Credentials VALID_TEST_CREDS = new Credentials("username", "password");
private static final Object TOKEN_APPLY_PLACEHOLDER = new Object();
@Mock
private static HttpResponse<String> httpResponse;
@Mock
private static HttpClient httpClient;
@BeforeAll
public static void init() {
httpResponse = mock(HttpResponse.class);
httpClient = mock(HttpClient.class);
}
@BeforeEach
public void setup() {
StargateToken.TokenKeeper.reset();
}
@Test
void applyTokenSuccess() throws Exception {
when(httpResponse.body()).thenReturn(VALID_STARGATE_AUTH_TOKEN_RESPONSE_JSON);
when(httpResponse.statusCode()).thenReturn(201);
when(httpClient.send(Mockito.any(HttpRequest.class),
Mockito.any(HttpResponse.BodyHandlers.ofString().getClass())))
.thenReturn(httpResponse);
final StargateToken stargateToken = new StargateToken(VALID_TEST_URL,
VALID_TEST_CREDS, httpClient);
final String result = stargateToken.apply(TOKEN_APPLY_PLACEHOLDER);
assertThat(result).isEqualTo(TEST_AUTH_TOKEN);
}
@Test
void receivedResponse500() throws Exception {
when(httpResponse.body()).thenReturn(VALID_STARGATE_AUTH_TOKEN_RESPONSE_JSON);
when(httpResponse.statusCode()).thenReturn(500);
when(httpClient.send(Mockito.any(HttpRequest.class), Mockito.any(HttpResponse.BodyHandlers.ofString()
.getClass())))
.thenReturn(httpResponse);
assertThatExceptionOfType(SecurityException.class).isThrownBy(() -> new StargateToken(VALID_TEST_URL,
VALID_TEST_CREDS, httpClient));
}
@Test
void applyTokenSuccessWithRefreshTokenRequested() throws Exception {
// --- Initial check
StargateToken.TokenKeeper.reset();
when(httpResponse.body()).thenReturn(VALID_STARGATE_AUTH_TOKEN_RESPONSE_JSON);
when(httpResponse.statusCode()).thenReturn(201);
when(httpClient.send(Mockito.any(HttpRequest.class),
Mockito.any(HttpResponse.BodyHandlers.ofString()
.getClass())))
.thenReturn(httpResponse);
final StargateToken stargateToken = new StargateToken(VALID_TEST_URL, VALID_TEST_CREDS, httpClient);
final String resultFirstCheck = stargateToken.apply(TOKEN_APPLY_PLACEHOLDER);
final Instant tokenInstantFirstCheck = StargateToken.TokenKeeper.lastTokenInstant();
assertThat(resultFirstCheck).isEqualTo(TEST_AUTH_TOKEN);
assertThat(tokenInstantFirstCheck).isNotNull();
// --- Subtest 2 - When NOT having an expired token, expect that the lastTokenInstant does NOT change.
when(httpResponse.body()).thenReturn("{ 'authToken': " + "\"" + "refreshed-token" + "\"" + "}");
when(httpResponse.statusCode()).thenReturn(201);
when(httpClient.send(Mockito.any(HttpRequest.class), Mockito.any(HttpResponse.BodyHandlers.ofString()
.getClass())))
.thenReturn(httpResponse);
final String resultSecondCheck = stargateToken.apply(TOKEN_APPLY_PLACEHOLDER);
final Instant tokenInstantSecondCheck = StargateToken.TokenKeeper.lastTokenInstant();
assertThat(resultSecondCheck).isEqualTo(resultFirstCheck);
assertThat(tokenInstantSecondCheck).isEqualTo(tokenInstantFirstCheck);
// --- Subtest 3 - When having an expired token, expect that the lastTokenInstant changes and
// tokens are different.
// Note: Explicit token expiry, default is 30 minutes
StargateToken.setExpired();
final String resultThirdCheck = stargateToken.apply(TOKEN_APPLY_PLACEHOLDER);
final FieldReader fileReaderLastCheck = new FieldReader(stargateToken,
FieldUtils.getDeclaredField(StargateToken.class,
"lastTokenInstant", true));
final Instant tokenInstantThirdCheck = StargateToken.TokenKeeper.lastTokenInstant();
assertThat(tokenInstantThirdCheck.isAfter(tokenInstantFirstCheck)).isTrue();
assertThat(resultSecondCheck).isNotEqualTo(resultThirdCheck);
}
}

View File

@ -13,8 +13,163 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package io.nosqlbench.virtdata.library.basics.shared.unary_string; package io.nosqlbench.virtdata.library.basics.shared.unary_string;
public abstract class TokenTest { import io.nosqlbench.virtdata.library.basics.shared.util.Credentials;
// Intent is to expand for generic (non-Stargate) http-rest test conditions and utils. import org.apache.commons.lang3.reflect.FieldUtils;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.MockedStatic;
import org.mockito.Mockito;
import org.mockito.internal.util.reflection.FieldReader;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.junit.jupiter.MockitoSettings;
import org.mockito.quality.Strictness;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Instant;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
@MockitoSettings(strictness = Strictness.LENIENT)
class TokenTest {
private static final String TEST_AUTH_TOKEN = "8675309";
private static final String VALID_TEST_URL = "http://foobar.com:8675";
private static final String VALID_STARGATE_AUTH_TOKEN_RESPONSE_JSON =
"{ 'authToken': " + "\"" + TEST_AUTH_TOKEN + "\"" + "}";
private static final Credentials VALID_TEST_CREDS = new Credentials("username", "password");
@Mock
private static HttpResponse<String> httpResponse;
@Mock
private static HttpClient httpClient;
private static MockedStatic<HttpClient> HttpCli;
@Mock
private static HttpClient.Builder httpBuilder;
@BeforeAll
public static void init() {
httpResponse = mock(HttpResponse.class);
httpClient = mock(HttpClient.class);
httpBuilder = mock(HttpClient.Builder.class);
HttpCli = Mockito.mockStatic(HttpClient.class);
}
@BeforeEach
public void setup() {
Token.TokenKeeper.reset();
}
@Test
void applyTokenSuccess() throws Exception {
when(httpResponse.body()).thenReturn(VALID_STARGATE_AUTH_TOKEN_RESPONSE_JSON);
when(httpResponse.statusCode()).thenReturn(201);
mockResponse();
final Token token = new Token(null, VALID_TEST_URL, VALID_TEST_CREDS.getUsername(),
VALID_TEST_CREDS.getPassword());
// Since constructor handles state management, the inputs aren't utilized in the apply function.
final String result = token.apply("p1");
assertThat(result).isEqualTo(TEST_AUTH_TOKEN);
}
@Test
void receivedResponse500() throws Exception {
when(httpResponse.body()).thenReturn(VALID_STARGATE_AUTH_TOKEN_RESPONSE_JSON);
when(httpResponse.statusCode()).thenReturn(500);
mockResponse();
assertThatExceptionOfType(SecurityException.class).isThrownBy(() -> new Token(null, VALID_TEST_URL,
VALID_TEST_CREDS.getUsername(), VALID_TEST_CREDS.getPassword()));
}
@Test
void applyTokenSuccessWithRefreshTokenRequested() throws Exception {
Token.TokenKeeper.reset();
when(httpResponse.body()).thenReturn(VALID_STARGATE_AUTH_TOKEN_RESPONSE_JSON);
when(httpResponse.statusCode()).thenReturn(201);
mockResponse();
final Token token = new Token(null, VALID_TEST_URL, VALID_TEST_CREDS.getUsername(),
VALID_TEST_CREDS.getPassword());
final String resultFirstCheck = token.apply("p1");
final Instant tokenInstantFirstCheck = Token.TokenKeeper.lastTokenInstant();
assertThat(resultFirstCheck).isEqualTo(TEST_AUTH_TOKEN);
assertThat(tokenInstantFirstCheck).isNotNull();
// --- Subtest 2 - NOT having an expired token, expect that the lastTokenInstant does NOT change.
when(httpResponse.body()).thenReturn("{ 'authToken': " + "\"" + "refreshed-token" + "\"" + "}");
when(httpResponse.statusCode()).thenReturn(201);
mockResponse();
final String resultSecondCheck = token.apply("p1");
final Instant tokenInstantSecondCheck = Token.TokenKeeper.lastTokenInstant();
assertThat(resultSecondCheck).isEqualTo(resultFirstCheck);
assertThat(tokenInstantSecondCheck).isEqualTo(tokenInstantFirstCheck);
// --- Subtest 3 - Having expired token, expect that the lastTokenInstant changes and
// tokens are different.
// Note: Explicit token expiry, default is 30m
Token.setExpired();
final String resultThirdCheck = token.apply("p1");
final FieldReader fileReaderLastCheck = new FieldReader(token,
FieldUtils.getDeclaredField(Token.class,
"lastTokenInstant", true));
final Instant tokenInstantThirdCheck = Token.TokenKeeper.lastTokenInstant();
assertThat(tokenInstantThirdCheck.isAfter(tokenInstantFirstCheck)).isTrue();
assertThat(resultSecondCheck).isNotEqualTo(resultThirdCheck);
}
@Test
void provideToken() {
final Token token = new Token(TEST_AUTH_TOKEN, VALID_TEST_URL, VALID_TEST_CREDS.getUsername(),
VALID_TEST_CREDS.getPassword());
final String result = token.apply("p1");
assertThat(result).isEqualTo(TEST_AUTH_TOKEN);
final Token token2 = new Token(TEST_AUTH_TOKEN, null, null, null);
final String result2 = token2.apply("p1");
assertThat(result2).isEqualTo(TEST_AUTH_TOKEN);
}
private void mockResponse() throws Exception {
HttpCli.when(HttpClient::newBuilder).thenReturn(httpBuilder);
when(httpBuilder.build()).thenReturn(httpClient);
when(httpClient.send(Mockito.any(HttpRequest.class),
Mockito.any(HttpResponse.BodyHandlers.ofString().getClass())))
.thenReturn(httpResponse);
}
} }