What is the difference between Vert.x and Netty?

VB_ picture VB_ · Jul 20, 2017 · Viewed 7.6k times · Source

What is the difference between Vert.x and Netty? Why should one ever prefer Netty over Vert.x?

Both of them are event-driven, non-blocking and asynchronous frameworks designed for high-load I/O.

Vert.x is based on Multi-Reactor pattern (Node's style event loop on multithreaded JVM) but Netty use Interceptor Chain Pattern. When Interceptor Chain Pattern has any benefits over Multi-Reactor pattern ?

I just have a quick look at Netty's documentation, but it seems Vert.x has some extra funcitonality over Netty. I.e. Vertx is a standalone server, it's a polyglot, provide HA and clustering out-of-the-box.

Also Vert.x has little bit better benchmarks than Netty.

P.S. Disclaimer - I appreciate Vert.x very much, and not familiar with Netty. So by asking Why should one ever prefer Netty over Vert.x? I just trying to compare both of them.

Answer

Arnold Schrijver picture Arnold Schrijver · Jul 20, 2017

The difference is Vert.x is based on Netty. If you take a peek at the pom.xml in vertx-core you'll find:

<!-- We depend on the specific Netty dependencies not netty-all to reduce the size of fatjars -->
<dependency>
  <groupId>io.netty</groupId>
  <artifactId>netty-common</artifactId>
  <version>${netty.version}</version>
</dependency>
<dependency>
  <groupId>io.netty</groupId>
  <artifactId>netty-buffer</artifactId>
  <version>${netty.version}</version>
</dependency>
<dependency>
  <groupId>io.netty</groupId>
  <artifactId>netty-transport</artifactId>
  <version>${netty.version}</version>
</dependency>
<dependency>
  <groupId>io.netty</groupId>
  <artifactId>netty-handler</artifactId>
  <version>${netty.version}</version>
</dependency>
<dependency>
  <groupId>io.netty</groupId>
  <artifactId>netty-handler-proxy</artifactId>
  <version>${netty.version}</version>
</dependency>
<dependency>
  <groupId>io.netty</groupId>
  <artifactId>netty-codec-http</artifactId>
  <version>${netty.version}</version>
</dependency>
<dependency>
  <groupId>io.netty</groupId>
  <artifactId>netty-codec-http2</artifactId>
  <version>${netty.version}</version>
</dependency>
<dependency>
  <groupId>io.netty</groupId>
  <artifactId>netty-resolver</artifactId>
  <version>${netty.version}</version>
</dependency>
<dependency>
  <groupId>io.netty</groupId>
  <artifactId>netty-resolver-dns</artifactId>
  <version>${netty.version}</version>
</dependency>
<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-core</artifactId>
  <version>${jackson.version}</version>
</dependency>

And the Netty version for Vert.x 3.5.0-SNAPSHOT is: 4.1.8.Final

Vert.x is an entire toolkit and ecosystem of pluggable modules on top of Netty for building reactive applications on top of the JVM.