Expose zero-copy file transfer in Servlet API
- Dominant language
- Java
- Stars
- 325
- Forks
- 112
- PR merge metrics
- No merged PRs in 30d
Description
It would be nice if the Servlet spec would expose [zero-copy](https://en.wikipedia.org/wiki/Zero-copy) file transfer operations, so that files can be written to the network socket without involving the CPU. In Java, zero-copy is exposed through the `FileChannel::transferTo` methods, but combing this channel-based API with the Servlet spec seems impossible.
For instance, this could take the form of a `long transfer(Path file, long pos, long count)` method on either `ServletResponse` or `ServletOutputStream`, that takes the file path, position and byte count, and returns the bytes written.
Contributor guide
Research direction
Start by comparing the ServletResponse and ServletOutputStream APIs with Java's FileChannel.transferTo methods, as described in the issue. Done would require an agreed Servlet API design that exposes zero-copy file transfer and specifies the file, position, count, and returned byte count.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100