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

StackOverflow https://stackoverflow.com/questions/8269093

Question

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 kind of maintenance tasks. While the backend process usually does it own tasks when it's time, now and then, the frontend needs to wake-up the backend to execute a certain task in the background.

Which (N)IO library would be ideal for this task? I found Netty, Grizzly, kryonet and plain RMI. For now, I am inclined to say Netty, it seems simple to use and it is probably very reliable.

Does any of you have experience in this kind of setups? What would your choice be?

thanks!

Was it helpful?

Solution

Try to translate this document which answer to your question. http://blog.xebia.fr/2011/11/09/java-nio-et-framework-web-haute-performance/

This society, as french famous Java EE experts, did a lot of poc of NIO servers in the context of a french challenge sponsored by VmWare (USI2011). It was about building a simple quizz app that can handle a load of 1 million connected users.

They won that challenge with great results. Their implementation was Netty + Gemfire and they only replaced the CachedThreadPool by a MemoryAwareThreadPool.

Netty seems to offer great performances, and is well documented.

They also considered Deft, inspired by Tornado (python/facebook) but it's still a bit immature for them

Edit: here's the translated link provided in the comments

OTHER TIPS

My preference is Netty. It's simple yet flexible. Very fast and the community around Netty is awesome.

The company I work for is currently evaluating CoralReactor. It is a commercial software but it has the easiest API I have ever seen for Java NIO. My personal opinion is that Netty makes things too complicated, especially if you want to go garbage-free and single-threaded, which are a requirement for many companies from the finance, advertisement and game industry.

I would decouple them by using JMS, just have some (set of) control queues your backend sits there listening on and you're done. No need to write a custom nio api here.

One sample provider is hornetq. This can be run as an in process jms broker as well, it uses Netty under the covers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top