-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add variables benchmark (#304)
<!-- The PR description should answer 2 (maybe 3) important questions: --> ### What Noticed we're not reusing connections in variable queries. Making a benchmark for it before making the fix. ### How Add a benchmark that does a query with 5 variables, meaning 5 queries.
- Loading branch information
1 parent
3b50c69
commit 89d6c80
Showing
1 changed file
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { check } from "k6"; | ||
import http from "k6/http"; | ||
import { newSummaryHandler } from "../common.js"; | ||
|
||
const testid = "select_variables"; | ||
const agentSocket = __ENV.AGENT_SOCKET || "localhost:8100"; | ||
const url = `http://${agentSocket}/query`; | ||
const data = { | ||
collection: "Album", | ||
query: { | ||
fields: { | ||
Title: { | ||
type: "column", | ||
column: "Title", | ||
arguments: {}, | ||
}, | ||
}, | ||
where: { | ||
type: "binary_comparison_operator", | ||
column: { | ||
type: "column", | ||
name: "Title", | ||
path: [], | ||
}, | ||
operator: { | ||
type: "other", | ||
name: "_like", | ||
}, | ||
value: { | ||
type: "variable", | ||
name: "search", | ||
}, | ||
}, | ||
}, | ||
arguments: {}, | ||
collection_relationships: {}, | ||
variables: [ | ||
{ | ||
search: "%Garage%", | ||
}, | ||
{ | ||
search: "%Good%", | ||
}, | ||
{ | ||
search: "%Rock%", | ||
}, | ||
{ | ||
search: "%Dog%", | ||
}, | ||
{ | ||
search: "%Log%", | ||
}, | ||
], | ||
}; | ||
|
||
export default function () { | ||
const response = http.post(url, JSON.stringify(data), { | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}); | ||
|
||
check(response, { | ||
"status is 200": (r) => r.status == 200, | ||
}); | ||
} | ||
|
||
export const handleSummary = newSummaryHandler(testid); | ||
|
||
export const options = { | ||
tags: { | ||
testid, | ||
}, | ||
scenarios: { | ||
short_sustained: { | ||
executor: "constant-vus", | ||
vus: 100, | ||
duration: "10s", | ||
}, | ||
}, | ||
thresholds: { | ||
checks: [ | ||
{ | ||
threshold: "rate == 1", | ||
abortOnFail: true, | ||
}, | ||
], | ||
}, | ||
}; |