A zero cost distributed cache that works on all managed K8S: Openshift, GKE. Using Jgroups Java library with Infinispan inside a Spring Boot
Antonio De Fazio
Software Architect | Tech Leader | Senior Java Developer | Java Instructor | Spring Boot Teacher | DevOps Trainer | Docker | Kubernetes | JEE | Backend | Docente | Programmatore | Full-stack Developer
This article is entirely the result of my knowledge/research as there was no "ready" solution for this purpose on Google, but the configuration of this distributed cache is always difficult to make work. Last night I spent a couple of hours taking my code of a Spring Boot project from a couple of years ago and writing an article on how to create a zero-cost distributed cache. To create the distributed cache for the specific use case I used JGroups in conjunction with Infinispan.
The project I propose is extracted from that work and is a Spring Boot that allows you to create a distributed cache both locally and on the various managed Kubernetes in Cloud: Openshift, Google Kubernetes Engine, Amazon Elastic Kubernetes Service, and so on. I apologize in advance for the antipatterns in the project but this is a simulation in which a specific problem is focused on and solved.
Article in detail in?https://github.com/antoniodefazio/cachenocosts/blob/master/README.md?file.
The very intriguing thing is always to create Kubernetes objects and solve the whole scenario... It is very interesting to note that, if you have n pods, by eliminating a Deployment(so you have n-m pods), the cache remains "alive and consistent" if at least one pod remains active, therefore this caching technique certainly has a very high reliability as there is in fact a replica for each pod, and each "new" pod acts as an updated replica.
领英推荐
You can clone it and enjoy launching it locally and in cloud, too.
This is entirely the result of my knowledge and I hope that ChatGpt doesn't give the correct solution to the use case in question in 5 seconds, otherwise we'll all go home ….
#java #spring #cache #zerocost #docker #kubernetes #inifinispan #jgroups #distibutedcache #openshift #gke #eks