From 08e4ff095d284291c7d73895e215e37374eb78f8 Mon Sep 17 00:00:00 2001 From: Eric Borczuk Date: Wed, 10 Nov 2021 15:21:30 -0500 Subject: [PATCH] Add README, remove all expr --- .../http-docsapi-search-advanced.md | 67 +++++++++++++++++++ .../http-docsapi-search-advanced.yaml | 10 +-- .../http-docsapi-search-basic.md | 66 ++++++++++++++++++ .../http-docsapi-search-basic.yaml | 24 +++---- 4 files changed, 150 insertions(+), 17 deletions(-) create mode 100644 driver-http/src/main/resources/activities/documents-api/http-docsapi-search-advanced.md create mode 100644 driver-http/src/main/resources/activities/documents-api/http-docsapi-search-basic.md diff --git a/driver-http/src/main/resources/activities/documents-api/http-docsapi-search-advanced.md b/driver-http/src/main/resources/activities/documents-api/http-docsapi-search-advanced.md new file mode 100644 index 000000000..286620f03 --- /dev/null +++ b/driver-http/src/main/resources/activities/documents-api/http-docsapi-search-advanced.md @@ -0,0 +1,67 @@ +--- +title: Documents API Search Advanced +weight: 2 +--- + +## Description + +The Documents API Search Advanced workflow targets Stargate's Documents API using generated JSON documents. Specifically, it looks to benchmark more advanced search cases, using both complex boolean logic and filters that aren't natively supported by the underlying data store. +By default, the documents used are sharing the same structure and are approximately half a kilobyte in size each: + +* Each document has 15 leaf values, with a maximum depth of 3 +* there is at least one `string`, `boolean`, `number` and `null` leaf +* there is one array with `double` values and one with `string` values +* there is one empty array and one empty map + +The example JSON looks like: + +```json +{ + "user_id":"56fd76f6-081d-401a-85eb-b1d9e5bba058", + "created_on":1476743286, + "full_name":"Andrew Daniels", + "married":true, + "address":{ + "primary":{ + "cc":"IO", + "city":"Okmulgee" + }, + "secondary":{ + + } + }, + "coordinates":[ + 64.65964627052323, + -122.35334535072856 + ], + "children":[ + + ], + "friends":[ + "3df498b1-9568-4584-96fd-76f6081da01a" + ], + "debt":null, + "match1": 0, // or 1000 + "match2": "true", // or "false" + "match3": true // or false +} +``` + +## Filters tested + +The advanced search workload can test the following `where` clauses: +- in: match1 IN [0] +- not-in: match2 NOT IN ["false"] +- mem-and: match2 EQ "true" AND match3 NOT EQ false +- mem-or: match1 LT 1 OR match3 EXISTS +- complex1: match1 EQ 0 AND (match2 EQ "true" OR match3 EQ false) +- complex2: (match1 LTE 0 OR match2 EQ "false") AND (match2 EQ "false" OR match3 EQ true) +- complex3: (match1 LTE 0 AND match2 EQ "true") OR (match2 EQ "false" AND match3 EQ true) + +## Workload Parameters + +- `docscount` - the number of documents to write during rampup (default: `10_000_000`) +- `docpadding` - the number of fields to add to each document; useful for writing larger documents. A value of e.g. `5` would make each document have 20 leaf values, instead of 15. (default: `0`) +- `match-ratio` - a value between 0 and 1 detailing what ratio of the documents written should match the search parameters. If match-ratio is e.g. `0.1` then approximately one-tenth of the documents will have `match1`, `match2`, and `match3` values that are `0`, `"true"`, and `true`, respectively. (default: `0.01`) + + diff --git a/driver-http/src/main/resources/activities/documents-api/http-docsapi-search-advanced.yaml b/driver-http/src/main/resources/activities/documents-api/http-docsapi-search-advanced.yaml index 504c403a0..e375d2953 100644 --- a/driver-http/src/main/resources/activities/documents-api/http-docsapi-search-advanced.yaml +++ b/driver-http/src/main/resources/activities/documents-api/http-docsapi-search-advanced.yaml @@ -16,7 +16,7 @@ description: | # complex3: (match1 LTE 0 AND match2 EQ "true") OR (match2 EQ "false" AND match3 EQ true) 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-write: run driver=http tags==phase:rampup-write cycles===TEMPLATE(docscount,10000000) docpadding=TEMPLATE(docpadding,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) fields=TEMPLATE(fields,%5b%5d) threads=<> errors=timer,warn main: run driver=http tags==phase:main cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<> errors=timer,warn main-in: run driver=http tags==phase:main,filter:in cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<> errors=timer,warn @@ -50,11 +50,11 @@ bindings: 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 "true" } return "false";') -> String - match3: Expr('if (cycle % (int)(1 / <>) == 0) { return "true" } return "false";') -> String + match1: Identity(); CoinFunc(<>, FixedValue(0), FixedValue(1000)) + match2: Identity(); CoinFunc(<>, FixedValue("true"), FixedValue("false")) + match3: Identity(); CoinFunc(<>, FixedValue("true"), FixedValue("false")) - 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 + additional_fields: ListSizedStepped(<>,Template("\"{}\":{}",Identity(),Identity())); ToString(); ReplaceAll('\[\"', ',\"'); ReplaceAll('\[', ''); ReplaceAll('\]', '') -> String blocks: - tags: diff --git a/driver-http/src/main/resources/activities/documents-api/http-docsapi-search-basic.md b/driver-http/src/main/resources/activities/documents-api/http-docsapi-search-basic.md new file mode 100644 index 000000000..70c6bf425 --- /dev/null +++ b/driver-http/src/main/resources/activities/documents-api/http-docsapi-search-basic.md @@ -0,0 +1,66 @@ +--- +title: Documents API Search Basic +weight: 2 +--- + +## Description + +The Documents API Search Basic workflow targets Stargate's Documents API using generated JSON documents. Specifically, it looks to benchmark basic search cases, using the filters that are supported by the underlying data store. +By default, the documents used are sharing the same structure and are approximately half a kilobyte in size each: + +* Each document has 15 leaf values, with a maximum depth of 3 +* there is at least one `string`, `boolean`, `number` and `null` leaf +* there is one array with `double` values and one with `string` values +* there is one empty array and one empty map + +The example JSON looks like: + +```json +{ + "user_id":"56fd76f6-081d-401a-85eb-b1d9e5bba058", + "created_on":1476743286, + "full_name":"Andrew Daniels", + "married":true, + "address":{ + "primary":{ + "cc":"IO", + "city":"Okmulgee" + }, + "secondary":{ + + } + }, + "coordinates":[ + 64.65964627052323, + -122.35334535072856 + ], + "children":[ + + ], + "friends":[ + "3df498b1-9568-4584-96fd-76f6081da01a" + ], + "debt":null, + "match1": 0, // or 1000 + "match2": "true", // or "false" + "match3": true // or false +} +``` + +## Filters tested + +The basic search workload can test the following `where` clauses: +- eq: match3 EQ true +- lt: match1 LT 1 +- and: match1 LT 1 AND match2 EQ "true" +- or: match1 LT 1 OR match2 EQ "true" or match3 EQ true +- or-single-match: match1 LT 1 OR match2 EQ "notamatch" + +## Workload Parameters + +- `docscount` - the number of documents to write during rampup (default: `10_000_000`) +- `docpadding` - the number of fields to add to each document; useful for writing larger documents. A value of e.g. `5` would make each document have 20 leaf values, instead of 15. (default: `0`) +- `match-ratio` - a value between 0 and 1 detailing what ratio of the documents written should match the search parameters. If match-ratio is e.g. `0.1` then approximately one-tenth of the documents will have `match1`, `match2`, and `match3` values that are `0`, `"true"`, and `true`, respectively. (default: `0.01`) +- `fields` - the URL-encoded value for `fields` that you would send to the Docs API. This restricts the fields returned during benchmarking. + + 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 index 0d1064553..dee18f701 100644 --- 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 @@ -8,7 +8,7 @@ description: | 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-write: run driver=http tags==phase:rampup-write cycles===TEMPLATE(docscount,10000000) docpadding=TEMPLATE(docpadding,0) 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) fields=TEMPLATE(fields,%5b%5d) threads=<> errors=timer,warn main: run driver=http tags==phase:main cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<> errors=timer,warn main-eq: run driver=http tags==phase:main,filter:eq cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<> errors=timer,warn @@ -40,9 +40,9 @@ bindings: 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 "true" } return "false";') -> 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 + match1: Identity(); CoinFunc(<>, FixedValue(0), FixedValue(1000)) + match2: Identity(); CoinFunc(<>, FixedValue("true"), FixedValue("false")) + additional_fields: ListSizedStepped(<>,Template("\"{}\":{}",Identity(),Identity())); ToString(); ReplaceAll('\[\"', ',\"'); ReplaceAll('\[', ''); ReplaceAll('\]', '') -> String blocks: - tags: @@ -153,8 +153,8 @@ blocks: phase: rampup-read filter: and statements: - # where={"match1":{"$lt":1},"match2":{"$eq":"match"}} - - 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=<>&fields=<> + # where={"match1":{"$lt":1},"match2":{"$eq":"true"}} + - 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%22true%22%7D%7D&page-size=<>&fields=<> Accept: "application/json" X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Token: "<>" @@ -167,8 +167,8 @@ blocks: phase: rampup-read filter: or statements: - # where={"$or":[{"match1":{"$lt":1}},{"match2":{"$eq":"match"}},{"match3":{"$eq":true}}]} - - 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%2C%7B%22match3%22%3A%7B%22%24eq%22%3Atrue%7D%7D%5D%7D&page-size=<>&fields=<> + # where={"$or":[{"match1":{"$lt":1}},{"match2":{"$eq":"true"}},{"match3":{"$eq":true}}]} + - 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%22true%22%7D%7D%2C%7B%22match3%22%3A%7B%22%24eq%22%3Atrue%7D%7D%5D%7D&page-size=<>&fields=<> Accept: "application/json" X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Token: "<>" @@ -223,8 +223,8 @@ blocks: phase: main filter: and statements: - # where={"match1":{"$lt":1},"match2":{"$eq":"match"}} - - main-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%2C%22match3%22%3A%7B%22%24eq%22%3A%20true%7D%7D&page-size=<>&fields=<> + # where={"match1":{"$lt":1},"match2":{"$eq":"true"}} + - main-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%22true%22%7D%2C%22match3%22%3A%7B%22%24eq%22%3A%20true%7D%7D&page-size=<>&fields=<> Accept: "application/json" X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Token: "<>" @@ -237,8 +237,8 @@ blocks: phase: main filter: or statements: - # where={"$or":[{"match1":{"$lt":1}},{"match2":{"$eq":"match"}},{"match3":{"$eq":true}}]} - - main-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%2C%7B%22match3%22%3A%7B%22%24eq%22%3Atrue%7D%7D%5D%7D&page-size=<>&fields=<> + # where={"$or":[{"match1":{"$lt":1}},{"match2":{"$eq":"true"}},{"match3":{"$eq":true}}]} + - main-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%22true%22%7D%7D%2C%7B%22match3%22%3A%7B%22%24eq%22%3Atrue%7D%7D%5D%7D&page-size=<>&fields=<> Accept: "application/json" X-Cassandra-Request-Id: "{request_id}" X-Cassandra-Token: "<>"