-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NoSQLBench workloads - auto token generation #358
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
min_version: "4.17.15" | ||
min_version: "5.17.1" | ||
|
||
# nb5 -v run driver=http yaml=http-jsonapi-crud-basic jsonapi_host=my_jsonapi_host auth_token=$AUTH_TOKEN | ||
|
||
description: | | ||
description: >2 | ||
This workload emulates CRUD operations for the Stargate JSON API. | ||
It generates a simple JSON document to be used for writes and updates. | ||
Note that jsonapi_port should reflect the port where the JSON API is exposed (defaults to 8080). | ||
|
@@ -21,13 +21,14 @@ bindings: | |
# single host: jsonapi_host=host1 | ||
# multiple hosts: jsonapi_host=host1,host2,host3 | ||
# multiple weighted hosts: jsonapi_host=host1:3,host2:7 | ||
weighted_hosts: WeightedStrings('<<jsonapi_host:jsonapi>>') | ||
weighted_hosts: WeightedStrings('<<jsonapi_host:stargate>>') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am still like why don't we have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm going to revert this change for consistency |
||
|
||
# spread into different spaces to use multiple connections | ||
space: HashRange(1,<<connections:20>>); ToString(); | ||
|
||
# http request id | ||
request_id: ToHashedUUID(); ToString(); | ||
token: Discard(); Token('<<auth_token:>>','<<uri:http://localhost:8081/v1/auth>>', '<<uid:cassandra>>', '<<pswd:cassandra>>'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will this do an auth request on each cycle? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, NB caches the token There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good. but can you add a small comment here, explaining what the parameters are.. I guess first parameter is token given from the command line and if given, don't call the auth api? In addition it's good to know that the result of the token is saved in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added comment |
||
|
||
seq_key: Mod(<<docscount:10000000>>); ToString() -> String | ||
random_key: Uniform(0,<<docscount:10000000>>); ToString() -> String | ||
|
@@ -51,10 +52,10 @@ blocks: | |
uri: <<protocol:http>>://{weighted_hosts}:<<jsonapi_port:8080>><<path_prefix:>>/v1 | ||
Accept: "application/json" | ||
X-Cassandra-Request-Id: "{request_id}" | ||
X-Cassandra-Token: "<<auth_token:my_auth_token>>" | ||
X-Cassandra-Token: "{token}" | ||
Content-Type: "application/json" | ||
ok-body: ".*\"ok\":1.*" | ||
body: | | ||
body: >2 | ||
{ | ||
"createNamespace": { | ||
"name": "<<namespace:jsonapi_crud_basic>>" | ||
|
@@ -66,10 +67,10 @@ blocks: | |
uri: <<protocol:http>>://{weighted_hosts}:<<jsonapi_port:8080>><<path_prefix:>>/v1/<<namespace:jsonapi_crud_basic>> | ||
Accept: "application/json" | ||
X-Cassandra-Request-Id: "{request_id}" | ||
X-Cassandra-Token: "<<auth_token:my_auth_token>>" | ||
X-Cassandra-Token: "{token}" | ||
Content-Type: "application/json" | ||
ok-body: ".*\"ok\":1.*" | ||
body: | | ||
body: >2 | ||
{ | ||
"deleteCollection": { | ||
"name": "<<collection:docs_collection>>" | ||
|
@@ -81,10 +82,10 @@ blocks: | |
uri: <<protocol:http>>://{weighted_hosts}:<<jsonapi_port:8080>><<path_prefix:>>/v1/<<namespace:jsonapi_crud_basic>> | ||
Accept: "application/json" | ||
X-Cassandra-Request-Id: "{request_id}" | ||
X-Cassandra-Token: "<<auth_token:my_auth_token>>" | ||
X-Cassandra-Token: "{token}" | ||
Content-Type: "application/json" | ||
ok-body: ".*\"ok\":1.*" | ||
body: | | ||
body: >2 | ||
{ | ||
"createCollection": { | ||
"name": "<<collection:docs_collection>>" | ||
|
@@ -100,10 +101,10 @@ blocks: | |
uri: <<protocol:http>>://{weighted_hosts}:<<jsonapi_port:8080>><<path_prefix:>>/v1/<<namespace:jsonapi_crud_basic>>/<<collection:docs_collection>> | ||
Accept: "application/json" | ||
X-Cassandra-Request-Id: "{request_id}" | ||
X-Cassandra-Token: "<<auth_token:my_auth_token>>" | ||
X-Cassandra-Token: "{token}" | ||
Content-Type: "application/json" | ||
ok-body: ".*\"insertedIds\":\"{seq_key}\".*" | ||
body: | | ||
body: >2 | ||
{ | ||
"insertOne" : { | ||
"document" : { | ||
|
@@ -141,10 +142,10 @@ blocks: | |
uri: <<protocol:http>>://{weighted_hosts}:<<jsonapi_port:8080>><<path_prefix:>>/v1/<<namespace:jsonapi_crud_basic>>/<<collection:docs_collection>> | ||
Accept: "application/json" | ||
X-Cassandra-Request-Id: "{request_id}" | ||
X-Cassandra-Token: "<<auth_token:my_auth_token>>" | ||
X-Cassandra-Token: "{token}" | ||
Content-Type: "application/json" | ||
ok-body: ".*\"data\".*" | ||
body: | | ||
body: >2 | ||
{ | ||
"findOne" : { | ||
"filter" : { | ||
|
@@ -163,13 +164,13 @@ blocks: | |
uri: <<protocol:http>>://{weighted_hosts}:<<jsonapi_port:8080>><<path_prefix:>>/v1/<<namespace:jsonapi_crud_basic>>/<<collection:docs_collection>> | ||
Accept: "application/json" | ||
X-Cassandra-Request-Id: "{request_id}" | ||
X-Cassandra-Token: "<<auth_token:my_auth_token>>" | ||
X-Cassandra-Token: "{token}" | ||
Content-Type: "application/json" | ||
# because this is not an upsert, modified count could technically be 0 or 1, | ||
# but since we are fixing the _ids to be sequential over the docscount range during the write phase, | ||
# every update during this phase should update exactly 1 document. | ||
ok-body: ".*\"modifiedCount\":1.*" | ||
body: | | ||
body: >2 | ||
{ | ||
"updateOne" : { | ||
"filter": { | ||
|
@@ -211,10 +212,10 @@ blocks: | |
uri: <<protocol:http>>://{weighted_hosts}:<<jsonapi_port:8080>><<path_prefix:>>/v1/<<namespace:jsonapi_crud_basic>>/<<collection:docs_collection>> | ||
Accept: "application/json" | ||
X-Cassandra-Request-Id: "{request_id}" | ||
X-Cassandra-Token: "<<auth_token:my_auth_token>>" | ||
X-Cassandra-Token: "{token}" | ||
Content-Type: "application/json" | ||
ok-body: ".*\"deletedCount\":[0,1].*" | ||
body: | | ||
body: >2 | ||
{ | ||
"deleteOne" : { | ||
"filter" : { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this change wanted? what s
>2
doing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a convention that Jeff Banks added to the equivalent Docs API tests in the main nosqlbench repo. I think it means that what follows is structured data with 2 space indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's a YAML feature, where there's a myriad of ways to specify how text blocks are included (String values, not YAML markup -- often embedded JSON, XML, CSV, shell scripts)
Which can be convenient but also confusing until you learn all of them when someone uses them (at least I find them confusing).