14158070bf
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.
195 lines
6.7 KiB
XML
195 lines
6.7 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!--
|
|
~ Copyright 2012 The Netty Project
|
|
~
|
|
~ The Netty Project licenses this file to you under the Apache License,
|
|
~ version 2.0 (the "License"); you may not use this file except in compliance
|
|
~ with the License. You may obtain a copy of the License at:
|
|
~
|
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
|
~
|
|
~ Unless required by applicable law or agreed to in writing, software
|
|
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
~ License for the specific language governing permissions and limitations
|
|
~ under the License.
|
|
-->
|
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
|
|
<modelVersion>4.0.0</modelVersion>
|
|
<parent>
|
|
<groupId>io.netty</groupId>
|
|
<artifactId>netty-parent</artifactId>
|
|
<version>4.0.0.CR4-SNAPSHOT</version>
|
|
</parent>
|
|
|
|
<artifactId>netty-tarball</artifactId>
|
|
<packaging>pom</packaging>
|
|
|
|
<name>Netty/Tarball</name>
|
|
|
|
<dependencies>
|
|
<!-- The example depends on all modules either directly or transitively -->
|
|
<dependency>
|
|
<groupId>${project.groupId}</groupId>
|
|
<artifactId>netty-example</artifactId>
|
|
<version>${project.version}</version>
|
|
<scope>compile</scope>
|
|
<optional>true</optional>
|
|
</dependency>
|
|
<!-- All-in-one JAR -->
|
|
<dependency>
|
|
<groupId>${project.groupId}</groupId>
|
|
<artifactId>netty-all</artifactId>
|
|
<version>${project.version}</version>
|
|
<scope>compile</scope>
|
|
<optional>true</optional>
|
|
</dependency>
|
|
</dependencies>
|
|
|
|
<build>
|
|
<plugins>
|
|
<plugin>
|
|
<artifactId>maven-clean-plugin</artifactId>
|
|
<executions>
|
|
<execution>
|
|
<id>clean-first</id>
|
|
<phase>generate-resources</phase>
|
|
<goals>
|
|
<goal>clean</goal>
|
|
</goals>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
|
|
<!-- Disable animal sniffer -->
|
|
<plugin>
|
|
<groupId>org.codehaus.mojo</groupId>
|
|
<artifactId>animal-sniffer-maven-plugin</artifactId>
|
|
<executions>
|
|
<execution>
|
|
<id>default</id>
|
|
<phase>none</phase>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
<!-- Disable checkstyle -->
|
|
<plugin>
|
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
|
<executions>
|
|
<execution>
|
|
<id>check-style</id>
|
|
<phase>none</phase>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
<!-- Do not deploy this module -->
|
|
<plugin>
|
|
<artifactId>maven-deploy-plugin</artifactId>
|
|
<configuration>
|
|
<skip>true</skip>
|
|
</configuration>
|
|
</plugin>
|
|
</plugins>
|
|
</build>
|
|
|
|
<profiles>
|
|
<profile>
|
|
<id>full</id>
|
|
<build>
|
|
<plugins>
|
|
<plugin>
|
|
<artifactId>maven-dependency-plugin</artifactId>
|
|
<executions>
|
|
<execution>
|
|
<id>copy-jars</id>
|
|
<phase>prepare-package</phase>
|
|
<goals>
|
|
<goal>copy-dependencies</goal>
|
|
</goals>
|
|
<configuration>
|
|
<outputDirectory>${project.build.directory}/jars</outputDirectory>
|
|
<includeGroupIds>${project.groupId}</includeGroupIds>
|
|
<excludeArtifactIds>netty-all</excludeArtifactIds>
|
|
</configuration>
|
|
</execution>
|
|
<execution>
|
|
<id>copy-sources</id>
|
|
<phase>prepare-package</phase>
|
|
<goals>
|
|
<goal>copy-dependencies</goal>
|
|
</goals>
|
|
<configuration>
|
|
<classifier>sources</classifier>
|
|
<outputDirectory>${project.build.directory}/jars</outputDirectory>
|
|
<includeGroupIds>${project.groupId}</includeGroupIds>
|
|
<excludeArtifactIds>netty-all</excludeArtifactIds>
|
|
</configuration>
|
|
</execution>
|
|
<execution>
|
|
<id>copy-jars-all-in-one</id>
|
|
<phase>prepare-package</phase>
|
|
<goals>
|
|
<goal>copy-dependencies</goal>
|
|
</goals>
|
|
<configuration>
|
|
<outputDirectory>${project.build.directory}/jars-all</outputDirectory>
|
|
<includeGroupIds>${project.groupId}</includeGroupIds>
|
|
<includeArtifactIds>netty-all</includeArtifactIds>
|
|
</configuration>
|
|
</execution>
|
|
<execution>
|
|
<id>copy-sources-all-in-one</id>
|
|
<phase>prepare-package</phase>
|
|
<goals>
|
|
<goal>copy-dependencies</goal>
|
|
</goals>
|
|
<configuration>
|
|
<classifier>sources</classifier>
|
|
<outputDirectory>${project.build.directory}/jars-all</outputDirectory>
|
|
<includeGroupIds>${project.groupId}</includeGroupIds>
|
|
<includeArtifactIds>netty-all</includeArtifactIds>
|
|
</configuration>
|
|
</execution>
|
|
<execution>
|
|
<id>copy-apidocs-all-in-one</id>
|
|
<phase>prepare-package</phase>
|
|
<goals>
|
|
<goal>copy-dependencies</goal>
|
|
</goals>
|
|
<configuration>
|
|
<classifier>javadoc</classifier>
|
|
<outputDirectory>${project.build.directory}/apidocs-all</outputDirectory>
|
|
<includeGroupIds>${project.groupId}</includeGroupIds>
|
|
<includeArtifactIds>netty-all</includeArtifactIds>
|
|
</configuration>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
<plugin>
|
|
<artifactId>maven-assembly-plugin</artifactId>
|
|
<executions>
|
|
<execution>
|
|
<id>build-tarball</id>
|
|
<phase>package</phase>
|
|
<goals>
|
|
<goal>single</goal>
|
|
</goals>
|
|
<configuration>
|
|
<finalName>netty-${project.version}</finalName>
|
|
<appendAssemblyId>false</appendAssemblyId>
|
|
<attach>false</attach>
|
|
<descriptors>
|
|
<descriptor>${project.basedir}/assembly.xml</descriptor>
|
|
</descriptors>
|
|
</configuration>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
</plugins>
|
|
</build>
|
|
</profile>
|
|
</profiles>
|
|
</project>
|
|
|