-
Notifications
You must be signed in to change notification settings - Fork 233
fix(router): high subscription loads causing deadlocks #2223
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
endigma
merged 8 commits into
main
from
jesse/eng-8055-high-subscription-load-causes-deadlocks
Sep 24, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e5332a8
chore: add pyroscope support permanantly to the router
endigma 41e2812
chore: add websocket super load script
endigma 8f5f093
chore: clean up pyroscope init
endigma 33e831f
chore: use wip go-tools 02e215ff
endigma 422bc99
chore: use wip go-tools 7c67341c
endigma 2e0d2f5
chore: make pyroscope and all other profile types mutually exclusive
endigma 4a30e13
chore: use release go-tools bca665ac
endigma a09f7dc
chore: remove copypaste doc comments
endigma 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,86 @@ | ||
| import ws from 'k6/ws'; | ||
| import { check } from 'k6'; | ||
|
|
||
| /* | ||
| This script was originally intended to simulate an extremely high load on websocket connections. It may also be useful as a base for new websocket scenarios. | ||
| */ | ||
|
|
||
| export const options = { | ||
| stages: [ | ||
| { duration: '0s', target: 10000 }, | ||
| { duration: '5m', target: 10000 }, | ||
| ], | ||
| }; | ||
|
|
||
| export default function () { | ||
| const url = 'ws://localhost:3002/graphql'; | ||
| const params = { | ||
| headers: { | ||
| 'Sec-WebSocket-Protocol': 'graphql-transport-ws', | ||
| }, | ||
| }; | ||
|
|
||
| const res = ws.connect(url, params, function (socket) { | ||
| socket.on('open', () => { | ||
| // Send connection_init message | ||
| socket.send( | ||
| JSON.stringify({ | ||
| type: 'connection_init', | ||
| }), | ||
| ); | ||
| }); | ||
|
|
||
| socket.on('message', function (message) { | ||
| const data = JSON.parse(message); | ||
|
|
||
| console.log(message); | ||
|
|
||
| switch (data.type) { | ||
| case 'connection_ack': | ||
| // Connection acknowledged, start subscription | ||
| socket.send( | ||
| JSON.stringify({ | ||
| id: '1', | ||
| type: 'subscribe', | ||
| payload: { | ||
| query: 'subscription { countHob(max: 50000, intervalMilliseconds: 1) }', | ||
| }, | ||
| }), | ||
| ); | ||
| console.log('Subscription started'); | ||
| break; | ||
| case 'next': | ||
| console.log('Subscription next:', data.payload); | ||
| break; | ||
| case 'complete': | ||
| console.log('Subscription completed'); | ||
| break; | ||
| } | ||
| }); | ||
|
|
||
| socket.on('close', function () { | ||
| console.log('WebSocket connection closed'); | ||
| }); | ||
|
|
||
| socket.on('error', function (e) { | ||
| if (e.error() != 'websocket: close sent') { | ||
| console.log('WebSocket error:', e.error()); | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| // Cancel subscription after 20 seconds | ||
| setTimeout(() => { | ||
| socket.send( | ||
| JSON.stringify({ | ||
| id: '1', | ||
| type: 'complete', | ||
| }), | ||
| ); | ||
| socket.close(); | ||
| }, 20000); | ||
|
|
||
|
endigma marked this conversation as resolved.
|
||
| check(res, { | ||
| 'WebSocket connection established': (r) => r && r.status === 101, | ||
| }); | ||
| } | ||
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
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.