Increase the default maxMessagesPerRead of AbstractNioByteChannel to 16

- Related: #2079
This commit is contained in:
Trustin Lee 2013-12-21 20:08:15 +09:00
parent 1fcd19a28f
commit bab227213e

View File

@ -17,6 +17,7 @@ package io.netty.channel;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.UnpooledByteBufAllocator;
import io.netty.channel.nio.AbstractNioByteChannel;
import io.netty.channel.socket.SocketChannelConfig;
import java.util.IdentityHashMap;
@ -56,8 +57,11 @@ public class DefaultChannelConfig implements ChannelConfig {
}
this.channel = channel;
if (channel instanceof ServerChannel) {
// Accept as many incoming connections as possible.
if (channel instanceof ServerChannel || channel instanceof AbstractNioByteChannel) {
// Server channels: Accept as many incoming connections as possible.
// NIO byte channels: Implemented to reduce unnecessary system calls even if it's > 1.
// See https://github.com/netty/netty/issues/2079
// TODO: Add some property to ChannelMetadata so we can remove the ugly instanceof
maxMessagesPerRead = 16;
} else {
maxMessagesPerRead = 1;