Apache Geode data Spring

Spring Boot for Apache Geode: Making Caching Easier for Developers

Pivotal has been on a mission—to make Apache Geode, and our Apache Geode-based caching products (Pivotal GemFire, Pivotal Cloud Cache) easier for developers to get up and running as quickly and easily as possible. Caching is finding new relevance in modern, cloud-native, distributed application architectures. As applications get split up into smaller separately-deployed components, often on different systems in different locations, network latencies can severely limit application performance. Caching data locally can reduce network hops, reducing the impact of network latencies.

However, setting up caching products can be time-consuming. A large number of configuration properties and options must be set, and developers need to understand the various supported topologies. Adding to the effort, no two caching products are equal in the coverage of their capabilities, requiring developers to learn the unique features of each product.

Over the past few years, we’ve been giving this ease-of-use challenge due attention with advancements in how we leverage the Spring Framework to reduce complexity, which includes Spring Boot’s convention over configuration approach. The annotation-based configuration model we first introduced a couple of years ago was a seminal step. And we continue to improve the experience!

The latest development in this journey is the recent release of Spring Boot for Apache Geode and Pivotal GemFire version 1.0.0. This project takes configuration and development of Spring Boot, Apache Geode & Pivotal GemFire applications to the next level, whether building and running applications in a stand-alone environment using Geode or GemFire, or in a managed environment like Pivotal Application Service (PAS), when using Pivotal Cloud Cache (PCC).

Among other things, this project builds on Spring Boot as well as Spring Data for Apache Geode & Pivotal GemFire. A diagram and descriptions of the dependencies can be seen here.  Spring Boot’s auto-configuration automatically configures your Spring application based on the JAR dependencies that you have added to your application’s classpath. We’ve added auto-configuration support for the following features:

  1. Auto-configures an Apache Geode or Pivotal GemFire (PCC) ClientCache instance automatically when either Spring Data for Apache Geode or Spring Data for Pivotal GemFire are on the application’s CLASSPATH.

  2. Auto-configures either Apache Geode or Pivotal GemFire (PCC) as a caching provider in Spring’s Cache Abstraction when either Spring Data for Apache Geode or Spring Data for Pivotal GemFire are on the application’s CLASSPATH.

  3. Auto-configures Spring Data for Apache Geode or Spring Data for Pivotal GemFire Repositories when Spring Data for Apache Geode or Spring Data for Pivotal GemFire are on the application’s CLASSPATH and Spring Boot detects SDG Repositories in your Spring Boot application.

Additionally, if your application requires (HTTP) Session State Caching services, you can also take advantage of Spring Session for Apache Geode/Pivotal GemFire. Spring Boot for Apache Geode provides dedicated support for Spring Session for Apache Geode by adding auto-configuration when Spring Session for Apache Geode is on your Spring Boot application’s classpath.

This added support goes a long way towards making the power of our caching products more approachable for Spring and Java developers.

Show Me!

Don’t just take my word for how easy it is to set up a cache. Watch Pulkit Chandra, Pivotal Cloud Cache Product Manager, go through the process of setting up a cache for a simple application that highlights the huge developer productivity benefits of Spring. What’s most impressive in this video is what you don’t see, i.e. you don’t see a lot of code for setting up PCC as a caching provider. Some of you may not be familiar with how an app, and a caching service, is deployed on the PAS, so Pulkit takes it from the start. 

 

You can get the Spring Boot for Apache Geode bits from Maven Central.

What’s Next

Longer term, we are planning to add support for Spring Boot Actuator. There is an effort underway to retrofit Apache Geode/Pivotal GemFire’s Stats architecture with Micrometer. This will serve as the basis for Spring Boot for Apache Geode & Pivotal GemFire’s Actuator support. This will most likely be available in SBDG 1.2. You can see the compatibility matrix across the Geode based projects here.

A great way to up your Geode-based caching game is to attend the Geode Summit this year. As before, this year’s summit will be held in conjunction with Pivotal’s SpringOne Platform conference, in Austin Texas, starting on Oct 7th. You can experience a variety of Geode talks and sessions, and engage with experts and core committers. To whet your appetite, here are the recordings from previous Geode Summits in 2017 and 2018. You can register for SpringOne Platform here – note, there is a ‘Monday only’ option for those who just want to attend the Geode sessions on Monday, Oct 7th.