Questions tagged [netty]

An open source asynchronous event-driven network application framework written in Java. It is a NIO client server framework which enables quick and easy development of network applications such as protocol servers and clients

Netty is an asynchronous event-driven network application framework for rapid development of maintainable high performance protocol servers & clients.

If you have a question about using Netty in your network application, this is the tag you should use.

Useful Links

  • Netty home page provides a user guide, JavaDoc, and various examples. Please make sure to read the user guide before posting a question. Otherwise you have a very high chance of asking a trivial question.
  • User mailing list archive contains a number of questions and answers related with Netty. If you failed to find the answer for your question, you might want to search this archive before posting the question at StackOverflow.
  • Wikipedia page

Using as a dependency in a maven project

Netty can be used in combination with the dependency system from maven.

Depending on your use case, you can either include "netty-all", or add all the modules you use separately. The following examples give an example how to use netty-all in combination with maven.

The following should be placed under the <dependencies> tag in .

Latest SNAPSHOT

<dependency>
    <groupId>io.netty</groupId>
    <artifactId>netty-all</artifactId>
    <version>5.0.0.Alpha3-SNAPSHOT</version>
</dependency>

Latest Beta

<dependency>
    <groupId>io.netty</groupId>
    <artifactId>netty-all</artifactId>
    <version>5.0.0.Alpha3</version>
</dependency>

Latest Alpha

<dependency>
    <groupId>io.netty</groupId>
    <artifactId>netty-all</artifactId>
    <version>4.1.0.Beta8</version>
</dependency>

Latest Final

<dependency>
    <groupId>io.netty</groupId>
    <artifactId>netty-all</artifactId>
    <version>4.0.35.Final</version>
</dependency>
4961 questions
27
votes
1 answer

Netty: Idle State Handler is not showing if channel is idle

My Requirement: I want to detect if the channel is idle for reading for some amount of time and want to timeout based on that. My Netty client is sending requests to 1000 servers. Problem: My Netty Client is never showing that if there is an idle…
ojas
  • 2,150
  • 5
  • 22
  • 37
27
votes
1 answer

What is the exact use of the executor in grpc-java’s ServerBuilder? Does it just execute the handler methods?

grpc-java uses an executor in its ServerBuilder, which if not defined by the builder.executor() method, uses a static cached thread pool by default. What is the exact use of this executor? Does it just execute the handler methods or does it do…
gravetii
  • 9,273
  • 9
  • 56
  • 75
26
votes
2 answers

Why do we need to manually handle reference counting for Netty ByteBuf if JVM GC is still in place?

According to the book Netty in Action v10, reference counting is used to handle the pooling of ByteBuf. But JVM is not aware of the netty reference counting, so JVM can still GC the ByteBuf. If so, why do we still need to care about the reference…
smwikipedia
  • 61,609
  • 92
  • 309
  • 482
26
votes
3 answers

What are the Netty alternatives for high-performance networking?

I am in the process of choosing a networking library to implement a client/server system that cannot spare any microsecond. It will implement its own protocol to send and receive messages. I am looking for a good NIO framework that will allow me to…
chrisapotek
  • 6,007
  • 14
  • 51
  • 85
26
votes
2 answers

Play framework/Netty does not release socket

Have already asked similar question, but deleted it, since thought I fixed it, but I was wrong. I'm using Play framework in production for one of my web projects. From time to time Play does not render main page or does not return some of the static…
Anton
  • 5,831
  • 3
  • 35
  • 45
26
votes
1 answer

Netty slower than Tomcat

We just finished building a server to store data to disk and fronted it with Netty. During load testing we were seeing Netty scaling to about 8,000 messages per second. Given our systems, this looked really low. For a benchmark, we wrote a Tomcat…
voidmain
  • 1,625
  • 1
  • 14
  • 14
25
votes
2 answers

Unable to derive module descriptor for auto generated module names in Java 9?

My project depends on Netty Epoll transport. Here is dependency: io.netty netty-transport-native-epoll ${netty.version}
25
votes
1 answer

What is the difference between Vert.x and Netty?

What is the difference between Vert.x and Netty? Why should one ever prefer Netty over Vert.x? Both of them are event-driven, non-blocking and asynchronous frameworks designed for high-load I/O. Vert.x is based on Multi-Reactor pattern (Node's…
VB_
  • 45,112
  • 42
  • 145
  • 293
25
votes
5 answers

PlayFramework 2.4.6 error 413 Request Entity Too Large

I am using PlayFramework 2.4.6, trying to upload a multipart file (size 18M) and the server returns the following error: For request 'POST /api/myEndpoint' [Request Entity Too Large] I have looked around and tried the following with out…
Gleeb
  • 10,773
  • 26
  • 92
  • 135
25
votes
2 answers

Finding out what network sockets are open in the current Java VM

I'm writing an end-to-end test that my Java program releases all of its resources - threads, server sockets, client sockets. It's a library, so releasing resources by exiting the JVM is not an option. Testing the releasing of threads was easy,…
Esko Luontola
  • 73,184
  • 17
  • 117
  • 128
23
votes
4 answers

Which NIO library (Netty, Grizzly, kryonet, ...) for simple backend server implementation in Java?

Our frontend is simple Jetty (might be replaced with Tomcat later on) server. Through servlets, we are providing a public HTTP API (more or less RESTful) to expose our product functionality. In the backend, we have a Java process which does several…
Japer D.
  • 754
  • 1
  • 9
  • 18
22
votes
1 answer

java.lang.UnsupportedOperationException: Reflective setAccessible(true) disabled

When I run my Ktor application with gradle run then I've got the following exception: 19:21:11.795 [main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework 19:21:11.810 [main] DEBUG…
softshipper
  • 32,463
  • 51
  • 192
  • 400
22
votes
2 answers

PrematureCloseException: Connection prematurely closed

im using Web-flux/Reactive and Webclient, running it on tomcat and spring-boot. Everything works fine. I read a lot about it. The problem seems to be that whenever you use webclient, you have to return or use the response, otherwise it will close…
Douglas Santos
  • 515
  • 1
  • 4
  • 12
22
votes
1 answer

How does vert.x achieve superior performance compared to Netty?

The recent TechEmpower performance benchmarks have been showing vert.x on top of Netty, sometimes by a large amount. According to its website, vert.x uses Netty for "much of its network IO". If so, how does it achieve superior performance as…
osman
  • 1,590
  • 1
  • 14
  • 21
22
votes
7 answers

Netty based non-blocking REST framework

I am working on a RESTfull application which requires high scalability. I am considering Netty based frameworks for RESTfull applications. I went through some of the available options and tried to get what they can offer as a non-blocking…
Vaibhav Raj
  • 2,214
  • 4
  • 23
  • 39