netty5/testsuite-osgi/testsuite-osgi-split
Trustin Lee 14158070bf Revamp the core API to reduce memory footprint and consumption
The API changes made so far turned out to increase the memory footprint
and consumption while our intention was actually decreasing them.

Memory consumption issue:

When there are many connections which does not exchange data frequently,
the old Netty 4 API spent a lot more memory than 3 because it always
allocates per-handler buffer for each connection unless otherwise
explicitly stated by a user.  In a usual real world load, a client
doesn't always send requests without pausing, so the idea of having a
buffer whose life cycle if bound to the life cycle of a connection
didn't work as expected.

Memory footprint issue:

The old Netty 4 API decreased overall memory footprint by a great deal
in many cases.  It was mainly because the old Netty 4 API did not
allocate a new buffer and event object for each read.  Instead, it
created a new buffer for each handler in a pipeline.  This works pretty
well as long as the number of handlers in a pipeline is only a few.
However, for a highly modular application with many handlers which
handles connections which lasts for relatively short period, it actually
makes the memory footprint issue much worse.

Changes:

All in all, this is about retaining all the good changes we made in 4 so
far such as better thread model and going back to the way how we dealt
with message events in 3.

To fix the memory consumption/footprint issue mentioned above, we made a
hard decision to break the backward compatibility again with the
following changes:

- Remove MessageBuf
- Merge Buf into ByteBuf
- Merge ChannelInboundByte/MessageHandler and ChannelStateHandler into ChannelInboundHandler
  - Similar changes were made to the adapter classes
- Merge ChannelOutboundByte/MessageHandler and ChannelOperationHandler into ChannelOutboundHandler
  - Similar changes were made to the adapter classes
- Introduce MessageList which is similar to `MessageEvent` in Netty 3
- Replace inboundBufferUpdated(ctx) with messageReceived(ctx, MessageList)
- Replace flush(ctx, promise) with write(ctx, MessageList, promise)
- Remove ByteToByteEncoder/Decoder/Codec
  - Replaced by MessageToByteEncoder<ByteBuf>, ByteToMessageDecoder<ByteBuf>, and ByteMessageCodec<ByteBuf>
- Merge EmbeddedByteChannel and EmbeddedMessageChannel into EmbeddedChannel
- Add SimpleChannelInboundHandler which is sometimes more useful than
  ChannelInboundHandlerAdapter
- Bring back Channel.isWritable() from Netty 3
- Add ChannelInboundHandler.channelWritabilityChanges() event
- Add RecvByteBufAllocator configuration property
  - Similar to ReceiveBufferSizePredictor in Netty 3
  - Some existing configuration properties such as
    DatagramChannelConfig.receivePacketSize is gone now.
- Remove suspend/resumeIntermediaryDeallocation() in ByteBuf

This change would have been impossible without @normanmaurer's help. He
fixed, ported, and improved many parts of the changes.
2013-06-10 16:10:39 +09:00
..
src fix #1234 - duplicate package-info.java errors in eclipse requires release of netty-build v 19 and netty-parent update. 2013-04-05 05:38:05 +09:00
pom.xml Revamp the core API to reduce memory footprint and consumption 2013-06-10 16:10:39 +09:00
README.md readme.md -> README.md 2013-02-14 12:11:25 -08:00

info

this module build will fail if any dependencies introduce osgi split package

http://wiki.osgi.org/wiki/Split_Packages

on failure, build log will show error message similar to the following:

[INFO] --- maven-bundle-plugin:2.3.7:bundle (default-bundle) @ netty-verify-osgi ---
[ERROR] Bundle io.netty:netty-verify-osgi:bundle:4.0.0.Beta1-SNAPSHOT : Split package io/netty/buffer
Use directive -split-package:=(merge-first|merge-last|error|first) on Export/Private Package instruction to get rid of this warning
Package found in   [Jar:netty-buffer, Jar:netty-transport-udt]
Reference from     /home/user1/.m2/repository/io/netty/netty-transport-udt/4.0.0.Beta1-SNAPSHOT/netty-transport-udt-4.0.0.Beta1-SNAPSHOT.jar
Classpath          [Jar:., Jar:netty-buffer, Jar:netty-codec, Jar:netty-codec-http, Jar:netty-codec-socks, Jar:netty-common, Jar:netty-handler, Jar:netty-transport, Jar:netty-transport-rxtx, Jar:rxtx, Jar:netty-transport-sctp, Jar:netty-transport-udt, Jar:barchart-udt-bundle]
[ERROR] Error(s) found in bundle configuration