logo

Jetty vs Netty

TL;DR

  • Netty: to deal with network protocols; non-blocking, high-performance. Used by distributed data processing frameworks like Apache Spark, Presto, Cassandra, Akka; also by gRPC.
  • Jetty: a light HTTP servlet container. Similar to Tomcat; SpringBoot uses Tomcat by default but can be changed to use Jetty.

More Details

What is a servlet container:

  • also known as a web container.
  • a servlet receives a request and generate a response
  • a Servlet Container manages the lifecycle of servlets, mapping URL to servlet; part of a web server.
  • examples: Tomcat, GlassFish, JBoss, etc.
  • Servlet API: javax.servlet

Even though the names of "Netty" and "Jetty" look confusingly similar, they are essentially 2 different things:

  • Jetty is a lightweight servlet container, originated from Eclipse, easy to embed within a java application.
  • Netty is an asynchronous, event-driven, non-blocking I/O, network application framework. Netty can run inside a servlet container.

Official Websites