-
Notifications
You must be signed in to change notification settings - Fork 28
Loadtest E2Es and monitor memory for leak detection #611
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
Changes from all commits
Commits
Show all changes
148 commits
Select commit
Hold shift + click to select a range
d21a678
loadtest
enisdenjo bdb2bd2
no url and slope length
enisdenjo d5d630c
fix loadtest script
enisdenjo e949f0f
simplify
enisdenjo d038a13
internal perf
enisdenjo c39cfea
memtest that actually runs the test
enisdenjo 960a92c
nicer message
enisdenjo a2da53f
cleanup
enisdenjo 78f02ba
workflow
enisdenjo 1ef464c
no pipe logs
enisdenjo 778d0d4
install k6
enisdenjo 14c447a
skip memtests from examples
enisdenjo 6d4ed44
simplify bench.yml
enisdenjo 5357169
loadtest duration minute
enisdenjo 4216d25
allow more time for test teardown
enisdenjo 9d90be0
stricter threshold
enisdenjo 7777587
stop loadtest if server exits
enisdenjo 3564de3
server exited before loadtest is fail
enisdenjo 9744c02
container wait for exit
enisdenjo a37784a
debug
enisdenjo e8baad9
debug module
enisdenjo 411dff7
memtest and better debug
enisdenjo a905bff
opentelemetry memtest
enisdenjo d5cba61
memory usage chart in debug mode
enisdenjo 2437ddb
simplify chart
enisdenjo 7581a17
slope has no mb
enisdenjo 6ed7ed3
less slope threshold
enisdenjo 730d74d
draw a trend
enisdenjo 20b2220
loadtest and calmdown
enisdenjo d8f230d
loadtest and calmdown trends
enisdenjo 50a66a4
idle loadtest calmdown
enisdenjo 4688795
include idle in test timeout and increase calmdown
enisdenjo 75a45eb
check increase and decrease
enisdenjo f43aaac
multiple expeects
enisdenjo e925074
memory decrease
enisdenjo 67c8f50
3 min loadtest
enisdenjo f1f00f4
longer calmdown
enisdenjo 791f024
increase canvas
enisdenjo 1bb942f
ignore snapshot charts
enisdenjo afcba9b
memory should stop growing at one point
enisdenjo 63e075c
signal adjustments
enisdenjo 6939e01
loadtest already prefixed
enisdenjo ab5fd73
better title
enisdenjo a95e47c
disable bun ffor now
enisdenjo b85218a
more loadtest timeout
enisdenjo 20c9769
now in snapshots
enisdenjo 316d3d1
no file parallelism
enisdenjo 27a802e
charting in memtest on each snap
enisdenjo 855baeb
datapoints only if available
enisdenjo 7ec9490
humanready starttime
enisdenjo 1ec05bd
log is redundant, chart is live
enisdenjo 1d74d26
gitignore actual files
enisdenjo 06eb8fe
send signals
enisdenjo 094c902
extra args in not in proc
enisdenjo e80fbc8
heap snapshots
enisdenjo db3b1af
connect dots in chart
enisdenjo 9cff1ee
async writes avoiding backpressure in the message listener
enisdenjo d028977
incrase message buffer
enisdenjo 49fde6a
allow heapsnapshot
enisdenjo 9877758
begin parseheap
enisdenjo 0e77e44
unnecessary patches and log heap objects
enisdenjo eaec3a0
use whatwgnode promise helpers
enisdenjo ec4acf9
top 5
enisdenjo 13f3c36
gc and organise
enisdenjo 3e520c2
call on cdp
enisdenjo 7f15092
collect garbage before calmodn
enisdenjo dc9ec90
haltsnapshots even during gc
enisdenjo 25d7fa1
memory sample, readiness and things
enisdenjo 8dd888c
no target heapsnapshot
enisdenjo d7e3e35
fix chart
enisdenjo c242dd3
onheapsnapshot, write it to temp and in e2e if debug
enisdenjo e95fc2d
10 nodes
enisdenjo fbf0ae0
trendlines and colors
enisdenjo 630360d
loadtest with multiple runs and easier charting
enisdenjo fd1f3d3
better chart
enisdenjo df24812
readiness is not necessary due to multiple runs
enisdenjo 346ba7d
match slope trend bla
enisdenjo ad949ed
correct runs check
enisdenjo d749a7d
less trend and stuff
enisdenjo 04b73c6
no async
enisdenjo fa49d05
throw if inspector closed
enisdenjo 03a17cd
heap sampling and stability improvements to inspector
enisdenjo 97502d2
use heap sampling and optional heap snaps
enisdenjo 25eff0e
memory-usage
enisdenjo 9a40428
write heapprofile if debug only
enisdenjo 5827944
doesnt have to be immediate message
enisdenjo 0c8160f
perform heap sampling in memtests and stuff
enisdenjo 09f4d85
docs and stuff
enisdenjo f7ae870
default to 3 runs
enisdenjo 3a0eb6c
todo
enisdenjo ebe6c0c
correct docs
enisdenjo 562e26b
heapsample everything yeah
enisdenjo e482e61
loadtest MUST succeed
enisdenjo 07be5a9
off message in defer
enisdenjo d97f25f
patched speedscope and start analysing profile
enisdenjo 287c5ee
bump speedscope
enisdenjo c51ed2b
analyse frames and report
enisdenjo 82c86a9
improvements and docs
enisdenjo 1e8fb3f
correctly named func
enisdenjo 6ae6a16
adjust callstack and decrease threshold of heavy frames
enisdenjo e41a0d6
adaptable threshold
enisdenjo 98184ee
memtest
enisdenjo d0f35e3
fail if memory snapshotting fails and use heapprofiler
enisdenjo 52844de
local regression calc and expected value
enisdenjo 36515cd
dont report stats if signal aborted
enisdenjo 34c0f7e
fix gitignore after rebase
enisdenjo 7c02618
run tests in parallel
enisdenjo 1930e8a
disable otel plugin for e2e in memtests avoiding a false positive
enisdenjo d5b80e0
todo
enisdenjo 12d8ee0
no build on ubuntu arm during release
enisdenjo 1a30875
comment
enisdenjo 2cdafa2
write profile to disk on fail
enisdenjo 3426733
nestjs
enisdenjo 3b5badd
expected heavy frames
enisdenjo 3b99cba
auto-type-merging
enisdenjo 2e06d45
loadtest.out on debug
enisdenjo b90ccb5
30sec each
enisdenjo 84635e1
todo
enisdenjo 878487f
nestjs is not tested because needs build
enisdenjo fb6c2bf
reduce threshold
enisdenjo de4b3be
increase mesage wait timeout
enisdenjo 6b1d4d5
no need to skip anything
enisdenjo 328eb73
heapsnapshot also during idle
enisdenjo 2e8a1b3
federation mixed
enisdenjo afc332c
federation-subscription-passthrough
enisdenjo ec36023
lockfile update
enisdenjo 69f472f
ignore loadtest output files
enisdenjo 1cf9fd6
tostring body once in loadtestscript
enisdenjo 98a6f99
noauth in subscriptions passthrough when memtest
enisdenjo d6d81a4
make sure queries work before loadtests
enisdenjo 2257521
display trend value
enisdenjo 7a97d66
publicurl
enisdenjo 082ae54
more tests
enisdenjo e7b93c4
comment about node
enisdenjo 875134d
no string debug undefined
enisdenjo e73c74d
typo
enisdenjo 36d5b3c
no forever loop
enisdenjo f8f6ebc
docs(examples): converted from e2es
theguild-bot 6d8900c
2 runs 2 minutes each is ok
enisdenjo 8333373
inspect port only without jit
enisdenjo d600d8b
allow failing requests during loadtests
enisdenjo c2a1fb6
yeah we need more runs
enisdenjo dd0bedd
expected heavy frames
enisdenjo 7866d3a
docs(examples): converted from e2es
theguild-bot 3af387e
expected heavy frame func is inverted
enisdenjo d95aab4
comment
enisdenjo 9b340f4
also heavy
enisdenjo 0a6788d
more expected
enisdenjo 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,6 @@ concurrency: | |
|
|
||
| env: | ||
| NODE_NO_WARNINGS: 1 | ||
| CI: true | ||
|
|
||
| jobs: | ||
| bench: | ||
|
|
@@ -22,7 +21,7 @@ jobs: | |
| - 10 | ||
| - 100 | ||
| - 1000 | ||
| name: Benchmark / ${{matrix.e2e_runner}} / ${{matrix.products_size}} items | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks nicer in the checks overview. - Bench / Benchmark / node / 10 items
+ Bench / node / 10 items |
||
| name: ${{matrix.e2e_runner}} / ${{matrix.products_size}} items | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
|
|
@@ -36,4 +35,3 @@ jobs: | |
| env: | ||
| PRODUCTS_SIZE: ${{matrix.products_size}} | ||
| E2E_GATEWAY_RUNNER: ${{matrix.e2e_runner}} | ||
| CI: true | ||
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,44 @@ | ||
| name: Memtest | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| NODE_NO_WARNINGS: 1 | ||
| K6_VERSION: v0.56.0 | ||
|
|
||
| jobs: | ||
enisdenjo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| memtest: | ||
| strategy: | ||
| matrix: | ||
| e2e_runner: | ||
| - node | ||
| # - bun TODO: get memory snaps and heap sampling for bun. is it even necessary? | ||
| name: ${{matrix.e2e_runner}} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Install k6 | ||
| run: | | ||
| mkdir -p "$HOME/.local/bin" | ||
| cd "$HOME/.local/bin" | ||
| curl https://github.com/grafana/k6/releases/download/${{ env.K6_VERSION }}/k6-${{ env.K6_VERSION }}-linux-amd64.tar.gz -L | tar xvz --strip-components 1 | ||
| echo "$PWD" >> $GITHUB_PATH | ||
enisdenjo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Set up env | ||
| uses: the-guild-org/shared-config/setup@v1 | ||
|
||
| with: | ||
| # TODO: should we test more node versions? we usually always recommend upgrading to | ||
| # latest when people suspect leaks - latest is always the most stable | ||
| node-version-file: .node-version | ||
| - name: Test | ||
| run: yarn test:mem | ||
| # TODO: publish heap allocation sampling profile to artifact | ||
| env: | ||
| E2E_GATEWAY_RUNNER: ${{matrix.e2e_runner}} | ||
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,39 @@ | ||
| import { createTenv, type Container } from '@internal/e2e'; | ||
| import { memtest } from '@internal/perf/memtest'; | ||
| import { beforeAll } from 'vitest'; | ||
|
|
||
| const cwd = __dirname; | ||
| const { service, gateway, container } = createTenv(cwd); | ||
|
|
||
| let petstore!: Container; | ||
| beforeAll(async () => { | ||
| petstore = await container({ | ||
| name: 'petstore', | ||
| image: 'swaggerapi/petstore3:1.0.7', | ||
| containerPort: 8080, | ||
| healthcheck: ['CMD-SHELL', 'wget --spider http://localhost:8080'], | ||
| }); | ||
| }); | ||
|
|
||
| memtest( | ||
| { | ||
| cwd, | ||
| query: /* GraphQL */ ` | ||
| query GetPet { | ||
| getPetById(petId: 1) { | ||
| __typename | ||
| id | ||
| name | ||
| vaccinated | ||
| } | ||
| } | ||
| `, | ||
| }, | ||
| async () => | ||
| gateway({ | ||
| supergraph: { | ||
| with: 'mesh', | ||
| services: [petstore, await service('vaccination')], | ||
| }, | ||
| }), | ||
| ); |
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,18 @@ | ||
| import { createExampleSetup, createTenv } from '@internal/e2e'; | ||
| import { memtest } from '@internal/perf/memtest'; | ||
|
|
||
| const cwd = __dirname; | ||
|
|
||
| const { gateway } = createTenv(cwd); | ||
| const { supergraph, query } = createExampleSetup(cwd); | ||
|
|
||
| memtest( | ||
| { | ||
| cwd, | ||
| query, | ||
| }, | ||
| async () => | ||
| gateway({ | ||
| supergraph: await supergraph(), | ||
| }), | ||
| ); | ||
enisdenjo marked this conversation as resolved.
Show resolved
Hide 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { createExampleSetup, createTenv } from '@internal/e2e'; | ||
| import { memtest } from '@internal/perf/memtest'; | ||
|
|
||
| const cwd = __dirname; | ||
|
|
||
| const { service, gateway } = createTenv(cwd); | ||
| const exampleSetup = createExampleSetup(cwd); | ||
|
|
||
| memtest( | ||
| { | ||
| cwd, | ||
| query: exampleSetup.query, | ||
| }, | ||
| async () => | ||
| gateway({ | ||
| supergraph: { | ||
| with: 'mesh', | ||
| services: [ | ||
| await service('accounts'), | ||
| await exampleSetup.service('inventory'), | ||
| await exampleSetup.service('products'), | ||
| await exampleSetup.service('reviews'), | ||
| ], | ||
| }, | ||
| }), | ||
| ); |
79 changes: 79 additions & 0 deletions
79
e2e/federation-subscriptions-passthrough/federation-subscriptions-passthrough.memtest.ts
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 { createTenv } from '@internal/e2e'; | ||
| import { memtest } from '@internal/perf/memtest'; | ||
| import { getAvailablePort } from '@internal/testing'; | ||
| import { describe } from 'vitest'; | ||
|
|
||
| const cwd = __dirname; | ||
|
|
||
| const { service, gateway } = createTenv(cwd); | ||
|
|
||
| describe('upstream subscriptions via websockets', () => { | ||
| memtest( | ||
| { | ||
| cwd, | ||
| query: /* GraphQL */ ` | ||
| subscription { | ||
| newProduct { | ||
| id | ||
| name | ||
| price | ||
| reviews { | ||
| score | ||
| } | ||
| } | ||
| } | ||
| `, | ||
| }, | ||
| async () => | ||
| gateway({ | ||
| supergraph: { | ||
| with: 'apollo', | ||
| services: [ | ||
| await service('products', { env: { MEMTEST: 1 } }), | ||
| await service('reviews'), | ||
| ], | ||
| }, | ||
| }), | ||
| ); | ||
| }); | ||
|
|
||
| describe('upstream subscriptions via http callbacks', () => { | ||
| memtest( | ||
| { | ||
| cwd, | ||
| query: /* GraphQL */ ` | ||
| subscription { | ||
| newReview { | ||
| score | ||
| } | ||
| } | ||
| `, | ||
| expectedHeavyFrame: (frame) => | ||
| // these frames are not leaks and have been confirmed to be stable analysing the heap snapshots (they do allocate a lot, but they all of their memory gets freed) | ||
| [ | ||
| 'delete', | ||
| 'get pathname', | ||
| 'onRequest', | ||
| 'Repeater.next', | ||
| 'Set', | ||
| ].includes(frame.name), | ||
| }, | ||
| async () => { | ||
| const availablePort = await getAvailablePort(); | ||
| const publicUrl = `http://0.0.0.0:${availablePort}`; | ||
| return gateway({ | ||
| supergraph: { | ||
| with: 'apollo', | ||
| services: [ | ||
| await service('products', { env: { MEMTEST: 1 } }), | ||
| await service('reviews'), | ||
| ], | ||
| }, | ||
| port: availablePort, | ||
| env: { | ||
| PUBLIC_URL: publicUrl, | ||
| }, | ||
| }); | ||
| }, | ||
| ); | ||
| }); |
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 |
|---|---|---|
|
|
@@ -9,4 +9,5 @@ type Review { | |
|
|
||
| type Subscription { | ||
| countdown(from: Int!): Int | ||
| newReview: Review! | ||
| } | ||
35 changes: 35 additions & 0 deletions
35
e2e/interface-additional-resolvers/interface-additional-resolvers.memtest.ts
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,35 @@ | ||
| import { createTenv } from '@internal/e2e'; | ||
| import { memtest } from '@internal/perf/memtest'; | ||
|
|
||
| const cwd = __dirname; | ||
|
|
||
| const { gateway, service } = createTenv(cwd); | ||
|
|
||
| memtest( | ||
| { | ||
| cwd, | ||
| query: /* GraphQL */ ` | ||
| query { | ||
| node(id: "1") { | ||
| id | ||
| ... on User { | ||
| name | ||
| } | ||
| self { | ||
| id | ||
| ... on User { | ||
| name | ||
| } | ||
| } | ||
| } | ||
| } | ||
| `, | ||
| }, | ||
| async () => | ||
| await gateway({ | ||
| supergraph: { | ||
| with: 'mesh', | ||
| services: [await service('Test')], | ||
| }, | ||
| }), | ||
| ); |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub sets
CI=truesince 2020.