Upgrade netty to 4.0.23 enable epoll

Patch by tjake; reviewed by Jason Brown for CASSANDRA-7761
This commit is contained in:
Jake Luciani 2014-10-06 23:03:08 -04:00
parent 186e994e28
commit dacddd2668
7 changed files with 30 additions and 4 deletions

View File

@ -1,4 +1,5 @@
2.1.1
* Upgrade netty version and enable epoll event loop (CASSANDRA-7761)
* Don't duplicate sstables smaller than split size when using
the sstablesplitter tool (CASSANDRA-7616)
* Avoid re-parsing already prepared statements (CASSANDRA-7923)

View File

@ -13,6 +13,15 @@ restore snapshots created with the previous major version using the
'sstableloader' tool. You can upgrade the file format of your snapshots
using the provided 'sstableupgrade' tool.
2.1.1
=====
New features
------------
- Netty support for epoll on linux is now enabled. If for some
reason you want to disable it pass, the following system property
-Dcassandra.native.epoll.enabled=false
2.1
===

View File

@ -398,12 +398,12 @@
<dependency groupId="com.addthis.metrics" artifactId="reporter-config" version="2.1.0" />
<dependency groupId="org.mindrot" artifactId="jbcrypt" version="0.3m" />
<dependency groupId="io.airlift" artifactId="airline" version="0.6" />
<dependency groupId="io.netty" artifactId="netty-all" version="4.0.20.Final" />
<dependency groupId="io.netty" artifactId="netty-all" version="4.0.23.Final" />
<dependency groupId="com.google.code.findbugs" artifactId="jsr305" version="2.0.2" />
<dependency groupId="com.clearspring.analytics" artifactId="stream" version="2.5.2" />
<dependency groupId="com.datastax.cassandra" artifactId="cassandra-driver-core" version="2.0.5" />
<dependency groupId="net.sf.supercsv" artifactId="super-csv" version="2.1.0" />
<dependency groupId="net.ju-n.compile-command-annotations" artifactId="compile-command-annotations" version="1.2.0" />
<dependency groupId="net.ju-n.compile-command-annotations" artifactId="compile-command-annotations" version="1.2.0" />
</dependencyManagement>
<developer id="alakshman" name="Avinash Lakshman"/>
<developer id="aleksey" name="Aleksey Yeschenko"/>

Binary file not shown.

Binary file not shown.

View File

@ -29,6 +29,9 @@ import javax.net.ssl.SSLEngine;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.epoll.Epoll;
import io.netty.channel.epoll.EpollEventLoopGroup;
import io.netty.channel.epoll.EpollServerSocketChannel;
import io.netty.util.Version;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -61,6 +64,7 @@ public class Server implements CassandraDaemon.Server
}
private static final Logger logger = LoggerFactory.getLogger(Server.class);
private static final boolean enableEpoll = Boolean.valueOf(System.getProperty("cassandra.native.epoll.enabled", "true"));
public static final int VERSION_3 = 3;
public static final int CURRENT_VERSION = VERSION_3;
@ -138,11 +142,23 @@ public class Server implements CassandraDaemon.Server
// Configure the server.
eventExecutorGroup = new RequestThreadPoolExecutor();
workerGroup = new NioEventLoopGroup();
boolean hasEpoll = enableEpoll ? Epoll.isAvailable() : false;
if (hasEpoll)
{
workerGroup = new EpollEventLoopGroup();
logger.info("Netty using native Epoll event loop");
}
else
{
workerGroup = new NioEventLoopGroup();
logger.info("Netty using Java NIO event loop");
}
ServerBootstrap bootstrap = new ServerBootstrap()
.group(workerGroup)
.channel(NioServerSocketChannel.class)
.channel(hasEpoll ? EpollServerSocketChannel.class : NioServerSocketChannel.class)
.childOption(ChannelOption.TCP_NODELAY, true)
.childOption(ChannelOption.SO_KEEPALIVE, DatabaseDescriptor.getRpcKeepAlive())
.childOption(ChannelOption.ALLOCATOR, CBUtil.allocator)