From ee71de9bf59c616767e084ac18aac0f937a5dd0d Mon Sep 17 00:00:00 2001 From: Kathiresan Selvaraj Date: Mon, 30 Sep 2024 12:17:55 -0400 Subject: [PATCH 1/5] Added API tables kv nb test and fixed docker compose scripts --- docker-compose/docker-compose-hcd.yml | 3 +- docker-compose/start_dse69.sh | 2 +- docker-compose/start_hcd.sh | 4 +- nosqlbench/http-dataapi-tables-keyvalue.yaml | 166 +++++++++++++++++++ 4 files changed, 171 insertions(+), 4 deletions(-) create mode 100644 nosqlbench/http-dataapi-tables-keyvalue.yaml diff --git a/docker-compose/docker-compose-hcd.yml b/docker-compose/docker-compose-hcd.yml index eaca6e5d6a..5eedff7f38 100644 --- a/docker-compose/docker-compose-hcd.yml +++ b/docker-compose/docker-compose-hcd.yml @@ -82,12 +82,13 @@ services: - JAVA_MAX_MEM_RATIO=75 - JAVA_INITIAL_MEM_RATIO=50 - GC_CONTAINER_OPTIONS=-XX:+UseG1GC - - STARGATE_JSONAPI_OPERATIONS_DATABASE_CONFIG_CASSANDRA_END_POINTS=hcd + - STARGATE_JSONAPI_OPERATIONS_DATABASE_CONFIG_CASSANDRA_END_POINTS=hcd-1 - STARGATE_JSONAPI_OPERATIONS_DATABASE_CONFIG_LOCAL_DATACENTER=dc1 - QUARKUS_HTTP_ACCESS_LOG_ENABLED=${REQUESTLOG} - QUARKUS_LOG_LEVEL=${LOGLEVEL} - STARGATE_JSONAPI_OPERATIONS_VECTORIZE_ENABLED=true - JAVA_OPTS_APPEND=-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager + - STARGATE_FEATURE_FLAGS_TABLES=true healthcheck: test: curl -f http://localhost:8181/stargate/health || exit 1 interval: 5s diff --git a/docker-compose/start_dse69.sh b/docker-compose/start_dse69.sh index c4960c2cb0..ce9f15b73b 100755 --- a/docker-compose/start_dse69.sh +++ b/docker-compose/start_dse69.sh @@ -11,7 +11,7 @@ LOGLEVEL=INFO # Default to latest released version DATAAPITAG="v1" -DATAAPIIMAGE="stargateio/data-api" +DATAAPIIMAGE="stargateio/jsonapi" DSETAG="6.9.1" DSEIMAGE="cr.dtsx.io/datastax/dse-server" diff --git a/docker-compose/start_hcd.sh b/docker-compose/start_hcd.sh index b4d87c83fa..b58f39337d 100755 --- a/docker-compose/start_hcd.sh +++ b/docker-compose/start_hcd.sh @@ -11,7 +11,7 @@ LOGLEVEL=INFO # Default to latest released version DATAAPITAG="v1" -DATAAPIIMAGE="stargateio/data-api" +DATAAPIIMAGE="stargateio/jsonapi" HCDTAG="1.0.0" HCDIMAGE="cr.dtsx.io/datastax/hcd" @@ -80,4 +80,4 @@ else else docker compose -f docker-compose-hcd.yml up -d --wait fi -fi \ No newline at end of file +fi diff --git a/nosqlbench/http-dataapi-tables-keyvalue.yaml b/nosqlbench/http-dataapi-tables-keyvalue.yaml new file mode 100644 index 0000000000..02e802696d --- /dev/null +++ b/nosqlbench/http-dataapi-tables-keyvalue.yaml @@ -0,0 +1,166 @@ +min_version: "5.17.3" + +# Example command line (when Stargate is running on localhost): +# nb5 -v http-dataapi-keyvalue dataapi_host=localhost rowscount=20000 threads=20 + +description: >2 + This workload emulates a key-value data model and access patterns. + This should be identical to the cql variant except for: + - Schema creation with the Data API + - There is no instrumentation with the http driver. + - There is no async mode with the http driver. + Note that dataapi_port should reflect the port where the Data API is exposed (defaults to 8181). + +scenarios: + default: + schema: run driver=http tags==block:schema threads==1 cycles==UNDEF + rampup: run driver=http tags==block:rampup cycles===TEMPLATE(rampup-cycles,TEMPLATE(rowscount,10000000)) threads=auto + main: run driver=http tags==block:main cycles===TEMPLATE(main-cycles,TEMPLATE(rowscount,10000000)) threads=auto + +bindings: + # To enable an optional weighted set of hosts in place of a load balancer + # Examples + # single host: dataapi_host=host1 + # multiple hosts: dataapi_host=host1,host2,host3 + # multiple weighted hosts: dataapi_host=host1:3,host2:7 + weighted_hosts: WeightedStrings('<>') + + # spread into different spaces to use multiple connections + space: HashRange(1,<>); ToString(); + + # http request id + request_id: ToHashedUUID(); ToString(); + + # autogenerate auth token to use on API calls using configured uri/uid/password, unless one is provided + token: Discard(); Token('<>','<>', '<>', '<>'); + + seq_key: Mod(<>); ToString() -> String + seq_value: Hash(); Mod(<>); ToString() -> String + rw_key: <>)->int>>; ToString() -> String + rw_value: Hash(); <>)->int>>; ToString() -> String + +blocks: + schema: + ops: + create-namespace: + method: POST + uri: <>://{weighted_hosts}:<><>/v1 + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + Token: "{token}" + Content-Type: "application/json" + ok-body: ".*\"ok\":1.*" + body: >2 + { + "createNamespace": { + "name": "<>" + } + } + + delete-table: + method: POST + uri: <>://{weighted_hosts}:<><>/v1/<> + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + Token: "{token}" + Content-Type: "application/json" + ok-body: ".*\"ok\":1.*" + body: >2 + { + "deleteTable": { + "name": "<>" + } + } + + create-table: + method: POST + uri: <>://{weighted_hosts}:<><>/v1/<> + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + Token: "{token}" + Content-Type: "application/json" + ok-body: ".*\"ok\":1.*" + body: >2 + { + "createTable": { + "name": "<>", + "definition": { + "columns": { + "key": { + "type": "text" + }, + "value": { + "type": "text" + } + }, + "primaryKey": "key" + } + } + } + + rampup: + ops: + rampup-insert: + space: "{space}" + method: POST + uri: <>://{weighted_hosts}:<><>/v1/<>/<> + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + Token: "{token}" + Content-Type: "application/json" + ok-body: '.*\"insertedIds\":\[.*\].*' + body: >2 + { + "insertOne" : { + "document" : { + "key" : "{seq_key}", + "value" : "{seq_value}" + } + } + } + + main: + params: + ratio: <> + ops: + main-select: + space: "{space}" + method: POST + uri: <>://{weighted_hosts}:<><>/v1/<>/<> + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + Token: "{token}" + Content-Type: "application/json" + ok-body: ".*\"data\".*" + body: >2 + { + "findOne" : { + "filter" : { + "key" : "{rw_key}" + } + } + } + + main-write: + space: "{space}" + method: POST + uri: <>://{weighted_hosts}:<><>/v1/<>/<> + Accept: "application/json" + X-Cassandra-Request-Id: "{request_id}" + Token: "{token}" + Content-Type: "application/json" + # because this is not an upsert, modified count could be 0 or 1 + ok-body: ".*\"modifiedCount\":[0,1].*" + body: >2 + { + "updateOne" : { + "filter": { + "_id" : "{rw_key}" + }, + "update": { + "$set": { + "{rw_key}":"{rw_value}" + } + } + } + } From 9e0065e48809a0e0feece5f1025270f886fc2fdc Mon Sep 17 00:00:00 2001 From: Kathiresan Selvaraj Date: Mon, 30 Sep 2024 14:43:57 -0400 Subject: [PATCH 2/5] API Tables kv workload fixes --- nosqlbench/http-dataapi-tables-keyvalue.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nosqlbench/http-dataapi-tables-keyvalue.yaml b/nosqlbench/http-dataapi-tables-keyvalue.yaml index 02e802696d..af4f02978e 100644 --- a/nosqlbench/http-dataapi-tables-keyvalue.yaml +++ b/nosqlbench/http-dataapi-tables-keyvalue.yaml @@ -57,7 +57,7 @@ blocks: } } - delete-table: + drop-table: method: POST uri: <>://{weighted_hosts}:<><>/v1/<> Accept: "application/json" @@ -67,7 +67,7 @@ blocks: ok-body: ".*\"ok\":1.*" body: >2 { - "deleteTable": { + "dropTable": { "name": "<>" } } @@ -155,11 +155,11 @@ blocks: { "updateOne" : { "filter": { - "_id" : "{rw_key}" + "key" : "{rw_key}" }, "update": { "$set": { - "{rw_key}":"{rw_value}" + "value":"{rw_value}" } } } From ce268a84d0016ba74f956d651bc8f23520c33f88 Mon Sep 17 00:00:00 2001 From: Kathiresan Selvaraj Date: Wed, 2 Oct 2024 15:14:11 -0400 Subject: [PATCH 3/5] CQL key value workload file added temporarily --- nosqlbench/cql_keyvalue2.yaml | 103 ++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 nosqlbench/cql_keyvalue2.yaml diff --git a/nosqlbench/cql_keyvalue2.yaml b/nosqlbench/cql_keyvalue2.yaml new file mode 100644 index 0000000000..982099c7ea --- /dev/null +++ b/nosqlbench/cql_keyvalue2.yaml @@ -0,0 +1,103 @@ +min_version: "5.17.1" + +description: | + A workload with only text keys and text values. + The CQL Key-Value workload demonstrates the simplest possible schema with payload data. This is useful for measuring + system capacity most directly in terms of raw operations. As a reference point, it provides some insight around types of + workloads that are constrained around messaging, threading, and tasking, rather than bulk throughput. + During preload, all keys are set with a value. During the main phase of the workload, random keys from the known + population are replaced with new values which never repeat. During the main phase, random partitions are selected for + upsert, with row values never repeating. + + TEMPLATE(batchsize,100) + +scenarios: + default: + schema: run driver=cql tags==block:schema threads==1 cycles==UNDEF + rampup: run driver=cql tags==block:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto + main: run driver=cql tags==block:"main.*" cycles===TEMPLATE(main-cycles,10000000) threads=auto + batch: + schema: run driver=cql tags==block:schema threads==1 cycles==UNDEF + rampup: run driver=cql tags==block:rampup_batch cycles===TEMPLATE(rampup-cycles,10000000) threads=auto + main: run driver=cql tags==block:"main.*" cycles===TEMPLATE(main-cycles,10000000) threads=auto + astra: + schema: run driver=cql tags==block:schema_astra threads==1 cycles==UNDEF + rampup: run driver=cql tags==block:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto + main: run driver=cql tags==block:"main.*" cycles===TEMPLATE(main-cycles,10000000) threads=auto + basic_check: + schema: run driver=cql tags==block:schema threads==1 cycles==UNDEF + rampup: run driver=cql tags==block:rampup cycles===TEMPLATE(rampup-cycles,10) threads=auto + main: run driver=cql tags==block:"main.*" cycles===TEMPLATE(main-cycles,10) threads=auto + +bindings: + seq_key: Mod(TEMPLATE(keycount,1000000000)); ToString() -> String + seq_value: Hash(); Mod(TEMPLATE(valuecount,1000000000)); ToString() -> String + batch_seq_value: Mul(TEMPLATE(batchsize,100)L); Hash(); Mod(TEMPLATE(valuecount,1000000000)); ToString() -> String + rw_key: TEMPLATE(keydist,Uniform(0,1000000000)); ToString() -> String + rw_value: Hash(); TEMPLATE(valdist,Uniform(0,1000000000)); ToString() -> String + +blocks: + schema: + params: + prepared: false + ops: + create_keyspace: | + create keyspace if not exists TEMPLATE(keyspace,baselines) + WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 'TEMPLATE(rf:1)'} + AND durable_writes = true; + create_table: | + create table if not exists TEMPLATE(keyspace,baselines).TEMPLATE(table,keyvalue) ( + key text, + value text, + PRIMARY KEY (key) + ); + schema_astra: + params: + prepared: false + statements: + create_table: | + create table if not exists TEMPLATE(keyspace,baselines).TEMPLATE(table,keyvalue) ( + key text, + value text, + PRIMARY KEY (key) + ); + rampup: + params: + cl: TEMPLATE(write_cl,LOCAL_QUORUM) + ops: + rampup_insert: | + insert into TEMPLATE(keyspace,baselines).TEMPLATE(table,keyvalue) + (key, value) + values ({seq_key},{seq_value}); + rampup_batch: + params: + cl: TEMPLATE(write_cl,LOCAL_QUORUM) + ops: + rampup_insert: + batch: testing + repeat: 100 + op_template: + prepared: | + insert into TEMPLATE(keyspace,baselines).TEMPLATE(table,keyvalue) + (key, value) + values ({seq_key},{seq_value}); + verify: + params: + cl: TEMPLATE(read_cl,LOCAL_QUORUM) + ops: + verify_select: | + select * from TEMPLATE(keyspace,baselines).TEMPLATE(table,keyvalue) where key={seq_key}; + verify-fields: key->seq_key, value->seq_value + main_read: + params: + cl: TEMPLATE(read_cl,LOCAL_QUORUM) + statements: + main_select: | + select * from TEMPLATE(keyspace,baselines).TEMPLATE(table,keyvalue) where key={rw_key}; + main_write: + params: + cl: TEMPLATE(write_cl,LOCAL_QUORUM) + statements: + main_insert: | + insert into TEMPLATE(keyspace,baselines).TEMPLATE(table,keyvalue) + (key, value) values ({rw_key}, {rw_value}); From 338ff047f7534668b509befd05ce748763e49538 Mon Sep 17 00:00:00 2001 From: Kathiresan Selvaraj Date: Wed, 2 Oct 2024 15:14:45 -0400 Subject: [PATCH 4/5] added scenario for astra --- nosqlbench/http-dataapi-tables-keyvalue.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nosqlbench/http-dataapi-tables-keyvalue.yaml b/nosqlbench/http-dataapi-tables-keyvalue.yaml index af4f02978e..956f924835 100644 --- a/nosqlbench/http-dataapi-tables-keyvalue.yaml +++ b/nosqlbench/http-dataapi-tables-keyvalue.yaml @@ -13,6 +13,10 @@ description: >2 scenarios: default: + schema: run driver=http tags==block:schema* threads==1 cycles==UNDEF + rampup: run driver=http tags==block:rampup cycles===TEMPLATE(rampup-cycles,TEMPLATE(rowscount,10000000)) threads=auto + main: run driver=http tags==block:main cycles===TEMPLATE(main-cycles,TEMPLATE(rowscount,10000000)) threads=auto + astra: schema: run driver=http tags==block:schema threads==1 cycles==UNDEF rampup: run driver=http tags==block:rampup cycles===TEMPLATE(rampup-cycles,TEMPLATE(rowscount,10000000)) threads=auto main: run driver=http tags==block:main cycles===TEMPLATE(main-cycles,TEMPLATE(rowscount,10000000)) threads=auto @@ -40,7 +44,7 @@ bindings: rw_value: Hash(); <>)->int>>; ToString() -> String blocks: - schema: + schema_local: ops: create-namespace: method: POST @@ -56,7 +60,8 @@ blocks: "name": "<>" } } - + schema: + ops: drop-table: method: POST uri: <>://{weighted_hosts}:<><>/v1/<> From a85a0c97ec24f6bca26241e0d743ca7e771f1274 Mon Sep 17 00:00:00 2001 From: Kathiresan Selvaraj Date: Fri, 4 Oct 2024 11:51:38 -0400 Subject: [PATCH 5/5] added readonly and insertonly scenarios --- nosqlbench/cql_keyvalue2.yaml | 7 +++++ nosqlbench/http-dataapi-tables-keyvalue.yaml | 32 +++++++++++--------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/nosqlbench/cql_keyvalue2.yaml b/nosqlbench/cql_keyvalue2.yaml index 982099c7ea..8fa7826989 100644 --- a/nosqlbench/cql_keyvalue2.yaml +++ b/nosqlbench/cql_keyvalue2.yaml @@ -24,6 +24,13 @@ scenarios: schema: run driver=cql tags==block:schema_astra threads==1 cycles==UNDEF rampup: run driver=cql tags==block:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto main: run driver=cql tags==block:"main.*" cycles===TEMPLATE(main-cycles,10000000) threads=auto + astra_read_only: + schema: run driver=cql tags==block:schema_astra threads==1 cycles==UNDEF + rampup: run driver=cql tags==block:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto + main: run driver=cql tags==block:main_read cycles===TEMPLATE(main-cycles,10000000) threads=auto + asta_write_only: + schema: run driver=cql tags==block:schema_astra threads==1 cycles==UNDEF + main: run driver=cql tags==block:main_write cycles===TEMPLATE(main-cycles,10000000) threads=auto basic_check: schema: run driver=cql tags==block:schema threads==1 cycles==UNDEF rampup: run driver=cql tags==block:rampup cycles===TEMPLATE(rampup-cycles,10) threads=auto diff --git a/nosqlbench/http-dataapi-tables-keyvalue.yaml b/nosqlbench/http-dataapi-tables-keyvalue.yaml index 956f924835..a6a689e495 100644 --- a/nosqlbench/http-dataapi-tables-keyvalue.yaml +++ b/nosqlbench/http-dataapi-tables-keyvalue.yaml @@ -15,11 +15,18 @@ scenarios: default: schema: run driver=http tags==block:schema* threads==1 cycles==UNDEF rampup: run driver=http tags==block:rampup cycles===TEMPLATE(rampup-cycles,TEMPLATE(rowscount,10000000)) threads=auto - main: run driver=http tags==block:main cycles===TEMPLATE(main-cycles,TEMPLATE(rowscount,10000000)) threads=auto + main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,TEMPLATE(rowscount,10000000)) threads=auto astra: schema: run driver=http tags==block:schema threads==1 cycles==UNDEF rampup: run driver=http tags==block:rampup cycles===TEMPLATE(rampup-cycles,TEMPLATE(rowscount,10000000)) threads=auto - main: run driver=http tags==block:main cycles===TEMPLATE(main-cycles,TEMPLATE(rowscount,10000000)) threads=auto + main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,TEMPLATE(rowscount,10000000)) threads=auto + astra_findone_only: + schema: run driver=http tags==block:schema threads==1 cycles==UNDEF + rampup: run driver=http tags==block:rampup cycles===TEMPLATE(rampup-cycles,TEMPLATE(rowscount,10000000)) threads=auto + main: run driver=http tags==block:main-findone cycles===TEMPLATE(main-cycles,TEMPLATE(rowscount,10000000)) threads=auto + astra_insertone_only: + schema: run driver=http tags==block:schema threads==1 cycles==UNDEF + main: run driver=http tags==block:main-insertone cycles===TEMPLATE(main-cycles,TEMPLATE(rowscount,10000000)) threads=auto bindings: # To enable an optional weighted set of hosts in place of a load balancer @@ -124,9 +131,7 @@ blocks: } } - main: - params: - ratio: <> + main-findone: ops: main-select: space: "{space}" @@ -145,7 +150,8 @@ blocks: } } } - + main-insertone: + ops: main-write: space: "{space}" method: POST @@ -155,17 +161,13 @@ blocks: Token: "{token}" Content-Type: "application/json" # because this is not an upsert, modified count could be 0 or 1 - ok-body: ".*\"modifiedCount\":[0,1].*" + ok-body: '.*\"insertedIds\":\[.*\].*' body: >2 { - "updateOne" : { - "filter": { - "key" : "{rw_key}" - }, - "update": { - "$set": { - "value":"{rw_value}" - } + "insertOne" : { + "document" : { + "key" : "{seq_key}", + "value" : "{seq_value}" } } }