All Downloads are FREE. Search and download functionalities are using the official Maven repository.

activities.documents-api.http-docsapi-search-advanced.yaml Maven / Gradle / Ivy

Go to download

A HTTP nosqlbench ActivityType (AT) driver module; This provides the ability to generate HTTP requests with nosqlbench

The newest version!
# nb -v run driver=http yaml=http-docsapi-search-advanced tags=phase:schema stargate_host=my_stargate_host auth_token=$AUTH_TOKEN

description: |
  This workload emulates advanced search filter combinations 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).

# These are the filter combinations tested in this workload, and their names:
# 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)
scenarios:
  schema:             run driver=http tags==phase:schema threads==<> cycles==UNDEF
  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-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
  main-not-in:        run driver=http tags==phase:main,filter:not-in cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<> errors=timer,warn
  main-mem-and:       run driver=http tags==phase:main,filter:mem-and cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<> errors=timer,warn
  main-mem-or:        run driver=http tags==phase:main,filter:mem-or cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<> errors=timer,warn
  main-complex1:      run driver=http tags==phase:main,filter:complex1 cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<> errors=timer,warn
  main-complex2:      run driver=http tags==phase:main,filter:complex2 cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<> errors=timer,warn
  main-complex3:      run driver=http tags==phase:main,filter:complex3 cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<> 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
  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: Identity(); CoinFunc(<>, FixedValue(0), FixedValue(1000))
  match2: Identity(); CoinFunc(<>, FixedValue("true"), FixedValue("false"))
  match3: Identity(); CoinFunc(<>, FixedValue("true"), FixedValue("false"))
  
  additional_fields: ListSizedStepped(<>,Template("\"{}\":{}",Identity(),Identity())); ToString(); ReplaceAll('\[\"', ',\"'); ReplaceAll('\[', ''); ReplaceAll('\]', '') -> 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},
            "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}",
            "match3":       {match3}
            {additional_fields}
          }
        tags:
          name: rampup-insert
  
  - name: rampup-in
    tags:
      phase: rampup-read
      filter: in
    statements:
      # where={"match1":{"$in":[0]}}
      - rampup-in: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"match1":{"$in":[0]}}]]&page-size=<>&fields=<>
        Accept: "application/json"
        X-Cassandra-Request-Id: "{request_id}"
        X-Cassandra-Token: "<>"
        Content-Type: "application/json"
        tags:
          name: rampup-in
  
  - name: rampup-not-in
    tags:
      phase: rampup-read
      filter: not-in
    statements:
      # where={"match2":{"$nin":["false"]}}
      - rampup-not-in: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"match2":{"$nin":["false"]}}]]&page-size=<>&fields=<>
        Accept: "application/json"
        X-Cassandra-Request-Id: "{request_id}"
        X-Cassandra-Token: "<>"
        Content-Type: "application/json"
        tags:
          name: rampup-not-in

  - name: rampup-mem-and
    tags:
      phase:  rampup-read
      filter: mem-and
    statements:
      # where={"match2":{"$eq":"true"},"match3":{"$ne": false}}
      - rampup-mem-and: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"match2":{"$eq":"true"},"match3":{"$ne":false}}]]&page-size=<>&fields=<>
        Accept: "application/json"
        X-Cassandra-Request-Id: "{request_id}"
        X-Cassandra-Token: "<>"
        Content-Type: "application/json"
        tags:
          name: rampup-mem-and

  - name: rampup-mem-or
    tags:
      phase:  rampup-read
      filter: mem-or
    statements:
      # where={"$or":[{"match1":{"$lt":1}},{"match3":{"$exists":true}}]}
      - rampup-mem-or: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match3":{"$exists":true}}]}]]&page-size=<>&fields=<>
        Accept: "application/json"
        X-Cassandra-Request-Id: "{request_id}"
        X-Cassandra-Token: "<>"
        Content-Type: "application/json"
        tags:
          name: rampup-mem-or

  - name: rampup-complex1
    tags:
      phase:  rampup-read
      filter: complex1
    statements:
      # where={"$and":[{"match1":{"$eq":0}},{"$or":[{"match2":{"$eq":"true"}},{"match3":{"$eq":false}}]}]}
      - rampup-complex1: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"$and":[{"match1":{"$eq":0}},{"$or":[{"match2":{"$eq":"true"}},{"match3":{"$eq":false}}]}]}]]&page-size=<>&fields=<>
        Accept: "application/json"
        X-Cassandra-Request-Id: "{request_id}"
        X-Cassandra-Token: "<>"
        Content-Type: "application/json"
        tags:
          name: rampup-complex1
  
  - name: rampup-complex2
    tags:
      phase:  rampup-read
      filter: complex2
    statements:
      # where={"$and":[{"$or":[{"match1":{"$lte":0}},{"match2":{"$eq":"false"}}]},{"$or":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}
      - rampup-complex2: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"$and":[{"$or":[{"match1":{"$lte":0}},{"match2":{"$eq":"false"}}]},{"$or":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}]]&page-size=<>&fields=<>
        Accept: "application/json"
        X-Cassandra-Request-Id: "{request_id}"
        X-Cassandra-Token: "<>"
        Content-Type: "application/json"
        tags:
          name: rampup-complex2

  - name: rampup-complex3
    tags:
      phase:  rampup-read
      filter: complex3
    statements:
      # where={"$or":[{"$and":[{"match1":{"$lte":0}},{"match2":{"$eq":"true"}}]},{"$and":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}
      - rampup-complex3: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"$or":[{"$and":[{"match1":{"$lte":0}},{"match2":{"$eq":"true"}}]},{"$and":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}]]&page-size=<>&fields=<>
        Accept: "application/json"
        X-Cassandra-Request-Id: "{request_id}"
        X-Cassandra-Token: "<>"
        Content-Type: "application/json"
        tags:
          name: rampup-complex3

  - name: main-in
    tags:
      phase: main
      filter: in
    statements:
      # where={"match1":{"$in":[0]}}
      - main-in: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"match1":{"$in":[0]}}]]&page-size=<>&fields=<>
        Accept: "application/json"
        X-Cassandra-Request-Id: "{request_id}"
        X-Cassandra-Token: "<>"
        Content-Type: "application/json"
        tags:
          name: main-in
  
  - name: main-not-in
    tags:
      phase: main
      filter: not-in
    statements:
      # where={"match2":{"$nin":["false"]}}
      - main-not-in: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"match2":{"$nin":["false"]}}]]&page-size=<>&fields=<>
        Accept: "application/json"
        X-Cassandra-Request-Id: "{request_id}"
        X-Cassandra-Token: "<>"
        Content-Type: "application/json"
        tags:
          name: main-not-in

  - name: main-mem-and
    tags:
      phase:  main
      filter: mem-and
    statements:
      # where={"match2":{"$eq":"true"},"match3":{"$ne": false}}
      - main-mem-and: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"match2":{"$eq":"true"},"match3":{"$ne":false}}]]&page-size=<>&fields=<>
        Accept: "application/json"
        X-Cassandra-Request-Id: "{request_id}"
        X-Cassandra-Token: "<>"
        Content-Type: "application/json"
        tags:
          name: main-mem-and

  - name: main-mem-or
    tags:
      phase:  main
      filter: mem-or
    statements:
      # where={"$or":[{"match1":{"$lt":1}},{"match3":{"$exists":true}}]}
      - main-mem-or: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match3":{"$exists":true}}]}]]&page-size=<>&fields=<>
        Accept: "application/json"
        X-Cassandra-Request-Id: "{request_id}"
        X-Cassandra-Token: "<>"
        Content-Type: "application/json"
        tags:
          name: main-mem-or

  - name: main-complex1
    tags:
      phase:  main
      filter: complex1
    statements:
      # where={"$and":[{"match1":{"$eq":0}},{"$or":[{"match2":{"$eq":"true"}},{"match3":{"$eq":false}}]}]}
      - main-complex1: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"$and":[{"match1":{"$eq":0}},{"$or":[{"match2":{"$eq":"true"}},{"match3":{"$eq":false}}]}]}]]&page-size=<>&fields=<>
        Accept: "application/json"
        X-Cassandra-Request-Id: "{request_id}"
        X-Cassandra-Token: "<>"
        Content-Type: "application/json"
        tags:
          name: main-complex1
  
  - name: main-complex2
    tags:
      phase:  main
      filter: complex2
    statements:
      # where={"$and":[{"$or":[{"match1":{"$lte":0}},{"match2":{"$eq":"false"}}]},{"$or":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}
      - main-complex2: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"$and":[{"$or":[{"match1":{"$lte":0}},{"match2":{"$eq":"false"}}]},{"$or":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}]]&page-size=<>&fields=<>
        Accept: "application/json"
        X-Cassandra-Request-Id: "{request_id}"
        X-Cassandra-Token: "<>"
        Content-Type: "application/json"
        tags:
          name: main-complex2

  - name: main-complex3
    tags:
      phase:  main
      filter: complex3
    statements:
      # where={"$or":[{"$and":[{"match1":{"$lte":0}},{"match2":{"$eq":"true"}}]},{"$and":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}
      - main-complex3: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"$or":[{"$and":[{"match1":{"$lte":0}},{"match2":{"$eq":"true"}}]},{"$and":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}]]&page-size=<>&fields=<>
        Accept: "application/json"
        X-Cassandra-Request-Id: "{request_id}"
        X-Cassandra-Token: "<>"
        Content-Type: "application/json"
        tags:
          name: main-complex3




© 2015 - 2025 Weber Informatics LLC | Privacy Policy