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.
Jetty is a lightweight servlet container, easy to embed within a java application, there is an easy to use jetty client also. Netty is an asynchronous event-driven network application framework. You can write your own servlet container or http client app with help of the Netty framework for example.
In summary: Use Tomcat to handle standard Java Container use cases, such as Servlets, JSP or framework which are built upon this stack. Use Netty If you deal a lot with network protocols and want it to be non-blocking use Netty usually for high-performance cases.
Netty allows you to write your own network protocol tailored to your specific requirements, optimizing the traffic flow for your specific situation, without the unnecessary overhead of something like HTTP or FTP.
Netty is a NIO client server framework which enables quick and easy development of network applications such as protocol servers and clients. It greatly simplifies and streamlines network programming such as TCP and UDP socket server.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With