-
Notifications
You must be signed in to change notification settings - Fork 0
/
new-jsonapi-vector-test-nosqlbench.yaml
168 lines (155 loc) · 6.41 KB
/
new-jsonapi-vector-test-nosqlbench.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
min_version: "5.17.3"
# Example command line
# Against AstraDB
# nb5 -v http-jsonapi-vector-crud docscount=1000 threads=20 stargate_host=Your-AstraDB-Host auth_token=Your-AstraDB-Token jsonapi_port=443 protocol=https path_prefix=/api/json namespace=Your-Keyspace
# Against local JSON API
# nb5 -v http-jsonapi-vector-crud stargate_host=localhost docscount=1000 threads=20
description: >2
This workload emulates vector CRUD operations for Stargate JSON API.
It requires a data set file (default vector-dataset.txt), where contains vectors of size 1536
1536 is a standard vector size that openAI embedding generates, using this size for benchmark
scenarios:
default:
schema-namespace: run driver=http tags==block:schema-namespace threads==1 cycles==UNDEF
schema-collection: run driver=http tags==block:schema-collection threads==1 cycles==UNDEF
write: run driver=http tags==name:"write.*" cycles===TEMPLATE(write-cycles,TEMPLATE(docscount,100000)) threads=auto errors=timer,warn
main: run driver=http tags==block:main cycles===TEMPLATE(read-cycles,100000) threads=auto 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('<<stargate_host:jsonapi>>')
# spread into different spaces to use multiple connections
space: HashRange(1,<<connections:20>>); 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('<<auth_token:>>','<<uri:http://localhost:8081/v1/auth>>', '<<uid:cassandra>>', '<<pswd:cassandra>>');
seq_key: Mod(<<docscount:500>>); ToString() -> String
random_key: Uniform(0,<<docscount:500>>); ToString() -> String
vector_json: HashedLineToString('<<dataset:vector-dataset.txt>>');
blocks:
schema-namespace:
ops:
create-namespace:
method: POST
uri: <<protocol:http>>://{weighted_hosts}:<<jsonapi_port:8181>><<path_prefix:>>/v1
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "{token}"
Content-Type: "application/json"
ok-body: ".*\"ok\":1.*"
body: >2
{
"createNamespace": {
"name": "<<namespace:jsonapi_vector_crud_namespace>>"
}
}
schema-collection:
ops:
delete-collection:
method: POST
uri: <<protocol:http>>://{weighted_hosts}:<<jsonapi_port:8181>><<path_prefix:>>/v1/<<namespace:jsonapi_vector_crud_namespace>>
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "{token}"
Content-Type: "application/json"
ok-body: ".*\"ok\":1.*"
body: >2
{
"deleteCollection": {
"name": "<<collection:jsonapi_vector_crud_collection>>"
}
}
create-collection:
method: POST
uri: <<protocol:http>>://{weighted_hosts}:<<jsonapi_port:8181>><<path_prefix:>>/v1/<<namespace:jsonapi_vector_crud_namespace>>
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "{token}"
Content-Type: "application/json"
ok-body: ".*\"ok\":1.*"
# vector mush be enabled when creating collection
body: >2
{
"createCollection": {
"name": "<<collection:jsonapi_vector_crud_collection>>",
"options": {
"vector": {
"size": 1536
}
}
}
}
write:
ops:
write-insert-one-vector:
space: "{space}"
method: POST
uri: <<protocol:http>>://{weighted_hosts}:<<jsonapi_port:8181>><<path_prefix:>>/v1/<<namespace:jsonapi_vector_crud_namespace>>/<<collection:jsonapi_vector_crud_collection>>
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "{token}"
Content-Type: "application/json"
ok-body: '.*\"insertedIds\":\[.*\].*'
body: >2
{
"insertOne" : {
"document" : {
"_id" : "{seq_key}",
"$vector" : {vector_json}
}
}
}
main:
ops:
find-one-by-vector-projection:
space: "{space}"
method: POST
uri: <<protocol:http>>://{weighted_hosts}:<<jsonapi_port:8181>><<path_prefix:>>/v1/<<namespace:jsonapi_vector_crud_namespace>>/<<collection:jsonapi_vector_crud_collection>>
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "{token}"
Content-Type: "application/json"
ok-body: ".*\"data\".*"
body: >2
{
"findOne": {
"sort" : {"$vector" : {vector_json}},
"projection" : {"$vector" : 1}
}
}
find-one-update-vector:
space: "{space}"
method: POST
uri: <<protocol:http>>://{weighted_hosts}:<<jsonapi_port:8181>><<path_prefix:>>/v1/<<namespace:jsonapi_vector_crud_namespace>>/<<collection:jsonapi_vector_crud_collection>>
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "{token}"
Content-Type: "application/json"
ok-body: ".*\"data\".*"
body: >2
{
"findOneAndUpdate": {
"sort" : {"$vector" : {vector_json}},
"update" : {"$set" : {"status" : "active"}},
"options" : {"returnDocument" : "after"}
}
}
delete-document:
space: "{space}"
method: POST
uri: <<protocol:http>>://{weighted_hosts}:<<jsonapi_port:8181>><<path_prefix:>>/v1/<<namespace:jsonapi_vector_crud_namespace>>/<<collection:jsonapi_vector_crud_collection>>
Accept: "application/json"
X-Cassandra-Request-Id: "{request_id}"
X-Cassandra-Token: "{token}"
Content-Type: "application/json"
ok-body: ".*\"deletedCount\":[0,1].*"
body: >2
{
"findOneAndDelete": {
"sort" : {"$vector" : {vector_json}}
}
}