From 30a91481a09ba209562ca18109e49e3720e55840 Mon Sep 17 00:00:00 2001 From: Katia Aresti Date: Tue, 17 Dec 2024 15:31:14 +0100 Subject: [PATCH] Infinispan Embedded Extension blog post --- ...024-12-18-quarkus-infinispan-embedded.adoc | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 _posts/2024-12-18-quarkus-infinispan-embedded.adoc diff --git a/_posts/2024-12-18-quarkus-infinispan-embedded.adoc b/_posts/2024-12-18-quarkus-infinispan-embedded.adoc new file mode 100644 index 0000000000..018a726de3 --- /dev/null +++ b/_posts/2024-12-18-quarkus-infinispan-embedded.adoc @@ -0,0 +1,129 @@ +--- +layout: post +title: 'Quarkus Infinispan Embedded extension' +date: 2024-12-18 +tags: infinispan cache library +synopsis: 'Quarkus Infinispan Embedded extension release' +author: karesti +--- + +We are excited to announce the first release of the Quarkus Infinispan Embedded Extension! +This extension is now available in the Quarkiverse Hub. It is a big step forward for developers +who want to use Infinispan in embedded mode with Quarkus. + +== What is Infinispan Embedded Mode? + +Infinispan is a powerful, distributed in-memory data store and cache. +In embedded mode, Infinispan runs within your application, in library mode, without needing a separate server. +This means your app can handle data caching and storage directly in its own process, making it faster and simpler. + +== Why Use the Quarkus Infinispan Embedded Extension? +The new extension makes it easy to use Infinispan with Quarkus requiring minimal setup and +delivering fast in-memory performance to your Quarkus apps. + +== Use cases for Infinispan Embedded in Quarkus +Here are some scenarios where using Infinispan in embedded mode with Quarkus might be a great fit: + +*In-Memory Caching:* Use Infinispan as a local cache to speed up data retrieval and +reduce database load in your application. + +*Temporary Data Processing:* Manage and process temporary or short-lived data directly within +the application. + +*Local Data Storage for Microservices:* Use Infinispan as a lightweight, +in-memory store for individual microservices that don’t require centralized data persistence. + +*Offline Applications:* When working with offline or edge applications where an external server is not available, +Infinispan embedded mode ensures data is stored locally and efficiently. + +*Data Replication in Small Clusters:* Use Infinispan to handle data replication across a few nodes +without the overhead of a separate Infinispan server. + +== Trade-offs of Using Infinispan in Embedded Mode +While running Infinispan in embedded mode offers simplicity and speed, there are some trade-offs to consider. +Since Infinispan runs within your application's process, it shares the same memory and CPU resources. +This can increase your application's resource usage, especially as the data size grows. +Additionally, embedded mode is best suited for single-node or small-scale deployments; for larger, distributed systems, +using Infinispan in remote mode with a dedicated server may offer better scalability and separation of concerns. + +When running applications on Kubernetes, using Infinispan in embedded mode can introduce additional challenges. +For instance, scaling an embedded Infinispan setup requires scaling the entire application pod, which may not be +as efficient as scaling an external Infinispan cluster independently. +Kubernetes' ability to handle distributed workloads aligns better with remote Infinispan setups, where storage +and application layers can scale separately for improved resource management. + +For more information, check the https://infinispan.org/docs/stable/titles/tuning/tuning.html[performance and tuning guides] +in the official Infinispan documentation. + +== How to get started +Getting started is very easy. Just add the dependency to your Quarkus application: + +[source, xml] +---- + + io.quarkiverse.infinispan + quarkus-infinispan-embedded + 1.0.1 + +---- + +Then you can Inject the `EmbeddedCacheManager` and interact with Infinispan. + +[source, java] +---- +@Inject +private EmbeddedCacheManager cacheManager; +---- + +To enable Protobuf serialization, you define a schema like this: + +[source, java] +---- +@Proto +public record Greeting(String name, String message) { + @ProtoSchema(includeClasses = { Greeting.class }, schemaPackageName = "io.quarkiverse.infinispan") + public interface GreetingSchema extends GeneratedSchema { + } +} +---- +Using the `EmbeddedCacheManager` you will be able to create caches on the fly. + +[source, java] +---- +Configuration config = new ConfigurationBuilder() + .encoding().mediaType(MediaType.APPLICATION_PROTOSTREAM) + .clustering().cacheMode(CacheMode.DIST_ASYNC).build(); + +// Create a cache +Cache cache = cacheManager.administration() +.withFlags(CacheContainerAdmin.AdminFlag.VOLATILE) +.getOrCreateCache("mycache", config); + +// Put a value in the cache +cache.put(id, greeting); + +// Read a value from the cache +cache.get(id); +---- + +== Native Support and Future Features + +The Quarkus Infinispan Embedded Extension supports native mode, but some advanced +features may be limited. We encourage developers to test it, share feedback, and help us enhance its +capabilities. + +== Where to Learn More + +For detailed documentation and examples, check out the project in the Quarkiverse Hub: +https://github.com/quarkiverse/quarkus-infinispan-embedded[Quarkiverse Infinispan Embedded Extension] + +== Come Join Us +We welcome your feedback and contributions to improve the extension. Feel free to open issues, suggest features, +or contribute code on the project’s GitHub repository. +Thank you for being part of the Quarkus community. We hope you enjoy the new Infinispan Embedded Extension! +If you are a Quarkus user or just curious, don't be shy and join our welcoming community: + + * provide feedback on https://github.com/quarkiverse/quarkus-infinispan-embedded/issues[GitHub issues]; + * craft some code and https://github.com/quarkiverse/quarkus-infinispan-embedded/pulls[push a PR]; + * ask your questions on https://github.com/quarkiverse/quarkus-infinispan-embedded/discussions[GitHub discussions]. + * 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];