Skip to content

hemanik/spring-boot-cache-booster

 
 

Repository files navigation

Purpose

The​ ​ purpose​ ​ of​ ​ this​ ​ use​ ​ case​ ​ is​ ​ to​ ​ demonstrate​ ​ how​ ​ to​ ​ use​ ​ Red​ ​ Hat​ ​ JBoss​ ​ Data​ ​ Grid​ ​ for Openshift​ ​ as​ ​ a ​ ​ cache,​ ​ to​ ​ increase​ ​ the​ ​ response​ ​ time​ ​ of​ ​ applications. This​ ​ mission​ ​ covers:

  • The​ ​ deployment​ ​ of​ ​ the​ ​ Red​ ​ Hat​ ​ JBoss​ ​ Data​ ​ Grid​ ​ on​ ​ OpenShift

  • How​ ​ applications​ ​ leverage​ ​ this​ ​ cache​ ​ service

Technical details

The boosters demonstrates how Spring’s Caching support can interact with the JBoss Datagrid caching server. What that means practically, is that the business code simply uses Spring’s @Cacheable to cache return values

Deploying and interacting with the booster

  • Create a new OpenShift project cache-booster (or whatever you want to call it):

$ oc new-project cache-booster
  • Ensure that JBoss Datagrid has the appropriate permissions on Openshift

$ oc policy add-role-to-user view system:serviceaccount:$(oc project -q):default -n $(oc project -q)
$ oc policy add-role-to-user view system:serviceaccount:$(oc project -q):eap-service-account -n $(oc project -q)
  • Deploy JBoss Datagrid to Openshift

$ oc apply -f greeting-service/.openshiftio/cacheserver.yml
  • Build and deploy the Spring Boot application using the Fabric8 Maven Plugin

$ mvn clean fabric8:deploy -Popenshift
  • Open the UI of the greeting-service. The URL can be determined by executing

$ oc get route/spring-boot-cache-greeting --template={{.spec.host}}

From the UI the user can invoke the greeting-service which in turn invokes the JBoss Datagrid and perhaps the name-service depending on the state of the cache

  • Execute the integration test to verify the behavior of the system

$ mvn clean verify -Popenshift,openshift-it

About

Spring Boot Cache Booster

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 91.7%
  • HTML 8.3%