Blog title MicroStream vs JPA - the ultimate speed test

MicroStream vs JPA and SQL: The Ultimate Performance Test

On our website, we claim that it is up to 1000x Faster than JPA with traditional database solutions.

In this blog, we describe the evidence for this claim and you can even try it for yourself to verify that this is not just a marketing claim.

The information in this blog is also available as a YouTube video: https://www.youtube.com/watch?v=XlfnMQm0uqw

BookStore Demo

The claim of the 1000x better speed is coming from the results of the Bookstore demo application. It is a Spring Boot application that keeps track of book purchases by customers in various shops that are located in different cities and countries.

The same functionality is implemented with Hibernate and a Postgres database or with MicroStream. That way, we can compare how much it takes to load the same data using Hibernate and with MicroStream.

The differences in execution time vary with the query that is executed. simple queries are 10 times faster but really complex ones can be 1000 x faster.

The code for this project can be found at this GitHub repository: https://github.com/microstream-one/bookstore-demo-performance

Playground

The Bookstore demo is of course a visually appealing solution, but there is another repository related to performance, which is much easier to access for everyone. The Performance white paper repository https://github.com/rdebusscher/performance-whitepaper contains a simplified version of the bookstore demo.

It contains a set of Java SE-based main methods that compare the execution time of Hibernate, MicroStream, and pure JDBC. No fancy graphics, but code that should be accessible for every developer without the need to understand Spring Boot, Vaadin, etc …

It has a data generator that makes sure that the same data is used by the MicroStream code as the other frameworks.

The conclusions about the comparison can be read in the Whitepaper itself.

Read performance

In conclusion, you can find find the comparison of a simple query, a paginated read of a single table, and a complex query involving more than 10 tables, in the figures below.

Fig 1: Time to read paginated data including connection time

 

Fig 2: Time to execute complex query including connection time

For a full description, have a look at the whitepaper itself. But from the graphs, it is clear that MicroStream data retrieval is faster, especially for very complex queries. The overhead of Hibernate with its query analysis and mapping can be seen when you compare it with a pure JDBC solution.
So is Hibernate and database usage than a bad thing? Not at all, it depends on your use case. But if performance is important for your application, MicroStream performs a lot better.

Write Performance

But the Bookstore demo is only about reading data. In almost all applications, this is also the most important factor since we need to read much more data than we update or create.

But what about the performance of MicroStream when it needs to write data?

In that same repository, another section is dedicated to writing data. It compares the time that is needed to write 2.8 million records to the database or through MicroStream. It also makes use of Lazy references so that all the data isn’t loaded at the same time when accessing the data.

The results are summarised in this graph.

Fig 2: Time to store records

Also here we can see clearly a faster execution when using MicroStream.

Academic support

But it is not only MicroStream itself that comes with clear evidence that the solution is faster than a traditional approach using JPA and Hibernate.

People from the Otto-Friedrich University in Bamberg wanted to verify our claim that MicroStream is 1000 times faster. You can download the research paper from our website.

They could not reproduce the query that performs 1000 times faster but confirmed MicroStream is over 400 times faster than the JPA solution.

They also adapted the application from the TPC-C benchmark specification. An application designed to test out the performance of the solution which includes a typical mixture of reading and writing data within an Online Transaction Application (OLTP)

Conclusion

There are several comparisons available that confirm that MicroStream is significantly faster than the traditional JPA and database solution. There is the BookStore performance demo that compares reading times, either in a nice graphic way using a fully-fledged Spring Boot with Vaadin application. Or a simple Java SE program that just has the required dependency and no fancy bells. Besides reading, there is also a comparison when performing writing data and an independent academic research, that all confirm:

MicroStream is fast!

 

Watch the video: Microstream vs. JPA – The Ultimate Speed Test

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

MicroStream training in 2023

Next Post

MicroStream Becomes an Eclipse Project

Related Posts
Secured By miniOrange