Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Performance Comparison: Spring Boot + Spring Data vs. Micronaut + GORM

DZone 's Guide to

Performance Comparison: Spring Boot + Spring Data vs. Micronaut + GORM

This article analyzes the performance differences between Spring Boot and Spring Data versus Micronaut and GORM.

· Microservices Zone ·
Free Resource

------------------------------------------------------

Update 10/23/2018 12:30 pm PDT:

------------------------------------------------------

With the latest release of micronautv1.0.0, it matches Spring without any changes to bombardier i.e. it's keeping the connection alive by default now.

For more information: check the original blog post.

Thanks to Micronaut team to responding so quickly to this post.

------------------------------------------------------

Update 10/23/2018 8:45 am PDT:

------------------------------------------------------

With the keep-alive connection header while testing with bombardier, micronaut provides the same results as Spring. Please review blog to see the most updated results.

You can find the result output for all of the run(s) here.

If you are interested in latest run with bombardier with keep-alive that output is here.

All the result outputs are here.

------------------------------------------------------

Update 10/23/2018 7:38 am PDT:
------------------------------------------------------


I have been working with Micronaut's team and they have quickly found the reason why bombardier tests provide such different results. bombardier closes the connection after every request and hence the huge discrepancy in the result. To address this Micronaut 1.0.GA would release with Http 1.1 default of keeping the connection open. I will be updating this article as soon as I can get hands on it. I will be updating the article pretty soon here with the results of providing Connection:keep-alive header with bombardier on Micronaut 1.0.0.RC3

---------------------------------------------------------------------------------------------------------------------------

Recently, I came across the Micronaut framework and found it to be very interesting. It provides a low memory footprint and fast bootup time. I have used Micronaut now for a couple of non-database-backed applications and it starts up really fast and is performing really well. In my performance tests comparing a Micronaut app to a Spring app, Micronaut performed better (this will be covered in a separate post).

The next step for me was to see if I could recommend Micronaut for database-backed applications. Micronaut works with straight-up Hibernate and even provides GORM (a Spring Data alternative). I am already familiar with Spring Data, so I am curious about GORM. I decided to give it a spin and see how it holds up compared to a Spring Data app.

You can find my repository on GitHub.

Details of the test:

  • This is a very basic application with a single domain object: Person.
  • Three records were inserted into an in-memory H2 database at startup time.
  • Only GETs are tested.
  • I haven't tweaked any of the apps for better performance — this is as out-of-the-box as we can get.
  • Spring Boot v2.0.6 is used Micronaut: 1.0.0.RC3 is used.
  • OS: MacOS High Sierra, 16 GB RAM, 2.5 Ghz Intel Core I7.
  • The mvn and java versions are as follows:
$ mvn -version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T12:39:06-07:00)
Maven home: /usr/local/Cellar/maven/3.5.0/libexec
Java version: 1.8.0_162, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.6", arch: "x86_64", family: "mac"
  • I used different tools (bombardier, ab, loadtest for performance tests since each one of them offers different results).

Results

Tabular comparison: Total time to complete requests = total time

Image title

Summary

  • Micronaut has a much faster startup time than Spring.
  • With bombardier, the Spring data app blows the Micronaut app out of the water as far as throughput is concerned.
  • With ab, micronaut wins by a slight margin.
  • With loadtest, it's too small a difference to decide.

Next Steps

This is probably going to be an in-progress article. I will add more information as I gain it. I will

  • Try a different load test tool.
  • Try loading these applications in a container to take my machine out of the picture.
  • Try a more real-world scenario, e.g. more entities and real relationships between them and constraints on domain classes.

Please feel free to share your thoughts/comments on the article. Try this out on your machine and feel free to share your results. Just be nice!

Topics:
microservices ,performance ,micronaut ,gorm ,spring boot ,spring data ,software architecture

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}