As Monolith to Microservices migration almost became mainstream, Engineering Teams have to think about how their caching strategies will evolve in cloud-native world. Kubernetes is clear winner in containerized world so caching solutions must be cloud-ready and natural fit for Kubernetes.
Caching is an important piece in high performance microservices and choosing right architectural pattern can be crucial for your deployments. Hazelcast is a well known caching solution in open source community and can handle caching piece in microservices based applications.
In this talk, you will learn
* Distributed Caching With Hazelcast
* Distributed Caching Patterns in Kubernetes
* Kubernetes Deployment Options and Best Practices
* How to Handle Distributed Caching Day 2 Operations
18. Http reverse proxy caching
● Injecting Cache into every microservice
● No coupling with any Cache API
● Enabled w/o code change
19. @mesutcelik
POD
Spring Boot Microservice
hazelcast-java-client
Hazelcast ClusterKubernetesService
Http Request
Client Server
POD
Hazelcast
Member
POD
Hazelcast
Member
Kubernetes Cluster
POD
Spring Boot Microservice
hazelcast-java-client
POD
ASP.NET Core
Microservice
hazelcast-dotnet-client
KubernetesService
Http Request
21. @mesutcelik
Client Server
● CaaS - Cache as a Service
● Multiple Programming Languages
○ Java, nodejs, .NET, Python, Golang
● Separate Microservice and Hazelcast Layers
22. @mesutcelik
Spring Boot - Hazelcast Embedded Config
@Bean
public Config hazelcastConfig() {
Config config = new Config();
JoinConfig joinConfig = config.getNetworkConfig().getJoin();
joinConfig.getMulticastConfig().setEnabled(false);
joinConfig.getKubernetesConfig().setEnabled(true);
return config;
}
23. @mesutcelik
Spring Boot - Hazelcast Client Config
@Bean
public ClientConfig hazelcastConfig() {
ClientConfig config = new ClientConfig();
config.getNetworkConfig().getKubernetesConfig().setEnabled(true);
return config;
}
24. @mesutcelik
Hazelcast Cache Put and Get Operations
@Autowired
HazelcastInstance hazelcast;
Map<String, String> cities = hazelcast.getMap("cities");
cities.put("1","Minsk");
System.out.println("Best City in the world is " + cities.get("1"));