SlideShare uma empresa Scribd logo
1 de 38
@mesutcelik
Distributed Caching Patterns
in Kubernetes
Mesut Celik,Hazelcast
@mesutcelik
Mesut Celik
● Tech Lead @Hazelcast
● Java Developer
● lived in Turkey,Belgium,US
● Twitter: @mesutcelik
@mesutcelik
Agenda
● Hazelcast Introduction
● Caching Patterns
● Kubernetes Deployments
● Day 2 Operations
@mesutcelik
Hazelcast Products
● Hazelcast IMDG
● Hazelcast Jet
● Hazelcast Cloud
● Management Center
Hazelcast is an Open Source
Company
● Apache 2 License
● Remote friendly
● raised $21M series C
● Always hiring!!!!
@mesutcelik
Why Distributed Cache?
● Cache, Memory is faster than storage
● Distributed,Natural fit for Cloud-Native Deployments
@mesutcelik
Cache Layers
@mesutcelik
Caching Patterns
@mesutcelik
Cache-aside
Application
DB
Cache
Application
DB
Cache
Read-through, Write-through, Write-behind
Caching Patterns
Cache-as-SoR
@mesutcelik
Read-Through Cache
@mesutcelik
Read-Through Cache 1,MinskPartition_34
1,MinskBackup_34
@mesutcelik
Hazelcast and Kubernetes
Caching Patterns
@mesutcelik
Distributed Caching Patterns in Kubernetes
● Embedded
● Sidecar
● Proxy Cache
● Client-Server
@mesutcelik
POD
Spring Boot Microservice
Hazelcast
Member
POD
Hazelcast ClusterKubernetesService
Http Request
Embedded
Spring Boot Microservice
Hazelcast
Member
Kubernetes Cluster
@mesutcelik
Embedded
● Simple
● Java only
● Data co-located with Microservice JVM
@mesutcelik
Python
Microservice
POD
Hazelcast
Member
Python
Microservice
POD
Hazelcast
Member
Hazelcast ClusterKubernetesService
Http Request
SideCar Kubernetes Cluster
hazelcast-client
hazelcast-client
@mesutcelik
Sidecar
● Simple
● Multiple Programming Languages
○ Java, Node.js, .NET, Python, Golang
● Data co-located with Microservice POD
hazelcast-proxy
sidecar
POD
Spring Boot
Application
POD
Spring Boot
Application
Hazelcast ClusterKubernetesService
Http Request
Http reverse
proxy caching
Hazelcast
Member
hazelcast-proxy
sidecar
Hazelcast
Member
Kubernetes Cluster
Http reverse proxy caching
● Injecting Cache into every microservice
● No coupling with any Cache API
● Enabled w/o code change
@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
@mesutcelik
POD
KubernetesService
Http Request
Hazelcast Cloud
POD
cloud.hazelcast.com
Hazelcast Cluster
Kubernetes Cluster
Spring Boot
Application
hazelcast-client
Spring Boot
Application
hazelcast-client
@mesutcelik
Client Server
● CaaS - Cache as a Service
● Multiple Programming Languages
○ Java, nodejs, .NET, Python, Golang
● Separate Microservice and Hazelcast Layers
@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;
}
@mesutcelik
Spring Boot - Hazelcast Client Config
@Bean
public ClientConfig hazelcastConfig() {
ClientConfig config = new ClientConfig();
config.getNetworkConfig().getKubernetesConfig().setEnabled(true);
return config;
}
@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"));
@mesutcelik
Kubernetes Deployment Options
For Hazelcast
@mesutcelik
Hazelcast Helm Chart
$ helm install stable/hazelcast
@mesutcelik
Hazelcast Kubernetes Operator
● OperatorHub.io
● Openshift 4 Operator Catalog
● IBM Cloud Private
@mesutcelik
Hazelcast Cloud
● Managed Service
● Pay as you go model
● https://cloud.hazelcast.com
@mesutcelik
Deployment Best Practices
@mesutcelik
Predictable Resource Allocation
● Calculate CPU/Memory Requirements
● Set Resource Request and Limits as the same value
@mesutcelik
Pod Anti-Affinity
● Hazelcast per K8S Node
● Large Kubernetes Clusters
● Safer in Node crushes
@mesutcelik
Multi-zone Deployment with ZONE_AWARE
hazelcast-member -1
hazelcast-member -2
hazelcast-member -3
Availability-Zone-A
hazelcast-member -4
hazelcast-member -5
hazelcast-member -6
Availability-Zone-B
Multi-zone Hazelcast Cluster
* Multi-zone if your architecture prefers availability over performance
@mesutcelik
Day 2 Operations
@mesutcelik
Scaling Hazelcast Cluster
● Manual Scaling (kubectl scale or helm upgrade)
● Horizontal Pod Autoscaler (HPA)
● Vertical Pod Autoscaler
● Cluster Autoscaler
@mesutcelik
Rolling Upgrade - Why?
● Hazelcast Version Update
● Config Change
● Adding Jar to the classpath
@mesutcelik
Rolling Upgrade - How?
● helm upgrade (--set image.tag)
● kubectl set image
● StatefulSet
● Deployment with RollingUpdateStrategy
● Enable Graceful Shutdown
● Optimized Grace Period
@mesutcelik
Monitoring
● Hazelcast Management Center
● Metrics via Prometheus
● Alerting
@mesutcelik
Thank you!
● https://twitter.com/mesutcelik
● https://github.com/mesutcelik
● https://www.linkedin.com/in/mesutcelik/

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Apache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals ExplainedApache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals Explained
 
Kata Container - The Security of VM and The Speed of Container | Yuntong Jin
Kata Container - The Security of VM and The Speed of Container | Yuntong Jin	Kata Container - The Security of VM and The Speed of Container | Yuntong Jin
Kata Container - The Security of VM and The Speed of Container | Yuntong Jin
 
Introducing the Apache Flink Kubernetes Operator
Introducing the Apache Flink Kubernetes OperatorIntroducing the Apache Flink Kubernetes Operator
Introducing the Apache Flink Kubernetes Operator
 
An Introduction to Apache Kafka
An Introduction to Apache KafkaAn Introduction to Apache Kafka
An Introduction to Apache Kafka
 
Distributed Locking in Kubernetes
Distributed Locking in KubernetesDistributed Locking in Kubernetes
Distributed Locking in Kubernetes
 
Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...
Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...
Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache Kafka
 
Enabling Vectorized Engine in Apache Spark
Enabling Vectorized Engine in Apache SparkEnabling Vectorized Engine in Apache Spark
Enabling Vectorized Engine in Apache Spark
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Introduction to openshift
Introduction to openshiftIntroduction to openshift
Introduction to openshift
 
Securing Kafka
Securing Kafka Securing Kafka
Securing Kafka
 
kafka
kafkakafka
kafka
 
How Prometheus Store the Data
How Prometheus Store the DataHow Prometheus Store the Data
How Prometheus Store the Data
 
GraalVM: Run Programs Faster Everywhere
GraalVM: Run Programs Faster EverywhereGraalVM: Run Programs Faster Everywhere
GraalVM: Run Programs Faster Everywhere
 
Flink powered stream processing platform at Pinterest
Flink powered stream processing platform at PinterestFlink powered stream processing platform at Pinterest
Flink powered stream processing platform at Pinterest
 
Introduction to helm
Introduction to helmIntroduction to helm
Introduction to helm
 
Producer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache KafkaProducer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache Kafka
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
 
ksqlDB - Stream Processing simplified!
ksqlDB - Stream Processing simplified!ksqlDB - Stream Processing simplified!
ksqlDB - Stream Processing simplified!
 
Hadoop Strata Talk - Uber, your hadoop has arrived
Hadoop Strata Talk - Uber, your hadoop has arrived Hadoop Strata Talk - Uber, your hadoop has arrived
Hadoop Strata Talk - Uber, your hadoop has arrived
 

Semelhante a Distributed Caching in Kubernetes with Hazelcast

Spark on Dataproc - Israel Spark Meetup at taboola
Spark on Dataproc - Israel Spark Meetup at taboolaSpark on Dataproc - Israel Spark Meetup at taboola
Spark on Dataproc - Israel Spark Meetup at taboola
tsliwowicz
 

Semelhante a Distributed Caching in Kubernetes with Hazelcast (20)

High Performance Cloud-Native Microservices With Distributed Caching
High Performance Cloud-Native Microservices With Distributed CachingHigh Performance Cloud-Native Microservices With Distributed Caching
High Performance Cloud-Native Microservices With Distributed Caching
 
Cache first cloud native microservices
Cache first cloud native microservicesCache first cloud native microservices
Cache first cloud native microservices
 
High Performance Cloud-Native Microservices IndyCloudConf 2020
High Performance Cloud-Native Microservices IndyCloudConf 2020High Performance Cloud-Native Microservices IndyCloudConf 2020
High Performance Cloud-Native Microservices IndyCloudConf 2020
 
Hazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSHazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMS
 
Kubernetes Architecture and Introduction
Kubernetes Architecture and IntroductionKubernetes Architecture and Introduction
Kubernetes Architecture and Introduction
 
Gimme Caching - The JCache Way
Gimme Caching - The JCache WayGimme Caching - The JCache Way
Gimme Caching - The JCache Way
 
Tim Panton - Presentation at Emerging Communications Conference & Awards (eCo...
Tim Panton - Presentation at Emerging Communications Conference & Awards (eCo...Tim Panton - Presentation at Emerging Communications Conference & Awards (eCo...
Tim Panton - Presentation at Emerging Communications Conference & Awards (eCo...
 
What’s new in cas 4.2
What’s new in cas 4.2 What’s new in cas 4.2
What’s new in cas 4.2
 
Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)Build Your Own CaaS (Container as a Service)
Build Your Own CaaS (Container as a Service)
 
Think Distributed: The Hazelcast Way
Think Distributed: The Hazelcast WayThink Distributed: The Hazelcast Way
Think Distributed: The Hazelcast Way
 
Cloud native java script apps
Cloud native java script appsCloud native java script apps
Cloud native java script apps
 
Spark on Dataproc - Israel Spark Meetup at taboola
Spark on Dataproc - Israel Spark Meetup at taboolaSpark on Dataproc - Israel Spark Meetup at taboola
Spark on Dataproc - Israel Spark Meetup at taboola
 
Bkbiet day2 & 3
Bkbiet day2 & 3Bkbiet day2 & 3
Bkbiet day2 & 3
 
High available BizTalk infrastructure on Azure IaaS
High available BizTalk infrastructure on Azure IaaSHigh available BizTalk infrastructure on Azure IaaS
High available BizTalk infrastructure on Azure IaaS
 
Distributed caching and computing v3.7
Distributed caching and computing v3.7Distributed caching and computing v3.7
Distributed caching and computing v3.7
 
An Ensemble Core with Docker - Solving a Real Pain in the PaaS
An Ensemble Core with Docker - Solving a Real Pain in the PaaS An Ensemble Core with Docker - Solving a Real Pain in the PaaS
An Ensemble Core with Docker - Solving a Real Pain in the PaaS
 
Hidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-PersistenceHidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-Persistence
 
GWT 2 Is Smarter Than You
GWT 2 Is Smarter Than YouGWT 2 Is Smarter Than You
GWT 2 Is Smarter Than You
 
Bootstrapping Clusters with EKS Blueprints.pptx
Bootstrapping Clusters with EKS Blueprints.pptxBootstrapping Clusters with EKS Blueprints.pptx
Bootstrapping Clusters with EKS Blueprints.pptx
 
Building scalable applications with hazelcast
Building scalable applications with hazelcastBuilding scalable applications with hazelcast
Building scalable applications with hazelcast
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 

Distributed Caching in Kubernetes with Hazelcast