diff --git a/CHANGES.txt b/CHANGES.txt
index c6735bc018..159979f6df 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -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)
diff --git a/NEWS.txt b/NEWS.txt
index b464b2107f..74fe652646 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -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
===
diff --git a/build.xml b/build.xml
index 957006a03b..84b10ede52 100644
--- a/build.xml
+++ b/build.xml
@@ -398,12 +398,12 @@
-
+
-
+
diff --git a/lib/licenses/netty-all-4.0.20.Final.txt b/lib/licenses/netty-all-4.0.23.Final.txt
similarity index 100%
rename from lib/licenses/netty-all-4.0.20.Final.txt
rename to lib/licenses/netty-all-4.0.23.Final.txt
diff --git a/lib/netty-all-4.0.20.Final.jar b/lib/netty-all-4.0.20.Final.jar
deleted file mode 100644
index 0d70c6659a..0000000000
Binary files a/lib/netty-all-4.0.20.Final.jar and /dev/null differ
diff --git a/lib/netty-all-4.0.23.Final.jar b/lib/netty-all-4.0.23.Final.jar
new file mode 100644
index 0000000000..0555a164d2
Binary files /dev/null and b/lib/netty-all-4.0.23.Final.jar differ
diff --git a/src/java/org/apache/cassandra/transport/Server.java b/src/java/org/apache/cassandra/transport/Server.java
index d6f01c268b..92cd6e10a9 100644
--- a/src/java/org/apache/cassandra/transport/Server.java
+++ b/src/java/org/apache/cassandra/transport/Server.java
@@ -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)