MicroStream + Helidon =
Brave Performance Combination

Dmitry Aleksandrov
Published in
3 min readNov 11, 2021


MicroStream provides high-performance, Java-native object graph persistence.

MicroStream replaces the heavyweight JPA and allows you to store - and partially load- any Java object graph or subgraph. It also provides microsecond response time and ultra-high throughput with minimal latencies. Now you can use MicroStream with Helidon 2.4 to create ultra fast, in-memory database applications and microservices.

MicroStream completely reworked Java’s serialization mechanisms, providing the ability to save partially loaded objects directly to disk, databases, or cloud object stores. Just choose the right Store Manager.

Helidon now has full integration with this technology.

MicroStream + Helidon MP

As mentioned above, MicroStream is now fully integrated with Helidon, which means that MicroStream components can read all their configuration directly from Helidon config.

There is a special set of annotations to inject to Storage Manager:

First, add the Maven dependency:


Then you can use the MicroStream support:

public GreetingProvider(@MicrostreamStorage(configNode =
EmbeddedStorageManager storage) {
this.storage = storage;
greetingMessages = (List<String>) storage.root();
if (greetingMessages == null) {
greetingMessages = new ArrayList<>();

The configuration will be read from the microprofile-config.properties file.


In Helidon’s official examples repository, you may find a slightly modified Greeting example. The main modification is adding a persistence to the set of “Greetings” you add. This means that if you add a new greeting, and restart the application, the set of them will not be lost.

You can try it for yourself with this example: https://github.com/oracle/helidon/tree/master/examples/integrations/microstream/greetings-mp

MicroStream + Helidon SE

The exact same functionality is provided in Helidon SE. You can use EmbeddedStorageManagerBuilderto initialize the MicroStream Storage Manager. All the configuration is taken from the Helidon Config:

GreetingService(Config config) {          
mctx = new GreetingServiceMicrostreamContext

As you see, all the operations with MicroStream are asynchronous and reactive.

public CompletableFuture<Void> addLogEntry(String name) {
return execute(() -> {
List<LogEntry> logs = (List<LogEntry>)
logs.add(new LogEntry(name, LocalDateTime.now()));
return null;

Persisting an object is also simplified:

private void sendResponse(ServerResponse response, String name) {
String msg = String.format("%s %s!", greeting.get(), name);


JsonObject returnObject = JSON.createObjectBuilder()
.add("message", msg)

Try it! You can access the Helidon SE + MicroStream example in our official repository: https://github.com/oracle/helidon/tree/master/examples/integrations/microstream/greetings-se

Health Support and Metrics

Full integration includes also provide health checks and metrics support. Because Helidon is modular, you need to add a Maven dependency in order to read health checks:


and then for Helidon SE you should just register it:

HealthCheck microstreamHealthCheck = MicrostreamHealthCheck.create(greetService.getManager());
MetricsSupport metrics = MetricsSupport.create();
HealthSupport health = HealthSupport.builder()

The same method is used for metrics.

First, add the Maven dependency:


then, by using MicrostreamMetricsSupportobject, you can register a StorageManager:


Now all the health and metrics information is available under /health and /metrics endpoints of Helidon.

MicroStream Cache

MicroStream provides its own implementation of JSR107 — Caching Support.

It is available when you add this Maven dependency:


Then we can modify our Greetings application to use cache for our greeting:

Cache<String, String> greetingsCache;

public GreetingsProvider(@MicrostreamCache(configNode=
"one.microstream.cache", name = "greetingsCache")
Cache<String, String> cache) {
this.greetingsCache = cache;
public String get(String key) {
return greetingsCache.get(key);
public void add(String key, String responseObject) {
greetingsCache.put(key, responseObject);

There is a special @MicrostreamCache annotation that will read all the caching configuration from microprofile-config.properties:

#Microstream cache config
one.microstream.cache.storage.storage-directory = ./greetingsCache
one.microstream.cache.keyType = java.lang.String
one.microstream.cache.valueType = java.lang.String
one.microstream.cache.readThrough = true
one.microstream.cache.writeThrough = true

As you see, it‘s that easy!


MicroStream is a real game changer in the industry. If you want to create really performant microservices, to work in really high-pressure environments, then Helidon + MicroStream is a really great choice! Not only is it easy to set up and use, but now its fully integrated.

Kudos to MicroStream team!

More info: http://microstream.one