Use Jetty or Netty?

ccleve picture ccleve · Dec 26, 2011 · Viewed 28.4k times · Source

We're in the process of writing a high-performance server for processing messages. We've been using Jetty for several years and like it, but Netty looks like it has some cool features. In particular, it has support for asynchronous processing so a thread doesn't have to be tied up waiting for the system to process a given message. It's designed to solve the C10k problem.

I know that Jetty has some support for NIO internally. Does it also have an asynchronous model?

The messages are likely to be in http format. Does Netty have any performance advantages over Jetty when doing plain old http?

I'd like to have all the convenient features of a real servlet container, but not at the cost of reduced performance.

Answer

skaffman picture skaffman · Dec 27, 2011

Jetty has had support for asynchronous request processing since version 6 (see here), using a proprietary API. More recent versions support the asynchronous API as part of the Servlet 3.0 API, like any other compliant implementation.

Using Netty would seem like a lot of work for little gain, unless you have highly specific requirements. Otherwise, Jetty would do the job for you with minimal effort.