Monday, 12 November 2018

The fastest path to running Infinispan on OpenShift!

Creating an Infinispan Server cluster in OpenShift has never been easier! We've just given the OpenShift templates for Infinispan server their biggest makeover yet which should help both Infinispan and OpenShift users:

The repository has been simplified and flattened out to only leave essential information. Minishift is the preferred way to get started with Infinispan and OpenShift, so we've tailored the instructions for this set up.

OpenShift templates are now YAML based which is less verbose, but more importantly, allows Infinispan Server XML configuration to be shown as-is. This makes it easier to directly modify the XML in the template itself.

The fastest way to get started with Infinispan and OpenShift is to simply fire up Minishift, set a profile, checkout our Infinipan OpenShift repository and then call:

oc create -f infinispan-ephemeral.yaml
oc new-app infinispan-ephemeral

These two simple steps will get you a single node Infinispan Server running! A more detailed getting started guide can be found in the repository's README file.

Go and try it out and let us know what you think. You can find us on this Zulip chat :)

Cheers,
Galder

Friday, 9 November 2018

Infinispan 9.4.1.Final and Infinispan Spring Boot Starter 2.1.0.Final are out!

Dear Infinispan and Spring Boot users,

We have just released Infinispan 9.4.1.Final and Infinispan Spring Boot 2.1.0.Final.

Highlights of the Infinispan release include:

Complete release notes can be read here.

Highlights of the Infinispan-Spring-Boot release include:
  • Upgrade Spring-Boot version to 2.1.0
  • Upgrade Infinispan version to 9.4.1
  • Integration with Spring Actuator, to expose production ready metrics (ISPN-9668)
  • Bug fixes
  • Additional code examples
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

Friday, 2 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

Writer 


This application loads the required data to a remote cache: a list of some of the Infinispan contributors over the last decade.

>> writer: mvn spring-boot:run


Reader 


The reader application does 10.000 accesses to the contributors cache. Using a random id, I call 10.000 times the get method. The job gets done in my laptop in ~4000 milliseconds.

>> reader-no-near-cache: mvn spring-boot:run


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.

hotrod-client.properties

infinispan.client.hotrod.near_cache.mode=INVALIDATED
infinispan.client.hotrod.near_cache.max_entries=40
infinispan.client.hotrod.near_cache.cache_name_pattern=i8n-.*

application.yaml (or properties)

infinispan:
   remote:
     near-cache-mode: INVALIDATED
     near-cache-max-entries: 10
     near-cache-cache-name-pattern: i8n-.*

code 

With the Infinispan Spring-Boot Starter, I can add custom configuration using the InfinispanRemoteCacheCustomizer.


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!




Wednesday, 31 October 2018

Native JSON and Node 8.11 baseline in Node.js client 0.6.0!!

Infinispan Node.js client 0.6.0 is out now!! :)

As well as updating the client so that it understand the latest Hot Rod protocols in Infinispan 9.4.0.Final, this version comes with native JSON object support.

To make the Node.js client backwards compatible, the client still treats key/value pairs as String by default. If you want to use native JSON objects, you have to explicitly configure the Node.js client to do so (see example).

Starting with this version, we've upgraded the base Node version requirement to 8.11, which is the latest stable release branch at the time of writing. With such upgrade, the client no longer needs to use external promise dependency which was know to leak.

If you're a Node.js user and want to store data remotely in Infinispan server instances, please give the client a go and tell us what you think of it via our forum, via our issue tracker or via Zulip on Infinispan channel.

Cheers
Galder

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

Monday, 8 October 2018

Infinispan 9.4.0.Final

Infinispan 9.4.0.Final “Infinity Minus ONE +2”

 

10 years of Infinispan

Infinispan is 10 years old this month, and what better way to celebrate than with a brand new Final release !!!

What's new

Infinispan 9.4 comes with the following new features / improvements:
  • Segments everywhere
    9.3 brought the segmented on-heap memory container. 9.4 extends this to provide the benefits of segmentation to off-heap as well as all of the core cache stores. Watch as your bulk operations (size, iteration, streams) get a big performance boost !
  • Transcoding everywhere
    To paraphrase the Grand Moff Tarkin, “The last remnants of Compatibility Mode have been swept away”. Transcoding, i.e. the ability to transparently convert between a number of formats across different endpoints, is now “fully operational”.
  • Transactions everywhere
    Hot Rod transactions now support recovery.
  • Hot Rod client improvements
    The Hot Rod client has received many improvements:
    • Client-side statistics, complete with JMX support
    • Improvements to the scalability and the behaviour of near-caches
    • All of the configuration can now be supplied via the properties, which also means easier integration with other frameworks, such as Spring Boot.
  • Query improvements
    Many cleanups and improvements
  • Bugfixes, stability, reliability
    Although not as exciting as new features, we continued our work to improve the stability, reliability and performance of all aspects of Infinispan.
  • Upgrades:
    • As usual the latest and greatest JGroups 4.0.15
    • The server is now based on WildFly 14

Get it, Use it, Ask us!

Please download, report bugs, chat with us, ask questions on the forum or on StackOverflow.

Tuesday, 2 October 2018

Segmented Data Containers: Distributed Stream Performance Boost

Welcome to the first of several blog posts that describe the segmentation of containers that Infinispan uses to store data. Some of you may have noticed in the previous 9.3.0.Final notes that we announced a new feature named “Segmented On-Heap Data Container”. We also mentioned that “It improves performance of stream operations”, but what does that really mean?

What is a segmented data container and why does it matter? 


Imagine a cluster of 4 nodes in distributed mode (numOwners = 2) with entries for k0 - k13. It might look like this:




The data is distributed between the nodes with only two copies of each entry available. However, the data itself is stored internally in the same Map instance. As a result, when performing operations on all entries in the cache, Infinispan must iterate over the same data multiple times. This degrades performance.

As of Infinispan 9.3, a segmented data container is available to separate data by segments. Although only on-heap bounded and unbounded implementations are currently available.

With a segmented data container, that same data set might look like this:




Because Infinispan internally reasons on data in terms of segments, a segmented data container lets Infinispan process data only in specific segments. This allows for operations performed upon all entries to require iteration over the data only once.

Actual Performance Difference


So with the above example you might be thinking that the performance increase maximum is two times throughput, since numOwners is two. This is close, but not quite correct. While iterating on the data we also have to determine what segment an entry belongs to. With a segmented container we know this already, so there is no need to calculate that. This provides additional performance, as you will see.

The following graphs were generated using the benchmark at https://github.com/infinispan/infinispan-benchmarks/tree/master/iteration. The following command was run: java -jar target/benchmarks.jar -pvalueObjectSize=1000 -pentryAmount=50000 -pbatchSize=4096



The preceding graph is the result of the iteration methods. As you can notice the performance increase isn’t that much… why not?!?

Unfortunately, remote iteration requires a lot of network overhead, so we don’t get to see the full benefits of segmentation. But at least it is about 5-12% faster, not too shabby.

Now to show the real improvement, here is the chart showing the performance increase for the Cache#size operation:



If you notice there is huge increase in performance: almost a three fold increase over the non-segmented container, even though numOwners is only two. The old segment calculation adds a bit of overhead compared to just incrementing a number.

So keep in mind this change will show a larger gain in performance if the result returned is smaller, especially if it is a fixed size, such as a single int for Cache#size.

What about gets and puts?


Having the container segmented should also affect get and put performance as well, right? In testing the difference for get and puts are less than one percent, in favor of segmentation due to some optimizations we were able to add.

How do I enable this?


So the performance gains are noticeable, especially when the remote operation returns a small data set. But how can a user configure this? This is the nice part, due to no performance loss with other operations the container will always be segmented as long as the cache mode supports segmentation. That is if it is a Distributed, Replicated or Scattered cache.

A real-life example and closing


Since this feature has been around a while already, we actually have users gaining benefits from this feature. An example can be found at https://developer.jboss.org/message/983837#983837. In this case the user only upgraded to Infinispan 9.3 and received over a three-fold increase in performance when using distributed streams. It actually starts to bring distributed streams performance within range of indexed query for some use cases.

So, by upgrading your application to Infinispan 9.3 or newer, you will benefit from these improvements. There will be future posts regarding segmentation, including support for stores. Either way please feel free to download Infinispan, report bugs, chat with us, ask questions on the forum or on StackOverflow.