[TACHYON-62] Netty

Netty implementation of the data server.

This patch is not done yet.  Its intent is to show the work I have right now for commenting.

This PR should not be merged until performance results come in.
Bytebuffers are normally freed from GC.  Is that not true for memory mapped?
On Aug 19, 2014 11:58 PM, "Reynold Xin" <notifications@github.com> wrote:

> In core/src/main/java/tachyon/worker/netty/BlockResponse.java:
>
> > +  public static final class Encoder extends MessageToMessageEncoder<BlockResponse> {
> > +    private static final int LONG_SIZE = 8;
> > +    private static final int SHORT_SIZE = 2;
> > +    private static final int MESSAGE_LENGTH = SHORT_SIZE + LONG_SIZE * 3;
> > +
> > +    @Override
> > +    protected void encode(final ChannelHandlerContext ctx, final BlockResponse msg,
> > +        final List<Object> out) throws Exception {
> > +      out.add(createHeader(ctx, msg));
> > +      if (msg.getChannel() != null) {
> > +        switch (WorkerConf.get().NETTY_FILE_STREAM_TYPE) {
> > +        case TRANSFER:
> > +          out.add(new DefaultFileRegion(msg.getChannel(), msg.getOffset(), msg.getLength()));
> > +          break;
> > +        case MAPPED:
> > +          ByteBuffer data =
>
> Gotta be careful here with small blocks, especially when Huge Page is
> configured.
>
> Also where do you release the memory mapped stuff?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/amplab/tachyon/pull/333/files#r16461163>.
>