Skip to content
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

Add data streaming where beneficial to reduce memory usage #3365

Merged
merged 5 commits into from Apr 24, 2022

Conversation

ssddanbrown
Copy link
Member

@ssddanbrown ssddanbrown commented Apr 2, 2022

Areas to address

  • - Attachment Downloads
  • - Attachment Uploads
  • - API Attachment Downloads
  • - API Attachment Uploads
  • - Image Uploads Upload path already looks to be at reasonable minimum. Resizing is loaded into memory either way. 18MB image on 32MB memory uploads okay.
  • - Image Downloads? Was already streaming.

Todo

  • Test when using s3-like storage for each area
    • Tested on minio, Works very nicely.

Related

Related to #2886

This allows download of attachments that are larger than current memory
limits, since we're not loading the entire file into memory any more.

For inline file responses, we take a 1kb portion of the file to sniff
before to check mime before we proceed.
@ssddanbrown ssddanbrown added this to the Next Feature Release milestone Apr 2, 2022
@ssddanbrown ssddanbrown self-assigned this Apr 2, 2022
@ssddanbrown ssddanbrown changed the title Add data streaming where required to reduce memory usage Add data streaming where beneficial to reduce memory usage Apr 2, 2022
Fixes hitting memory limits where downloaded file sizes are much greater
than memory limit. Stopping and flushing output buffer seemed to stop
limits causing issues when fpassthru is used.
Tested with 24M memory limit and 734M file
Required some special handling due to the content being base64-encoded
within a JSON response.
- Added testing check to buffer stop/clear on streaming output due to
  interference during tests.
- Made content-disposition header a little safer in download responses.
- Also aligned how we check for testing environment.
@ssddanbrown
Copy link
Member Author

Ready for merge when appropriate.

@ssddanbrown ssddanbrown merged commit 829f808 into development Apr 24, 2022
@ssddanbrown ssddanbrown deleted the data_streaming branch April 24, 2022 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

1 participant