⚡️ Performance Comparison of Jax-RS implementations and embedded containers
Java Go JavaScript Other
Latest commit 1b7b74f Nov 8, 2016 @smallnest committed on GitHub Merge pull request #3 from stevehu/master
Add light-java framework and update README.md
Permalink
Failed to load latest commit information.
armeria add armeria implementation. It is a thrift/netty framework developed … Apr 25, 2016
dropwizard test result Nov 17, 2015
go-fasthttp add fasthttp Sep 20, 2016
go-restful 更正vert.x测试错误。以前的vert.x只用到一个CPU core.现在可以使用多核,性能数据也很好了。 Mar 29, 2016
go use iris as go restful framework Mar 29, 2016
jersey-grizzly2 test result Nov 17, 2015
jersey-jetty test result Nov 17, 2015
light-java Add light-java framework and update README.md Nov 9, 2016
nativenetty add missing file Apr 13, 2016
node.js add test codes for node.js Nov 24, 2015
resteasy-netty add more RESTful framework such as native netty, Xert.x, RESTEasy+netty4 Nov 18, 2015
resteasy-netty4 add more RESTful framework such as native netty, Xert.x, RESTEasy+netty4 Nov 18, 2015
resteasy-undertow test result Nov 17, 2015
springboot-undertow use undertow instead of default container tomcat May 28, 2016
springboot add spring boot application and its test result. Nov 18, 2015
vertx-verticles 更正vert.x测试错误。以前的vert.x只用到一个CPU core.现在可以使用多核,性能数据也很好了。 Mar 29, 2016
vertx 更正vert.x测试错误。以前的vert.x只用到一个CPU core.现在可以使用多核,性能数据也很好了。 Mar 29, 2016
.gitignore test result Nov 17, 2015
LICENSE Initial commit Nov 17, 2015
README.md Add light-java framework and update README.md Nov 9, 2016
TestData.md 更正vert.x测试错误。以前的vert.x只用到一个CPU core.现在可以使用多核,性能数据也很好了。 Mar 29, 2016
performance.png update benchmark diagram Apr 1, 2016
pom.xml comment this module to avoid broken build because of thrift Apr 25, 2016
testdata.xlsx 更正vert.x测试错误。以前的vert.x只用到一个CPU core.现在可以使用多核,性能数据也很好了。 Mar 29, 2016

README.md

Jax-RS-Performance-Comparison

Performance Comparison of Jax-RS implementations and embedded containers

Build Status

Gajotres have written an article: Top 8 Java RESTful Micro Frameworks. He listed 8 best light weight Java RESTful framework. Personally, I perfer jax-rs implementations and micro frameworks for deploying applications as micro services and those micro services can be deployed in docker containers.

So I have test five Jax-RS implementations plus embedded containers despite business logics. The RESTful service is very simple and it only returns a "hello world" string. Remember, tests don't contain any business logics even JSON libraries. There are other articles to dicuss serialization framework. For example, my test

I have added more RESTful framework besides Jax-RS implementation, which contains:

  • Spring-boot
  • RESTEasy + Netty4
  • Native Netty
  • Vert.x
  • Go

You can check the test result and the performancre chart.

Compile applications

It is a multiple-module maven project. You can run "mvn package" in parent directory to packge each module. It generates a fat-jar in target directories of modules for each module. It is easy.

Test Environment

Server AWS C3.2xlarge

  • 8 cores (E5-2666 v3 @ 2.90GHz)
  • memory: 16G (only allocate 4G for restful applications)

Java 1.8.0_51

Test tool wrk the test cmd is like: wrk -t16 -c1000 -d30s http://127.0.0.1:8080/rest/hello. I use 16 threads and 100/200/500/1000 connnections to test each case.

Starting Server

java -Xmx4g -Xms4g -jar jersey-grizzly2-1.0-SNAPSHOT.jar
java -Xmx4g -Xms4g -jar jersey-jetty-1.0-SNAPSHOT.jar
java -Xmx4g -Xms4g -jar dropwizard-1.0-SNAPSHOT.jar hello.yml 
java -Xmx4g -Xms4g -jar resteasy-netty-1.0-SNAPSHOT.jar 
java -Xmx4g -Xms4g -jar resteasy-undertow-1.0-SNAPSHOT.jar
java -Xmx4g -Xms4g -jar springboot-1.0-SNAPSHOT.jar
java -Xmx4g -Xms4g -jar resteasy-netty4-1.0-SNAPSHOT.jar 
java -Xmx4g -Xms4g -jar nativenetty-1.0-SNAPSHOT.jar
java -Xmx4g -Xms4g -jar vertx-1.0-SNAPSHOT.jar
java -Xmx4g -Xms4g -jar swagger-light-java-1.0.0.jar

Test Result

Test data is here

Conclusion

It looks Resteasy is better than jersey whatever jersey uses grizzly2 or jetty container.

It is predictable that performance of dropwizard is same to jersey+jetty.

Resteasy is excellent in undertow and netty.

To my surprise is resteasy+undertow is a little better than resteasy+netty. Maybe they are all developed by JBoss and they have done some optimization.

I do not recommend you use spring boot in large projects because its performance and style.

Of course native netty is number one but my test has not contains a http router so maybe you can't say it is RESTful framework. But I like its perforamnce.

Performance of RESTEasy+netty4 is lower than what i expect. but RESTEasy+netty3 is very good.

One interesting framework is Vert.x. I like its functional programming style but its performance is not so good.

I have not monitored the CPU usage and memory usage. You can try it.

Update

  • 2015/11/19 add native go, go-restful codes