Rethink the deprecation of AbstractEpollStreamChannel.spliceTo(...)

Open
#17,531 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Active
Tech stack
java, linux

Research direction

Start by reviewing the four deprecated spliceTo(...) overloads on AbstractEpollStreamChannel and the related Netty 5 removal context. Compare the documented alternatives, including FileRegion/sendfile and the ByteBuf relay, against the plaintext L4 relay scenario described here. Done means the splice limitations are documented and a recommended alternative is stated for large transfers.

Written by the indexing model from the issue text.

Description

All four spliceTo(...) overloads are @Deprecated in 4.2 with "Will be removed in the future" and no further explanation. I asked about this before and was told it was dropped in Netty 5 because "there are flaws" — what are they?

Asking because splice is still much faster for plaintext L4 relay. TCP proxy, 1 MB responses, both channels on the same event loop, epoll, no SSL. Linux x86_64, JDK 21, wrk -c128 -t16 -d10s over loopback, two runs each:

ByteBuf relay spliceTo
Requests/sec 11,090 / 11,601 19,443 / 19,697
Transfer/sec 10.83 / 11.33 GB/s 18.99 / 19.24 GB/s
Latency avg 15.04 / 10.56 ms 6.48 / 5.61 ms
Latency stdev 29.65 / 5.88 ms 10.96 / 3.12 ms
Latency max 343.04 / 214.74 ms 326.41 / 35.97 ms

~70% throughput and a much tighter tail. Makes sense: the ByteBuf path does two memcpys per relayed byte and allocates per request, splice does neither. At small payloads the two are equal, so this only matters for large transfers — but that is what a byte relay is for. Loopback exaggerates it since everything shares memory bandwidth; on a real NIC the gap would be smaller, I can't test that.

Nothing else covers this case. FileRegion/sendfile is file-to-socket. IORING_OP_SPLICE is REQ_F_FORCE_ASYNC in the kernel so it always goes to an io-wq worker. That leaves the ByteBuf relay, which is the slower column above.

If the flaws outweigh this, that's completely fair. It would just help a lot to have them documented, along with a recommended alternative for this use case.

Dominant language
Java
Stars
35.1k
Forks
16.4k
Avg merge
1d 1h
Merged PRs (30d)
385

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from netty/netty

All issues in netty/netty

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.