-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
[WIP] Reduce memory use with fetch and slurp #68753
Conversation
data = base64.b64encode(source_content) | ||
with io.BytesIO() as f: | ||
checksum = b64encode_and_checksum(source, f) | ||
data = to_native(f.getvalue()).strip() |
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.
We will still end up with 2x here. I'm interested in investigating whether we can write this to a real file, and not memory, and then have our JSON encoder be able to stream from a file handle. I attempted this before, but need to look again.
The test
The test
|
Ultimately this PR can only easily aim to improve memory on the controller. To reduce memory on the target further would require JSON gymnastics, but I question the benefit there too. The big change on the controller, is instead of just doing |
I know @bcoca was looking to see if it's possible to buffer the data back in chunks and just rebuild the file on the controller only. The trouble is with the split done the Windows |
That should already be done. It should work with Streaming the data back in chunks via "update_json" wouldn't necessarily address it either. I think in the end, we'll have to pay the penalty either on the controller or the target. I don't know which is preferable currently. |
It's mostly around your point of
I see you've made that an optional check but I just wanted to make sure that you were aware of it, which it seems like you are. |
SUMMARY
This PR attempts a few things:
stat
with become, so we know whetherslurp
is actually required.slurp
return the checksum of the data, so we don't have to use the data on the controller to calculate it.ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION