Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Jetty or Netty?

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.

like image 918
ccleve Avatar asked Dec 26 '11 22:12

ccleve


People also ask

What is the difference between Netty and jetty?

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.

Is Netty better than Tomcat?

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.

Why Netty is used?

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.

Is Netty a web server?

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.


1 Answers

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.

like image 89
skaffman Avatar answered Sep 19 '22 11:09

skaffman