Experiment with streaming cloning#1461
Closed
josephjclark wants to merge 11 commits into
Closed
Conversation
Down from 20% of allow memory to 15%
Collaborator
Author
|
I am tempted to say that cgroups are a better solution than this I don't care why memory limits blow right now. If anything in the workflow causes memory to get too high, the node process must terminate gracefully and immediately. Even if this PR fixes this one corner case (at the cost of performance and compute), there are others that might trigger memory errors. So I think I'll close this but keep the branch, then go and look at cgroups |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Over in #1458 we're focusing on making the "is this state object too big" calculation robust.
That approach uses :
It is not memory efficient (which can be a problem for memory hungry workflows). The JSON.parse call is blocking and I think can cause the node process to consume too much memory, triggering kubernetes OOMkills.
This PR tries a fully streaming approach:
json-strream-stringifyto stream a state object into a JSON stringThis should significantly reduce the memory overhead of this serialisation,
However! It significantly increases the time: it take 3.8 second to do what #1458 does in 0.9 seconds. I should note that these are pretty large state objects. I also reckon my CPU fan runs louder, implying more CPU usage. This makes semse to me because we're running the seriaisation in JS land, not C land.
AI Usage
Please disclose whether you've used AI anywhere in this PR (it's cool, we just
want to know!):
You can read more details in our
Responsible AI Policy