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

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

# 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) 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
  main-lt:               run driver=http tags==phase:main,filter:lt cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<> errors=timer,warn
  main-and:              run driver=http tags==phase:main,filter:and cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<> errors=timer,warn
  main-or:               run driver=http tags==phase:main,filter:or cycles===TEMPLATE(read-cycles,TEMPLATE(docscount,10000000)) page-size=TEMPLATE(page-size,3) fields=TEMPLATE(fields,%5b%5d) threads=<> errors=timer,warn
  main-or-single-match:  run driver=http tags==phase:main,filter:or-single-match 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"))
  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":       {match2}
            {additional_fields}
          }
        tags:
          name: rampup-insert
  
  - name: rampup-eq
    tags:
      phase: rampup-read
      filter: eq
    statements:
      # where={"match3":{"$eq":true}}
      - rampup-eq: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"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-eq
  
  - name: rampup-lt
    tags:
      phase: rampup-read
      filter: lt
    statements:
      # where={"match1":{"$lt":1}}
      - rampup-lt: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"match1":{"$lt":1}}]]&page-size=<>&fields=<>
        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:
      # where={"match1":{"$lt":1},"match2":{"$eq":"true"}}
      - rampup-and: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"match1":{"$lt":1},"match2":{"$eq":"true"}}]]&page-size=<>&fields=<>
        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:
      # where={"$or":[{"match1":{"$lt":1}},{"match3":{"$eq":true}}]}
      - rampup-or: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"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-or

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

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

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

  - name: main-or
    tags:
      phase:  main
      filter: or
    statements:
      # where={"$or":[{"match1":{"$lt":1}},{"match3":{"$eq":true}}]}
      - main-or: GET <>://{weighted_hosts}:<><>/v2/namespaces/<>/collections/<>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"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-or

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy