How to configure Netty to handle large volumes of requests?

In our application, we need to create an HTTP server where, when launched, it opens about 1600 permanent HTTP connections by various remote servers, and a stream of thousands of POST HTTP requests is sent for each connection in quick succession for about 30 seconds - to answer each of them only a few milliseconds are required. After 30 seconds, the connection closes and the other opens.

We chose Netty because, for most accounts, it is well suited for creating efficient HTTP servers.

When implementing our HTTP server, we used Snoop's example Netty HTTP server.

Unfortunately, we are having problems that can be explained by the Netty overload, so we are reviewing whether it is configured correctly, in particular, in how the threads are handled. We configure the server as follows:

ServerBootstrap bootstrap = new ServerBootstrap( new NioServerSocketChannelFactory( Executors.newCachedThreadPool(), Executors.newCachedThreadPool())); 

When we receive a request, we process it in the same thread that calls messageReceived () in our SimpleChannelUpstreamHandler.

Should this approach work in our application?

edit: The average value of the field load when failures occur is 0.05, so it is very small. I allocated 4 GB for the Java process, but I hardly used it. So, basically, the box is completely underloaded.

+4
source share
1 answer

Did you disable Nagle by installing "child.nodelay" in your ServerBootstrap?

(see http://static.netty.io/3.5/api/org/jboss/netty/bootstrap/ServerBootstrap.html )

0
source

All Articles