diff --git a/driver-http/src/main/resources/activities/baselines/http-iot.yaml b/driver-http/src/main/resources/activities/baselines/http-iot.yaml new file mode 100644 index 000000000..dda344b73 --- /dev/null +++ b/driver-http/src/main/resources/activities/baselines/http-iot.yaml @@ -0,0 +1,117 @@ +# nb -v run driver=http yaml=http-iot tags=phase:schema stargate_host=my_stargate_host +description: | + This workload emulates a time-series data model and access patterns. + This should be identical to the cql variant except for: + - We can't specify the write timestamp to make the write idempotent like we can with cql. + - The `time` binding has to have a StringDateWrapper to get the exact format that the REST API needs; See https://github.com/stargate/stargate/issues/532. + - We need to URLEncode the `data` binding because newlines can't be sent in REST calls. + - Schema creation is cql of the lack of being able to define compaction strategy in the REST API. + - There is no instrumentation with the http driver. + - There is no async mode with the http driver. + +scenarios: + default: + - run driver=cql tags==phase:schema threads==1 cycles==UNDEF + - run driver=http tags==phase:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto + - run driver=http tags==phase:main cycles===TEMPLATE(main-cycles,10000000) threads=auto +bindings: + # http request id + request_id: ToHashedUUID(); ToString(); + + machine_id: Mod(<>); ToHashedUUID() -> java.util.UUID + sensor_name: HashedLineToString('data/variable_words.txt') + time: Mul(<>L); Div(<>L); StringDateWrapper("yyyy-MM-dd'T'hh:mm:ss'Z"); + sensor_value: Normal(0.0,5.0); Add(100.0) -> double + station_id: Div(<>);Mod(<>); ToHashedUUID() -> java.util.UUID + data: HashedFileExtractToString('data/lorem_ipsum_full.txt',800,1200); URLEncode(); +blocks: + - tags: + phase: schema + params: + prepared: false + statements: + - create-keyspace: | + create keyspace if not exists <> + WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '<>'} + AND durable_writes = true; + tags: + name: create-keyspace + - create-table : | + create table if not exists <>.<> ( + machine_id UUID, // source machine + sensor_name text, // sensor name + time timestamp, // timestamp of collection + sensor_value double, // + station_id UUID, // source location + data text, + PRIMARY KEY ((machine_id, sensor_name), time) + ) WITH CLUSTERING ORDER BY (time DESC) + AND compression = { 'sstable_compression' : '<>' } + AND compaction = { + 'class': 'TimeWindowCompactionStrategy', + 'compaction_window_size': <>, + 'compaction_window_unit': 'MINUTES' + }; + tags: + name: create-table + - truncate-table: | + truncate table <>.<>; + tags: + name: truncate-table + - name: rampup + tags: + phase: rampup + statements: + - rampup-insert: POST http://<>:<>/v2/keyspaces/<>/<> + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + body: | + { + "machine_id": "{machine_id}", + "sensor_name": "{sensor_name}", + "time": "{time}", + "sensor_value": "{sensor_value}", + "station_id": "{station_id}", + "data": "{data}" + } + tags: + name: rampup-insert + - name: main-read + tags: + phase: main + type: read + params: + ratio: <> + statements: + - main-select: GET /v2/keyspaces/<>/<>?where=E[[{"machine_id":{"$eq":"{machine_id}"}},"sensor_name":{"$eq":"{sensor_name}"},"page-size":{"$eq":"<>"}}]] + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + tags: + name: main-select + - name: main-write + tags: + phase: main + type: write + params: + ratio: <> + statements: + - main-write: POST http://<>:<>/v2/keyspaces/<>/<> + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + body: | + { + "machine_id": "{machine_id}" + "sensor_name": "{sensor_name}", + "time": "{time}", + "sensor_value": "{sensor_value}", + "station_id": "{station_id}", + "data": "{data}" + } + tags: + name: main-write diff --git a/driver-http/src/main/resources/activities/baselines/http-keyvalue.yaml b/driver-http/src/main/resources/activities/baselines/http-keyvalue.yaml new file mode 100644 index 000000000..34939cef2 --- /dev/null +++ b/driver-http/src/main/resources/activities/baselines/http-keyvalue.yaml @@ -0,0 +1,112 @@ +# nb -v run driver=http yaml=http-keyvalue tags=phase:schema stargate_host=my_stargate_host +description: | + This workload emulates a key-value data model and access patterns. + This should be identical to the cql variant except for: + - There is no instrumentation with the http driver. + - There is no async mode with the http driver. + +scenarios: + default: + - run driver=http tags==phase:schema threads==1 cycles==UNDEF + - run driver=http tags==phase:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto + - run driver=http tags==phase:main cycles===TEMPLATE(main-cycles,10000000) threads=auto +bindings: + # http request id + request_id: ToHashedUUID(); ToString(); + + seq_key: Mod(<>); ToString() -> String + seq_value: Hash(); Mod(<>); ToString() -> String + rw_key: <int>>; ToString() -> String + rw_value: Hash(); <int>>; ToString() -> String + +blocks: + - name: schema + tags: + phase: schema + statements: + - create-keyspace: POST http://<>:<>/v2/schemas/keyspaces + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + body: | + { + "name": "<>" + } + tags: + name: create-keyspace + - create-table: POST http://<>:<>/v2/schemas/keyspaces/<>/tables + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + body: | + { + "name": "<>", + "columnDefinitions": + [ + { + "name": "key", + "typeDefinition": "text" + }, + { + "name": "value", + "typeDefinition": "text" + } + ], + "primaryKey": + { + "partitionKey": ["key"] + } + } + tags: + name: create-table + - name: rampup + tags: + phase: rampup + statements: + - rampup-insert: POST http://<>:<>/v2/keyspaces/<>/<> + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + body: | + { + "key": "{seq_key}", + "value": "{seq_value}" + } + tags: + name: rampup-insert + - name: main-read + tags: + phase: main + type: read + params: + ratio: 5 + statements: + - main-select: GET /v2/keyspaces/<>/<>?where=E[[{"key":{"$eq":"{rw_key}"}}}]] + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + tags: + name: main-select + - name: main-write + tags: + phase: main + type: write + params: + ratio: 5 + statements: + - main-write: POST http://<>:<>/v2/keyspaces/<>/<> + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + body: | + { + "key": "{rw_key}" + "value": "{rw_value}" + } + tags: + name: main-write diff --git a/driver-http/src/main/resources/activities/baselines/http-tabular.yaml b/driver-http/src/main/resources/activities/baselines/http-tabular.yaml new file mode 100644 index 000000000..1e3c08d30 --- /dev/null +++ b/driver-http/src/main/resources/activities/baselines/http-tabular.yaml @@ -0,0 +1,127 @@ +# nb -v http-tabular rampup-cycles=1E6 main-cycles=1E9 stargate_host=my_stargate_host +description: | + This workload emulates a time-series data model and access patterns. + This should be identical to the cql variant except for: + - We need to URLEncode the `data` and `data_write` bindings because newlines can't be sent in REST calls. + - There is no instrumentation with the http driver. + - There is no async mode with the http driver. + +scenarios: + default: + - run driver=http tags==phase:schema threads==1 cycles==UNDEF + - run driver=http tags==phase:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto + - run driver=http tags==phase:main cycles===TEMPLATE(main-cycles,10000000) threads=auto +bindings: + # http request id + request_id: ToHashedUUID(); ToString(); + # for ramp-up and verify + part_layout: Div(<>); ToString() -> String + clust_layout: Mod(<>); ToString() -> String + data: HashedFileExtractToString('data/lorem_ipsum_full.txt',50,150); URLEncode(); + # for read + limit: Uniform(1,10) -> int + part_read: Uniform(0,<>)->int; ToString() -> String + clust_read: Add(1); Uniform(0,<>)->int; ToString() -> String + # for write + part_write: Hash(); Uniform(0,<>)->int; ToString() -> String + clust_write: Hash(); Add(1); Uniform(0,<>)->int; ToString() -> String + data_write: Hash(); HashedFileExtractToString('data/lorem_ipsum_full.txt',50,150); URLEncode(); + +blocks: + - name: schema + tags: + phase: schema + statements: + - create-keyspace: POST http://<>:<>/v2/schemas/keyspaces + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + body: | + { + "name": "<>" + } + tags: + name: create-keyspace + - create-table: POST http://<>:<>/v2/schemas/keyspaces/<>/tables + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + body: | + { + "name": "<>", + "columnDefinitions": + [ + { + "name": "part", + "typeDefinition": "text" + }, + { + "name": "clust", + "typeDefinition": "text" + }, + { + "name": "data", + "typeDefinition": "text" + } + ], + "primaryKey": + { + "partitionKey": ["part"], + "clusteringKey": ["clust"] + } + } + tags: + name: create-table + - name: rampup + tags: + phase: rampup + statements: + - rampup-insert: POST http://<>:<>/v2/keyspaces/<>/<> + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + body: | + { + "part": "{part_layout}", + "clust": "{clust_layout}", + "data": "{data}" + } + tags: + name: rampup-insert + - name: main-read + tags: + phase: main + type: read + params: + ratio: 5 + statements: + - main-select: GET /v2/keyspaces/<>/<>?where=E[[{"part":{"$eq":"{part_layout}"}},"page-size":{"$eq":"{limit}"}}]] + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + tags: + name: main-select + - name: main-write + tags: + phase: main + type: write + params: + ratio: 5 + statements: + - main-write: POST http://<>:<>/v2/keyspaces/<>/<> + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + X-Cassandra-Token: "<>" + Content-Type: "application/json" + body: | + { + "part": "{part_write}" + "clust": "{clust_write}", + "data": "{data_write}" + } + tags: + name: main-write