Skip to content

Send static files as chunks using IO::Handle.Supply#106

Open
lukasvalle wants to merge 3 commits into
croservices:mainfrom
lukasvalle:master
Open

Send static files as chunks using IO::Handle.Supply#106
lukasvalle wants to merge 3 commits into
croservices:mainfrom
lukasvalle:master

Conversation

@lukasvalle
Copy link
Copy Markdown

The intention of this PR is to show, that cro-http and the IO::Handle.Supply core functionality would work nice together to implement something similar to sendfile_max_chunk in nginx to reduce memory consumption when delivering large files.

This PR includes:

  • test for Content-length for static served files for the existing implementation
  • test for Content-length and content for chunk served files
  • a named parameter chunk_size for the static sub
  • a named parameter content_length for Supply BodySerializer and the Router content method to set the content_length header field for chunk deliverd content

…ould reduce memory usage when serving large files. Using Supply is a common pattern in cro in general. The rakudo default size makes the downloads a lot slower than server it from memory. 1MB is better. But what would be a sensible size for the chunks?
@librasteve
Copy link
Copy Markdown
Contributor

@lukasvalle - hi ... there is now some baseline attention on Cro and I just came across your PR. To proceed, since the PR is now ~6 years old, please can you close this one, sync your fork, reapply your code over the interim changes, retest and resubmit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants