Monday, 10 February 2020
Infinispan Spring Boot Starter released with Spring Boot 2.2.4.RELEASE
Dear Infinispan and Spring Boot users,
We are pleased to announce the release of Infinispan Spring Boot 2.1.8.Final and 2.2.0.Final.
2.1.8.Final uses Infinispan 9.4.17.Final and Spring Boot 2.2.2.RELEASE
2.2.0.Final uses Infinispan 10.1.1.Final and Spring Boot 2.2.2.RELEASE
Configuring Marshalling with Infinispan 10.x
Infinispan 10.x servers have some significant changes to marshalling that impact Spring Boot users.
The default Marshaller for Infinispan 10.x is ProtoStream, which uses Protocol Buffers to provide extensible, language and platform neutral serialization.
Unfortunately ProtoStream does not currently work with Infinispan Spring Cache and Session support. As a result, Spring users in Remote Client/Server Mode must use the Java Serialization Marshaller and add classes to a Java serialization whitelist.
Add the following configuration properties:
infinispan.remote.marshaller=org.infinispan.commons.marshall.JavaSerializationMarshaller
infinispan.remote.java-serial-whitelist=org.infinispan.tutorial.simple.spring.remote.*
The infinispan.remote.java-serial-whitelist
property specifies the classes, or packages, that Java serialization can marshall. Separate multiple class names with a comma (,
).
Note that, in previous versions, JBoss Marshaller was the default for Infinispan. Spring users can also use JBoss Marshalling, but it is deprecated as of Infinispan 10.x.
Get it, Use it, Ask us!
You can find these releases in the maven central repository.
Please report any issues in our issue tracker and join the conversation in our Zulip Chat to shape up our next release.
Enjoy,
The Infinispan Team
Tags: release spring boot spring
Tuesday, 15 January 2019
Infinispan Spring Boot Starter 2.1.2.Final is out!
Dear Infinispan and Spring Boot users,
We have just released Infinispan Spring Boot 2.1.2.Final.
2.1.2.Final is using Spring Boot 2.1.2.RELEASE and contains some bug fixes related to JCache and Actuator integration.
The starter is now using Infinispan’s last stable release: 9.4.5.Final.
You can find this release in the maven central repository.
Please report any issues in our issue tracker and join the conversation in our Zulip Chat to shape up our next release.
Enjoy,
The Infinispan Team
Tags: release spring spring boot
Tuesday, 11 December 2018
Infinispan Spring Boot Starter 2.1.1.Final and 1.0.4.Final are out!
Dear Infinispan and Spring Boot users,
We have just released Infinispan Spring Boot 2.1.1.Final and 1.0.4.Final.
1.0.4.Final is using Spring Boot 1.5.17.RELEASE
2.1.1.Final is using Spring Boot 2.1.1.RELEASE
Both starters are now using Infinispan’s last stable release: 9.4.4.Final.
9.4.4.Final provides full support to JDK 11, Spring 4 and 5. Concerning Spring 5, it includes Spring Session 2.1.2.RELEASE support.
You can find these releases in the maven central repository.
Please report any issues in our issue tracker and join the conversation in our Zulip Chat to shape up our next release.
Enjoy,
The Infinispan Team
Tags: release spring-session spring spring boot
Friday, 02 November 2018
Near caching with Spring-Boot and Infinispan
We have recently released infinispan-spring-boot-starter 2.0.0.Final. This version supports Spring Boot 2.1 and Infinispan 9.4.0.Final.
Before this release, some important features - such as near caching - were only configurable by code. From now on, we can set all of the Hot Rod client configuration using the hotrod.properties file or the Spring application YAML. The latter is an important community requirement we had.
Let’s see how to speed up our applications performance with near caching!
==
==
Hot Rod
Just as a quick reminder, Infinispan can be used embedded in your application or in client/server mode. To connect you application to a server you can use an Infinispan Client and the Infinispan “Hot Rod Protocol”. Other protocols are available, such as REST, but Hot Rod is the most recommended way since it is the one that supports most of the Infinispan functionalities.
Near cache
From the Infinispan documentation: Hot Rod client can keep a local cache that stores recently used data. Enabling near caching can significantly improve the performance of read operations get and getVersioned since data can potentially be located locally within the Hot Rod client instead of having to go remote.
When should I use it?
Near caching can improve the performance of an application when most of the accesses to a given cache are read-only and the accessed dataset is relatively small. When an application is doing lots of writes to a cache, invalidations, evictions and updates to the near cache need to happen. In this scenario we won’t probably get much benefit.
As I said in the introduction, the good news is that this feature can be activated just by configuration. Code doesn’t change, so we can measure the benefits, if such exist, in a very straightforward way.
Spring-Boot
I have created a very simple application, available here. Maven, Java 8 and an Infinispan server are required to run it. You can download the server or use docker.
Docker: docker run -it -p 11222:11222 jboss/infinispan-server:9.4.0.Final
Standalone: PATH/infinispan-server-9.4.0.Final/bin/standalone.sh
Once the server is up and running, build the application using maven
>> infinispan-near-cache: mvn clean install
Activating the near cache
I need to configure two properties:
-
Near Cache Mode: DISABLED or INVALIDATED. Default value is DISABLED, so I turn it on with INVALIDATED.
-
Max Entries: Integer value that sets the max size of the near caches. There is no default value, so I set up one.
The hotrod client configuration is for each client, not for each cache (this might change in the future). With that in mind, note that configuring the previous properties will activate near caching for all the caches. If you need to activate it just for some of them, add the following property:
-
Cache Name Pattern: String pattern. For example "i8n-.*" will activate the near caching for all the caches whose name starts by "i8n-".
Configuration can be placed in the hotrod-client.properties, Spring-boot configuration or code.
Results
My dataset contains 25 contributors. If I activate the near cache with max 12 entries and I run my reader again, I get the job done in ~1900 milliseconds, which is already an improvement. If I configure it to hold the complete dataset, I get it done in ~220 milliseconds, which is a big one!
Conclusions
Near caching can help us speed up our client applications if configured properly. We can test our tuning easily because we only need to add some configuration to the client. Finally, the Spring-Boot Infinispan Starter helps us build services with Spring-Boot and Infinispan.
Further work will be done to help Spring-Boot users work with Infinispan, so stay tuned! Any feedback on the starter or any requirement from the community is more that welcome. Find us in Zulip Chat for direct contact or post your questions in StackOverflow!
Tags: hotrod near caching spring spring boot
Thursday, 11 October 2018
Infinispan Spring Boot 2.0.0.Final is out!
Dear Infinispan and Spring Boot users,
We have just released Infinispan Spring Boot 2.0.0.Final. If you are wondering why it is worth to use this starter, read Sebastian’s article here!
Highlights of this release include:
-
Uses the latest Infinispan 9.4.0.Final
-
Automatic translation of Hot Rod client properties into Spring YAML (ISPN-9437)
-
Bug fixes
You can find the release in the maven central repository.
Please report any issues in our issue tracker and join the conversation in our Zulip Chat to shape up our next release.
Enjoy,
The Infinispan Team
Tags: spring spring boot
Tuesday, 04 September 2018
Infinispan Spring Boot Beta2 is out!
Dear Infinispan and Spring Boot users,
We have just released Infinispan Spring Boot 2.0.0.Beta2.
Highlights of this release include:
-
Upgrade to Spring Boot 2.0.3.RELEASE
-
RemoteCache can be injected now. Example here
You can find the release in the maven central repository.
Please report any issues in our issue tracker and join the conversation in our Zulip Chat to shape up our next release.
Enjoy,
The Infinispan Team
Tags: release spring boot spring beta
Monday, 22 May 2017
Infinispan Spring Boot Starters 1.0.0.Final released
We are happy to announce that Infinispan Spring Boot Starters 1.0.0.Final have been released.
Change-list:
-
[https://github.com/infinispan/infinispan-spring-boot/pull/27] Infinispan 9.0.0.Final is used by default
-
[https://github.com/infinispan/infinispan-spring-boot/pull/25] Added metadata description. Thanks a lot Luca for contributing this!
-
[https://github.com/infinispan/infinispan-spring-boot/pull/26] Added more documentation
You can grab the bits from JBoss Repository after the sync is complete. In the meantime, grab them from here.
Tags: spring
Wednesday, 15 March 2017
Spring Boot Starter 1.0.0.CR1 released!
I’m happy to announce a new release (the first feature-complete!) of Infinispan Spring Boot Starters.
We finally added new properties for managing Hot Rod client mode in application.properties as well Spring Cache automatic support. Finally, we fixed a couple of smaller issues.
For complete changelog, please refer to the release page.
The artifacts should be available in Maven Central as soon as the sync completes. In the meantime grab them from JBoss Repository.
Tags: spring
Tuesday, 20 December 2016
Spring Boot Starters
Why do I need starters?
Spring Boot Starters make the bootstrapping process much easier and faster. The starter brings you required Maven dependencies as well as some predefined configuration bits.
What do I need to get started?
The starter can operate in two modes: client/server (when you connect to a remote Infinispan Server cluster) and embedded (packaged along with your app). The former is the default. It’s also possible to use both those modes at the same time (store some data along with your app and connect to a remote Infinispan Server cluster to perform some other type of operations).
Assuming you have an Infinispan Server running on IP address 192.168.0.17, all you need to do is to use the following dependencies:
By default, the starter will try to locate hotrod-client.properties file. The file should contain at least the server list:
It is also possible to create RemoteCacheManager's configuration manually:
That’s it! Your app should successfully connect to a remote cluster and you should be able to inject RemoteCacheManager.
Using Infinispan embedded is even simpler than that. All you need to do is to add additional dependency to the classpath:
The starter will provide you a preconfigured EmbeddedCacheManager. In order to customize the configuration, use the following code snippet:
Further reading
There are two link I highly recommend you to read. The first is the Spring Boot tutorial and the second is the Github page of the Starters project.
Tags: spring
Monday, 28 November 2016
Spring as a Spec?
We’ve been maintaining Spring integrations bits in Infinispan for quite a while. Our development version, Infinispan 9, contains a set of changes in those modules which deserve some explanation…
Versions… versions everywhere…
When you use Infinispan, you rely on some, very specific version. The same applies to Spring. Before Infinispan 9 our integration modules had a compile-time dependency to a very specific version of Spring. In practice, we imposed this specific version to each project which used our integration bits. The question is - what to do to use some other version of Spring or Spring Boot? Till Infinispan 9, the simplest solution was to exclude Spring from infinispan-spring4-embedded (or infinispan-spring4-remote) artifact using Maven exclusions. Not a very nice and intuitive solution was it?
How about treating Spring as a Spec or API
You probably noticed, when you use JPA you don’t care about underlying implementation. Is it Hibernate, OpenJPA… it doesn’t matter?
If you think carefully about Spring for a while, it’s a bit similar. All core classes might be delivered using standard dependency mechanism (adding spring-beans, spring-context manually), using Spring Boot (adding spring-boot-starter) or even using 3rd party integration tools like DropWizard. In case of a bigger project, a decision whether or not use any of those solutions needs to be taken long before Infinispan is chosen as a Distributed Store or Cache.
At this point, we can do a mental experiment - treat Spring classes as a Spec or API and those delivery mechanisms treat as implementations.
===
===
===
Scope? Provided, of course!
From Infinispan integration perspective we need the Spring API (the classes) and we don’t care about the implementation (delivery mechanism). Having this in mind we decided to change Spring’s scope in Infinispan modules to provided.
I use Infinispan and Spring, what shall I do?
Starting from Infinispan 9, you can stop using exclusions. You probably already use Spring and your favorite delivery mechanism (Spring Boot for example). Then add infinispan-spring4-embedded or infinispan-spring4-remote artifact. Finally, you need to decide how would you like to use Infinispan - via Uber Jars (infinispan-embedded and infinispan-remote) or using Small Jars (infinispan-core for example).
That’s it! Have fun!
Tags: spring