Skip navigation

Native transports

Did you know this page is automatically generated from a Github Wiki page? You can improve it by yourself here!

Since 4.0.16, Netty provides the native socket transport for Linux using JNI. This transport has higher performance and produces less garbage, so you might want to give it a try.

Using the native transport

Because the native transport is compatible with the NIO transport, you can just do the following search-and-replace:

  • NioEventLoopGroupEpollEventLoopGroup
  • NioEventLoopEpollEventLoop
  • NioServerSocketChannelEpollServerSocketChannel
  • NioSocketChannelEpollSocketChannel

Because the native transport is not part of the Netty core, you need to pull the netty-transport-native-epoll as a dependency in your Maven pom.xml:



Note that you must specify the proper classifier for the dependency. os-maven-plugin in the extensions section in the pom.xml file will set and os.detected.arch properties automatically. For more information. refer to the homepage of the os-maven-plugin.

For using the native transport in a sbt project, please add line below to your libraryDependencies:

"io.netty" % "netty-transport-native-epoll" % "${project.version}" classifier "linux-x86_64"

Building the native transport

If you already have the JAR file of the native transport, you should not need to build the native transport by yourself because the JAR file already contains the necessary shared library files (e.g. .so, .dll, .dynlib) and they will be loaded automatically.

To build the native transport, you need to use Linux with 64-bit kernel 2.6 or higher. Please also install the required tools and libraries:

# RHEL/CentOS/Fedora:
sudo yum install autoconf automake libtool make tar \
                 glibc-devel libaio-devel \
                 libgcc.i686 glibc-devel.i686
# Debian/Ubuntu:
sudo apt-get install autoconf automake libtool make tar \
                     gcc-multilib libaio-dev
Last retrieved on 12-Jan-2017