From 32fef39d41d99d603b700af198b848f7c0ebfc7f Mon Sep 17 00:00:00 2001 From: Eric Borczuk Date: Fri, 5 Nov 2021 16:24:57 -0400 Subject: [PATCH] Schema and rampup phase working --- .../http-docsapi-search-basic.yaml | 172 ++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 driver-http/src/main/resources/activities/documents-api/http-docsapi-search-basic.yaml diff --git a/driver-http/src/main/resources/activities/documents-api/http-docsapi-search-basic.yaml b/driver-http/src/main/resources/activities/documents-api/http-docsapi-search-basic.yaml new file mode 100644 index 000000000..79200c7e8 --- /dev/null +++ b/driver-http/src/main/resources/activities/documents-api/http-docsapi-search-basic.yaml @@ -0,0 +1,172 @@ +# nb -v run driver=http yaml=http-docsapi-search-basic tags=phase:schema stargate_host=my_stargate_host auth_token=$AUTH_TOKEN + +description: | + This workload emulates basic search operations for the Stargate Documents API. + During the rampup phase, it generates documents, writes them to a table, and then warms up the search paths. + During the main phase it performs various basic search filters and times their execution. + Note that stargate_port should reflect the port where the Docs API is exposed (defaults to 8082). + +scenarios: + schema: run driver=http tags==phase:schema threads==<> cycles==UNDEF + rampup-write: run driver=http tags==phase:rampup-write cycles===TEMPLATE(docscount,10000000) docsize=TEMPLATE(docsize,15) match-ratio=TEMPLATE(match-ratio,0.01) threads=<> errors=timer,warn + rampup-read: run driver=http tags==phase:rampup-read cycles===TEMPLATE(rampup-cycles, 10000000) page-size=TEMPLATE(page-size,3) threads=<> errors=timer,warn + read-eq: run driver=http tags==phase:main,type:write cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields, UNSET) threads=auto errors=timer,warn + # read-lt: run driver=http tags==phase:main,type:read cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) match-ratio=TEMPLATE(match-ratio,0.01) fields=TEMPLATE(fields, UNSET) threads=auto errors=timer,warn + # read-and: run driver=http tags==phase:main,type:read cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) match-ratio=TEMPLATE(match-ratio,0.01) fields=TEMPLATE(fields, UNSET) threads=auto errors=timer,warn + # read-or: run driver=http tags==phase:main,type:read cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) match-ratio=TEMPLATE(match-ratio,0.01) fields=TEMPLATE(fields, UNSET) threads=auto errors=timer,warn + +bindings: + # To enable an optional weighted set of hosts in place of a load balancer + # Examples + # single host: stargate_host=host1 + # multiple hosts: stargate_host=host1,host2,host3 + # multiple weighted hosts: stargate_host=host1:3,host2:7 + weighted_hosts: WeightedStrings('<>') + # http request id + request_id: ToHashedUUID(); ToString(); + + seq_key: Mod(<>); ToString() -> String + random_key: Uniform(0,<>); ToString() -> String + + user_id: ToHashedUUID(); ToString() -> String + created_on: Uniform(1262304000,1577836800) -> long + gender: WeightedStrings('M:10;F:10;O:1') + full_name: FullNames() + married: ModuloToBoolean() + city: Cities() + country_code: CountryCodes() + lat: Uniform(-180d, 180d) + lng: Hash() -> long; Uniform(-180d, 180d) + friend_id: Add(-1); ToHashedUUID(); ToString() -> String + + match1: Expr('if (cycle % (int)(1 / <>) == 0) { return 0; } return (int)(Math.random() * 10000 + 1000);') -> long + match2: Expr('if (cycle % (int)(1 / <>) == 0) { return "match" } return "no match";') -> String + additional_fields: Expr('str="";for (int i=0; i < TEMPLATE(docsize,15) - 15; i++) { if (str == "") { str = "," }; str+="\"value"+i+"\":0"; if (i < TEMPLATE(docsize,15) - 16) {str += ","}} return str;') -> String + +blocks: + - tags: + phase: schema + statements: + - create-keyspace: POST <>://{weighted_hosts}:<><>/v2/schemas/keyspaces + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + body: | + { + "name": "<>", + "replicas": <> + } + tags: + name: create-keyspace + + - delete-docs-collection: DELETE <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<> + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + tags: + name: delete-table + ok-status: "[2-4][0-9][0-9]" + + - create-docs-collection: POST <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + body: | + { + "name": "<>" + } + tags: + name: create-table + + - name: rampup-write + tags: + phase: rampup-write + statements: + - rampup-insert: PUT <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>/{seq_key} + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + body: | + { + "user_id": "{user_id}", + "created_on": {created_on}, + "gender": "{gender}", + "full_name": "{full_name}", + "married": {married}, + "address": { + "primary": { + "city": "{city}", + "cc": "{country_code}" + }, + "secondary": {} + }, + "coordinates": [ + {lat}, + {lng} + ], + "children": [], + "friends": [ + "{friend_id}" + ], + "debt": null, + "match1": {match1}, + "match2": "{match2}" + {additional_fields} + } + tags: + name: rampup-insert + + - name: rampup-eq + tags: + phase: rampup-read + filter: eq + statements: + - rampup-eq: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=%7B%22match1%22%3A%7B%22%24eq%22%3A0%7D%7D&page-size=<> + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + tags: + name: rampup-eq + + - name: rampup-lt + tags: + phase: rampup-read + filter: lt + statements: + - rampup-lt: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=%7B%22match1%22%3A%7B%22%24eq%22%3A1%7D%7D&page-size=<> + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + tags: + name: rampup-lt + + - name: rampup-and + tags: + phase: rampup-read + filter: and + statements: + - rampup-and: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=%7B%22match1%22%3A%7B%22%24lt%22%3A1%7D%2C%22match2%22%3A%7B%22%24eq%22%3A%22match%22%7D%7D&page-size=<> + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + tags: + name: rampup-and + + - name: rampup-or + tags: + phase: rampup-read + filter: or + statements: + - rampup-or: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=%7B%22%24or%22%3A%5B%7B%22match1%22%3A%7B%22%24lt%22%3A1%7D%7D%2C%7B%22match2%22%3A%7B%22%24eq%22%3A%22match%22%7D%7D%5D%7D&page-size=<> + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + tags: + name: rampup-or