netty/netty — Issue #147: Add expert flag to not copy read buffer into its own buffer in NioWorker
Author: kimchy
Created: 2012-01-13 09:45:28+00:00
State: open

Heya,

Here is a thought, tell me if it make sense. Currently, Netty copies the buffer it reads the socket with into a separate buffer and then fires the message. I would like to ask to introduce a special flag, that would not copy it to a new buffer. Instead, it will first the message received with the actual buffer, and then return it to the pool.

This flag is an expert flag, and its the "I know what I am doing flag" option. In many cases, like handlers that have cumalation buffers, this copy is not really required, since we copy it again to the cumalation buffer.

This flag can provide a simpel solution to 3.x release, or if the revised buffer pooling in 4.x won't make it.

This can be enhanced in cumalation type cases, where if the buffer is "from a pool", and there is no need for cumation, still copy it over (for protective reasons), and pass it along (for things like HTTP decoder).

-shay.banon