Fastest Microservices in Java
I’ve been working with Dropwizard for 2 years, and 2 months ago I’ve started to wonder what framework is the fastest to build a microservice from scratch, so, I’ ve been testing Spring Boot, Dropwizard and Spark to answer my own question and today I’m going to share my results with you.
The environment
First, I created a docker container to run the application, with 1GB of RAM and 1 CPU. The endpoint to test was very simple, just a service to retrieve 100 movies stored in memory and serialized to Json format with Jackson serializer. I used jMeter to do the load test, running it during 5 minutes.
The results: Startup time
The time the application takes to start is a good way to know how much work it’s doing behind the scenes. Spring boot takes 9 seconds to be up and running. Dropwizard is faster with its 3 seconds of startup, but nothing compares with the 0.7 seconds that Spark needs to do the same job. That’s really fast!
Get Pablo Pallocchi’s stories in your inbox
Join Medium for free to get updates from this writer.
The results: Response time
Ok, sweet, Spark is the fastest in terms of startup, but what about the response time? what’s better? ok, that little piece of framework just did it again: it’s 3 times faster than Spring Boot!
Also Spark seems to have the most stable response time across the time.
The results: Throughput
Because Spark has a lower response time, you could suppose its throughput is higher, and you are right…
Conclusion
Based on all of these results, I think Spark is the best choice if you want to start a new microservice from scratch and you really care about the speed, because it’s a really super small framework with the basic features you need to build a simple but powerful API.









