Skip to content

Commit 30a9148

Browse files
committed
Infinispan Embedded Extension blog post
1 parent f378fcc commit 30a9148

File tree

1 file changed

+129
-0
lines changed

1 file changed

+129
-0
lines changed
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
layout: post
3+
title: 'Quarkus Infinispan Embedded extension'
4+
date: 2024-12-18
5+
tags: infinispan cache library
6+
synopsis: 'Quarkus Infinispan Embedded extension release'
7+
author: karesti
8+
---
9+
10+
We are excited to announce the first release of the Quarkus Infinispan Embedded Extension!
11+
This extension is now available in the Quarkiverse Hub. It is a big step forward for developers
12+
who want to use Infinispan in embedded mode with Quarkus.
13+
14+
== What is Infinispan Embedded Mode?
15+
16+
Infinispan is a powerful, distributed in-memory data store and cache.
17+
In embedded mode, Infinispan runs within your application, in library mode, without needing a separate server.
18+
This means your app can handle data caching and storage directly in its own process, making it faster and simpler.
19+
20+
== Why Use the Quarkus Infinispan Embedded Extension?
21+
The new extension makes it easy to use Infinispan with Quarkus requiring minimal setup and
22+
delivering fast in-memory performance to your Quarkus apps.
23+
24+
== Use cases for Infinispan Embedded in Quarkus
25+
Here are some scenarios where using Infinispan in embedded mode with Quarkus might be a great fit:
26+
27+
*In-Memory Caching:* Use Infinispan as a local cache to speed up data retrieval and
28+
reduce database load in your application.
29+
30+
*Temporary Data Processing:* Manage and process temporary or short-lived data directly within
31+
the application.
32+
33+
*Local Data Storage for Microservices:* Use Infinispan as a lightweight,
34+
in-memory store for individual microservices that don’t require centralized data persistence.
35+
36+
*Offline Applications:* When working with offline or edge applications where an external server is not available,
37+
Infinispan embedded mode ensures data is stored locally and efficiently.
38+
39+
*Data Replication in Small Clusters:* Use Infinispan to handle data replication across a few nodes
40+
without the overhead of a separate Infinispan server.
41+
42+
== Trade-offs of Using Infinispan in Embedded Mode
43+
While running Infinispan in embedded mode offers simplicity and speed, there are some trade-offs to consider.
44+
Since Infinispan runs within your application's process, it shares the same memory and CPU resources.
45+
This can increase your application's resource usage, especially as the data size grows.
46+
Additionally, embedded mode is best suited for single-node or small-scale deployments; for larger, distributed systems,
47+
using Infinispan in remote mode with a dedicated server may offer better scalability and separation of concerns.
48+
49+
When running applications on Kubernetes, using Infinispan in embedded mode can introduce additional challenges.
50+
For instance, scaling an embedded Infinispan setup requires scaling the entire application pod, which may not be
51+
as efficient as scaling an external Infinispan cluster independently.
52+
Kubernetes' ability to handle distributed workloads aligns better with remote Infinispan setups, where storage
53+
and application layers can scale separately for improved resource management.
54+
55+
For more information, check the https://infinispan.org/docs/stable/titles/tuning/tuning.html[performance and tuning guides]
56+
in the official Infinispan documentation.
57+
58+
== How to get started
59+
Getting started is very easy. Just add the dependency to your Quarkus application:
60+
61+
[source, xml]
62+
----
63+
<dependency>
64+
<groupId>io.quarkiverse.infinispan</groupId>
65+
<artifactId>quarkus-infinispan-embedded</artifactId>
66+
<version>1.0.1</version>
67+
</dependency>
68+
----
69+
70+
Then you can Inject the `EmbeddedCacheManager` and interact with Infinispan.
71+
72+
[source, java]
73+
----
74+
@Inject
75+
private EmbeddedCacheManager cacheManager;
76+
----
77+
78+
To enable Protobuf serialization, you define a schema like this:
79+
80+
[source, java]
81+
----
82+
@Proto
83+
public record Greeting(String name, String message) {
84+
@ProtoSchema(includeClasses = { Greeting.class }, schemaPackageName = "io.quarkiverse.infinispan")
85+
public interface GreetingSchema extends GeneratedSchema {
86+
}
87+
}
88+
----
89+
Using the `EmbeddedCacheManager` you will be able to create caches on the fly.
90+
91+
[source, java]
92+
----
93+
Configuration config = new ConfigurationBuilder()
94+
.encoding().mediaType(MediaType.APPLICATION_PROTOSTREAM)
95+
.clustering().cacheMode(CacheMode.DIST_ASYNC).build();
96+
97+
// Create a cache
98+
Cache<String, Greeting> cache = cacheManager.administration()
99+
.withFlags(CacheContainerAdmin.AdminFlag.VOLATILE)
100+
.getOrCreateCache("mycache", config);
101+
102+
// Put a value in the cache
103+
cache.put(id, greeting);
104+
105+
// Read a value from the cache
106+
cache.get(id);
107+
----
108+
109+
== Native Support and Future Features
110+
111+
The Quarkus Infinispan Embedded Extension supports native mode, but some advanced
112+
features may be limited. We encourage developers to test it, share feedback, and help us enhance its
113+
capabilities.
114+
115+
== Where to Learn More
116+
117+
For detailed documentation and examples, check out the project in the Quarkiverse Hub:
118+
https://github.com/quarkiverse/quarkus-infinispan-embedded[Quarkiverse Infinispan Embedded Extension]
119+
120+
== Come Join Us
121+
We welcome your feedback and contributions to improve the extension. Feel free to open issues, suggest features,
122+
or contribute code on the project’s GitHub repository.
123+
Thank you for being part of the Quarkus community. We hope you enjoy the new Infinispan Embedded Extension!
124+
If you are a Quarkus user or just curious, don't be shy and join our welcoming community:
125+
126+
* provide feedback on https://github.com/quarkiverse/quarkus-infinispan-embedded/issues[GitHub issues];
127+
* craft some code and https://github.com/quarkiverse/quarkus-infinispan-embedded/pulls[push a PR];
128+
* ask your questions on https://github.com/quarkiverse/quarkus-infinispan-embedded/discussions[GitHub discussions].
129+
* discuss with us on https://infinispan.zulipchat.com/[Infinispan Zulip], https://quarkusio.zulipchat.com/[Quarkus Zulip] or on the https://groups.google.com/d/forum/quarkus-dev[mailing list];

0 commit comments

Comments
 (0)