Skip to content

Commit 327e487

Browse files
committed
Infinispan Embedded Extension blog post
1 parent f378fcc commit 327e487

File tree

1 file changed

+130
-0
lines changed

1 file changed

+130
-0
lines changed
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
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+
=== Infinispan Embedded and Kubernetes deployments
50+
When running applications on Kubernetes, using Infinispan in embedded mode can introduce additional challenges.
51+
For instance, scaling an embedded Infinispan setup requires scaling the entire application pod, which may not be
52+
as efficient as scaling an external Infinispan cluster independently.
53+
Kubernetes' ability to handle distributed workloads aligns better with remote Infinispan setups, where storage
54+
and application layers can scale separately for improved resource management.
55+
56+
For more information, check the https://infinispan.org/docs/stable/titles/tuning/tuning.html[performance and tuning guides]
57+
in the official Infinispan documentation.
58+
59+
== How to get started
60+
Getting started is very easy. Just add the dependency to your Quarkus application:
61+
62+
[source, xml]
63+
----
64+
<dependency>
65+
<groupId>io.quarkiverse.infinispan</groupId>
66+
<artifactId>quarkus-infinispan-embedded</artifactId>
67+
<version>1.0.1</version>
68+
</dependency>
69+
----
70+
71+
Then you can Inject the `EmbeddedCacheManager` and interact with Infinispan.
72+
73+
[source, java]
74+
----
75+
@Inject
76+
private EmbeddedCacheManager cacheManager;
77+
----
78+
79+
To enable Protobuf serialization, you define a schema like this:
80+
81+
[source, java]
82+
----
83+
@Proto
84+
public record Greeting(String name, String message) {
85+
@ProtoSchema(includeClasses = { Greeting.class }, schemaPackageName = "io.quarkiverse.infinispan")
86+
public interface GreetingSchema extends GeneratedSchema {
87+
}
88+
}
89+
----
90+
Using the `EmbeddedCacheManager` you will be able to create caches on the fly.
91+
92+
[source, java]
93+
----
94+
Configuration config = new ConfigurationBuilder()
95+
.encoding().mediaType(MediaType.APPLICATION_PROTOSTREAM)
96+
.clustering().cacheMode(CacheMode.DIST_ASYNC).build();
97+
98+
// Create a cache
99+
Cache<String, Greeting> cache = cacheManager.administration()
100+
.withFlags(CacheContainerAdmin.AdminFlag.VOLATILE)
101+
.getOrCreateCache("mycache", config);
102+
103+
// Put a value in the cache
104+
cache.put(id, greeting);
105+
106+
// Read a value from the cache
107+
cache.get(id);
108+
----
109+
110+
== Native Support and Future Features
111+
112+
The Quarkus Infinispan Embedded Extension supports native mode, but some advanced
113+
features may be limited. We encourage developers to test it, share feedback, and help us enhance its
114+
capabilities.
115+
116+
== Where to Learn More
117+
118+
For detailed documentation and examples, check out the project in the Quarkiverse Hub:
119+
https://github.com/quarkiverse/quarkus-infinispan-embedded[Quarkiverse Infinispan Embedded Extension]
120+
121+
== Come Join Us
122+
We welcome your feedback and contributions to improve the extension. Feel free to open issues, suggest features,
123+
or contribute code on the project’s GitHub repository.
124+
Thank you for being part of the Quarkus community. We hope you enjoy the new Infinispan Embedded Extension!
125+
If you are a Quarkus user or just curious, don't be shy and join our welcoming community:
126+
127+
* provide feedback on https://github.com/quarkiverse/quarkus-infinispan-embedded/issues[GitHub issues];
128+
* craft some code and https://github.com/quarkiverse/quarkus-infinispan-embedded/pulls[push a PR];
129+
* ask your questions on https://github.com/quarkiverse/quarkus-infinispan-embedded/discussions[GitHub discussions].
130+
* 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)