Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Implement IHttpSendFileFeature #1593

Closed
benaadams opened this issue Apr 2, 2017 · 7 comments
Closed

Implement IHttpSendFileFeature #1593

benaadams opened this issue Apr 2, 2017 · 7 comments
Milestone

Comments

@benaadams
Copy link
Contributor

This could be done by reading from a file pipeline and appending the buffers to the output pipeline? (Cutting out most of the stream busy work)

/cc @davidfowl

@davidfowl
Copy link
Member

Breaks with SSL that's why we don't do it today

@tmds
Copy link
Contributor

tmds commented Apr 5, 2017

On Linux, true sendfile (i.e. kernel copying fd to fd), doesn't support encryption. Don't know how it is on Windows.
So it would be nice to be able to provide an http only sendfile at the Transport.

@Tratcher
Copy link
Member

Tratcher commented Apr 5, 2017

On Windows SendFile with a raw socket doesn't get you encryption either, but Http.Sys does have an implementation that support encryption.

@Drawaes
Copy link
Contributor

Drawaes commented Apr 5, 2017

So does BSD. Go look up how Netflix got HTTP working, inserting crypto in the sendfile pipe. TBH it is a non goal anyway. You can lift the buffers into userspace with technologies like RIO and PD, encrypt in userspace and cache in userspace.

@benaadams
Copy link
Contributor Author

benaadams commented Apr 5, 2017

Doesn't need the actual SendFile api; just doesn't need to go through the full stack.

Frame implements IHttpSendFileFeature; Kestel reads file straight into output (pipe buffers)
KestelHttps overrides Kestrel's IHttpSendFileFeature reading into the TLS output(pipe/stream)

Currently up stack it reads from file into an array, then passes the array to Kestrel which then copies it to the output buffers. Implementing IHttpSendFileFeature means you can remove a step of copying; also allocation for the file read buffers.

@tmds
Copy link
Contributor

tmds commented Apr 6, 2017

It can be optimized at different levels.

  • If http, most Transports can do the work.
  • If https, some Transports can do the work.
  • If the Transport can't do the work, improved kestrel implementation.

@muratg muratg added this to the 2.1.0 milestone Apr 10, 2017
@muratg muratg modified the milestones: Backlog, 2.1.0 Aug 18, 2017
@muratg
Copy link
Contributor

muratg commented Aug 18, 2017

We don't plan to do this. Eventually the middleware could be made to expose pipelines.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants