Concurrent with the release of MicroStream 5.0, the company has also announced that their Java persistence framework is also open source.
MicroStream is used productively in business-critical projects for more than six years. It's proven, stable and has a high code quality. Now, it's time to open source it. Open Source provides strong value and great benefits for our community. The source code is now available for anyone to read.
First introduced in April 2019, MicroStream is a persistence engine for storing any kind of Java object for example lists and collections as well as any document. It is similar to Java built-in serialization but much more powerful. It can persist, load or update object graphs partially and on-demand, contrary to Java serialization that can persist only complete object graphs. It is also very efficient, both size- and performance-wise.
MicroStream is not a complete replacement for a database management system (DBMS), since it lacks user management, connection management, session handling etc., but in the vision of the developers of MicroStream, those features could be better implemented in dedicated server applications.
MicroStream considers DBMS an inefficient way of persisting data since every database has its data structure and, hence, data must be converted and mapped with an additional layer such as an object relational mapper (ORM). These frameworks add complexity, increase latency and introduce performance loss.
The MicroStream Data-Store technology removes the need for these conversions and everything can be stored directly in memory, making it super fast for queries and simplifying the architecture using just plain Java.
According to their website, performance is increased by 10x for a simple query with a peak of 1000x for a complex query with aggregation (sum) compared to JPA. Alternatively, they also offer connectors for databases like Postgres, MariaDB, SQLite and Plain-file storage (even on the cloud) to persist data.
Other notable features are ACID transactions, multi-threaded IO and lazy loading.
The query system uses Java Streams API for searching object graphs in memory. Consider the following method:
public static void booksByAuthor()
{
final Map<Author, List<Book>> booksByAuthor =
ReadMeCorp.data().books().stream()
.collect(groupingBy(book -> book.author()));
booksByAuthor.entrySet().forEach(e -> {
System.out.println(e.getKey().name());
e.getValue().forEach(book -> {
System.out.print('\t');
System.out.println(book.title());
});
});
}
Persisting data to a file storage is as simple as:
DataRoot root = microstreamDemo.root();
root.getCustomers().add(customer);
microstreamDemo.store(root.getCustomers());
Markus Kett, CEO and co-founder of MicroStream, spoke to InfoQ about MicroStream.
InfoQ: What was the inspiration to open source MicroStream?
Markus Kett: For us as passionate Java developers, it's the greatest recognition and motivation when developers love to use us. MicroStream as open source provides strong value and great benefits for our users. Understanding the code, the functional principle of MicroStream, debugging, finding and fixing bugs is now possible. It gives developers the flexibility to customize and extend MicroStream on their own. In addition, permanent reviews of the code base and numerous test cycles by lots of developers will increase the stability of MicroStream. Open source creates trust and reduces the entry hurdle. Now, we're proud to be part of the fantastic globally open source community.
InfoQ: How has the Java community responded to MicroStream being open source?
Kett: As many Java User Groups around the world gave us the chance to introduce MicroStream to their members, many Java developers were keen on getting MicroStream as open source. After we open-sourced MicroStream, we received great feedback.
InfoQ: What's on the horizon for MicroStream?
Kett: MicroStream is the predestined persistence layer for microservices that should have its own persistence, because in comparison to ORM frameworks, MicroStream is super lightweight and simple to implement, indeed a micro persistence. That's why various microservice framework vendors are interested in integrating MicroStream. We're currently working together with the Helidon team at Oracle as well as with the Open Liberty team at IBM on integrating MicroStream with Project Helidon and Open Liberty.
To provide users with the best possible comfort and support, we're working on a MicroStream Cloud that enables us to set up MicroStream cluster running distributed apps by replicating object graphs between JVM processes, as well as high-available storage services and fully managed services.
The MicroStream implementation for Android, which is already available, is currently being rewritten. It enables the use of MicroStream on mobile and edge devices as well as synchronizing these devices in a super simple way with Java apps and microservices running in the cloud.
MicroStream can be used as a single dependency with Maven. Developers interested in contributing to MicroStream may start by visiting their GitHub repository.