-
Notifications
You must be signed in to change notification settings - Fork 240
chore: add non-cached benchmark to find the price of costs control #2929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+200
−36
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3bd2fd1
chore: add non cached benchmark to find the price of costs control
ysmolski de4c309
stop timer
ysmolski 584642f
Merge branch 'main' into yury/add_non_cached_benchmarks_for_costs
ysmolski 518754f
Merge branch 'main' into yury/add_non_cached_benchmarks_for_costs
ysmolski f619081
Merge branch 'main' into yury/add_non_cached_benchmarks_for_costs
ysmolski 6176038
add big-response
ysmolski 4e8b384
Merge branch 'main' of github.com:wundergraph/cosmo into yury/add_non…
ysmolski a79f9e4
replace quotes
ysmolski 4e58318
Merge branch 'main' into yury/add_non_cached_benchmarks_for_costs
ysmolski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,79 @@ | ||
| import http from 'k6/http'; | ||
| import { check } from 'k6'; | ||
|
|
||
| // Load test for LARGE responses through the router. | ||
| // | ||
| // PREREQUISITES: | ||
| // 1. test1 subgraph running on 4006 port: `cd ../demo && go run cmd/all/main.go` | ||
| // 2. test1 present in the router's execution config | ||
| // | ||
| // GOTCHA: the leaf object is a shared singleton of identical lorem-ipsum text, | ||
| // so gzip compresses the payload to almost nothing. To genuinely push 20-60 MB | ||
| // over the wire we request `identity` (uncompressed) by default. | ||
| // Set ENCODING=gzip to measure the compressed path instead. | ||
|
|
||
| const URL = __ENV.URL || 'http://localhost:3002/graphql'; | ||
| const BIG_OBJECTS = __ENV.BIG_OBJECTS || '200'; | ||
| const NESTED_OBJECTS = __ENV.NESTED_OBJECTS || '72'; | ||
| const DEEPLY_NESTED = __ENV.DEEPLY_NESTED || '10'; | ||
| const ENCODING = __ENV.ENCODING || 'identity'; // 'identity' = full bytes on the wire; 'gzip' = compressed | ||
| const DISCARD = (__ENV.DISCARD || 'false') === 'true'; | ||
|
|
||
| export const options = { | ||
| discardResponseBodies: DISCARD, | ||
| scenarios: { | ||
| big: { | ||
| executor: 'constant-vus', | ||
| vus: parseInt(__ENV.VUS || '1', 10), | ||
| duration: __ENV.DURATION || '60s', | ||
| }, | ||
| }, | ||
| thresholds: { | ||
| http_req_failed: ['rate<0.01'], | ||
| }, | ||
| }; | ||
|
|
||
| const query = `query Big($big: Int!, $nested: Int!, $deep: Int!) { | ||
| bigResponse(bigObjects: $big, nestedObjects: $nested, deeplyNestedObjects: $deep) { | ||
| nestedObjects { | ||
| deeplyNestedObjects { | ||
| aFieldOnDeeplyNestedObject bFieldOnDeeplyNestedObject cFieldOnDeeplyNestedObject | ||
| dFieldOnDeeplyNestedObject eFieldOnDeeplyNestedObject fFieldOnDeeplyNestedObject | ||
| gFieldOnDeeplyNestedObject hFieldOnDeeplyNestedObject iFieldOnDeeplyNestedObject | ||
| jFieldOnDeeplyNestedObject kFieldOnDeeplyNestedObject lFieldOnDeeplyNestedObject | ||
| mFieldOnDeeplyNestedObject nFieldOnDeeplyNestedObject oFieldOnDeeplyNestedObject | ||
| pFieldOnDeeplyNestedObject qFieldOnDeeplyNestedObject rFieldOnDeeplyNestedObject | ||
| sFieldOnDeeplyNestedObject tFieldOnDeeplyNestedObject uFieldOnDeeplyNestedObject | ||
| vFieldOnDeeplyNestedObject wFieldOnDeeplyNestedObject xFieldOnDeeplyNestedObject | ||
| yFieldOnDeeplyNestedObject zFieldOnDeeplyNestedObject | ||
| } | ||
| } | ||
| } | ||
| }`; | ||
|
|
||
| const body = JSON.stringify({ | ||
| query, | ||
| operationName: 'Big', | ||
| variables: { | ||
| big: parseInt(BIG_OBJECTS, 10), | ||
| nested: parseInt(NESTED_OBJECTS, 10), | ||
| deep: parseInt(DEEPLY_NESTED, 10), | ||
| }, | ||
| }); | ||
|
|
||
| const headers = { | ||
| 'Content-Type': 'application/json', | ||
| 'Accept-Encoding': ENCODING, | ||
| 'GraphQL-Client-Name': 'k6-bigresponse', | ||
| 'GraphQL-Client-Version': '0.0.1', | ||
| }; | ||
|
|
||
| export default function () { | ||
| const res = http.post(URL, body, { headers }); | ||
| // When DISCARD=true, r.body is null — only assert status. When DISCARD=false, | ||
| // also assert the payload is large and error-free. | ||
| check(res, { | ||
| 'status is 200': (r) => r.status === 200, | ||
| 'no graphql errors': (r) => DISCARD || (r.status === 200 && r.body.includes('errors') === false) | ||
|
ysmolski marked this conversation as resolved.
|
||
| }); | ||
| } | ||
|
ysmolski marked this conversation as resolved.
|
||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.