SlideShare a Scribd company logo
1 of 19
Download to read offline
OTTIMIZZARE LE PERFORMANCE
DELL'API SERVER K8S:
COME UTILIZZARE CACHE ED
EVENTI PER IMPLEMENTARE IL
CHANGE DATA CAPTURE
By
Diego Braga, Product Manager
@ Krateo PlatformOps
&
Luigi Fugaro, Sr. Solution Architect
@ Redis
”STOP QUERYING
AND START
CACHING”
- Kubernetes API server
WHY ARE WE PRESENTING THIS TALK?
Kubernetes is becoming the de facto industrial standard for
orchestrating cloud-native applications.
What if we want to treat Kubernetes as a platform that is
interrogated by different clients via API? This could generate a
lot of requests to the API server.
Kubernetes doesn't offer caching out of the box, so
what could be the best pattern to implement it?
WHAT IS A CACHE
Prompt: "Briefly describe what is a cache."
Response: "A cache is a hardware or software
component that stores data so future requests
for that data can be served faster. The data
stored in a cache might be the results of an
earlier computation, or duplicates of data
stored elsewhere. A cache hit occurs when the
requested data can be found in a cache, while a
cache miss occurs when it cannot."
Caches are utilized because the data
stored in a cache can often be
delivered faster than re-fetching or
recomputing the original data. This is
due to the principles of the locality of
reference, where programs access data
and instructions in localized areas.
Common types of caches include CPU
caches, web caches, and database
caches. By storing frequently accessed
information, caches reduce data access
latency, decrease bandwidth
consumption, and improve overall
system performance.
CACHE-ASIDE
READ-THROUGH
WRITE-THROUGH
Cache-miss managed at application
level.
Cache-miss managed at cache
provider level.
Write data in the cache and
automatically update the db. SYNC
CACHING PATTERNS
WRITE-BEHIND Write data in the cache and
automatically update the db. ASYNC
CHANGE DATA CAPTURE
Prompt: "Briefly describe what is change data
capture."
Response: "Change Data Capture (CDC) is a
design pattern that enables tracking and
capturing changes in data so that other software
(like ETL tools, data replication tools, or data
auditing tools) can respond to those changes.
The changes might include insertions, updates,
and deletions that are performed on a database
table."
AUTOMATION
OFFLOADING
CQRS DESIGN PATTERN
KUBERNETES API SERVER
The API server is a component of the
Kubernetes control plane that exposes the
Kubernetes API. The API server is the
front end for the Kubernetes control plane
KUBERNETES
INFORMERS
As the center of Kubernetes
communication components,
API Server receives requests,
contacts etcd, and manages all
the resource objects. So it
would be under pressure easily.
To ease API Server’s
pressure, Kubernetes
employed a message
system called Informer,
which guarantees message
delivery and provides high-
performance real-time
delivery, like any other
famous message system.
Informers query the
resource data and store it in
a local cache. Once stored,
an event is only generated
when it detects a change in
the object (or resource)
state.
KUBERNETES CLIENT
The following client libraries are officially maintained
by Kubernetes SIG API Machinery.
C
DOTNET
GO
HASKELL
JAVA
JAVASCRIPT
PERL
PYTHON
RUBY
USE CASE
Leveraging client-javascript, we wrote a
backend that exposes an API to query
Kubernetes resources: via query parameter is
it possible to use Redis as cache or interact
directly with the API server
USE CASE
ARCHITECTURE
CACHE WARM UP
When the Informer is instantiated, all
the existing resources are pushed
into the cache
AVOID CACHE MISS
The client will always find an entry in
the cache if the resource exists in
Kubernetes
CACHE UPDATE
The Change Data Capture is
implemented via the Informer that
is notified for every resource
change from the API server - and
the microservice will set, update or
delete the key
2
3
1
Client
Webserver
(express.js)
Cache
Kubernetes API server
Informer
(client-javascript)
/cache=true
/cache=false
CODE SNIPPET A new Informer is instantiated for any kind of Resource
available in the cluster (namespaces or cluster-scoped)
and it interacts directly with the cache
CODE SNIPPET If the 'cache' query parameter is set to 'true' (or not
specified), the webservice will inquiry the cache,
otherwise it will call directly the API server
LOG SNIPPET When a new Kubernetes Resource is created / updated /
deleted (i.e. via 'kubectl'), the Change Data Capture pattern is
implemented with the Informer that creates / updates /
deletes the key in the cache
MAX No Cache MAX Cache
0
1000
2000
3000
4000
5000
10 requests 50 requests 100 requests 150 requests 200 requests
USE CASE
RESULTS
Max 10 concurrent requests
to inquiry a single resource
Duration of 30 seconds
AVG No Cache AVG Cache
0.00
500.00
1000.00
1500.00
2000.00
10 requests 50 requests 100 requests 150 requests 200 requests
USE CASE
RESULTS
Max 10 concurrent requests
to inquiry a single resource
Duration of 30 seconds
CONCLUSIONS
Kubernetes is not only an
orchestrator for containerized
applications but a platform
that can be elevated by
leveraging all the existing
features.
One feature that is missing
is caching for clients that
interact with Kubernetes as
a backend that exposes
resources via API.
Change Data Capture is a
pattern that is already
implemented in Kubernetes
client libraries with the
Informer object.
There are different caching
patterns that can be
implemented at the
application level or cache
provider level.
Placing a cache between
the client and the API server
can enhance latencies by
one order of magnitude.
THANK YOU

More Related Content

Similar to Ottimizzare le performance dell'API Server K8s come utilizzare cache e eventi per implementare il Change Data Capture

01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMwareVMUG IT
 
Operatorhub.io and your Kubernetes cluster | DevNation Tech Talk
Operatorhub.io and your Kubernetes cluster | DevNation Tech TalkOperatorhub.io and your Kubernetes cluster | DevNation Tech Talk
Operatorhub.io and your Kubernetes cluster | DevNation Tech TalkRed Hat Developers
 
Introducing windows server_app_fabric
Introducing windows server_app_fabricIntroducing windows server_app_fabric
Introducing windows server_app_fabricMarco Titta
 
Elastic Morocco Meetup Nov 2020
Elastic Morocco Meetup Nov 2020Elastic Morocco Meetup Nov 2020
Elastic Morocco Meetup Nov 2020Anna Ossowski
 
Event Streaming Architectures with Confluent and ScyllaDB
Event Streaming Architectures with Confluent and ScyllaDBEvent Streaming Architectures with Confluent and ScyllaDB
Event Streaming Architectures with Confluent and ScyllaDBScyllaDB
 
Kubernetes/ EKS - 김광영 (AWS 솔루션즈 아키텍트)
Kubernetes/ EKS - 김광영 (AWS 솔루션즈 아키텍트)Kubernetes/ EKS - 김광영 (AWS 솔루션즈 아키텍트)
Kubernetes/ EKS - 김광영 (AWS 솔루션즈 아키텍트)Amazon Web Services Korea
 
Service Discovery in MicroServices
Service Discovery in MicroServicesService Discovery in MicroServices
Service Discovery in MicroServicesSRINIVAS KOLAPARTHI
 
Andrea Tosatto - Kubernetes Beyond - Codemotion Milan 2017
Andrea Tosatto - Kubernetes Beyond - Codemotion Milan 2017Andrea Tosatto - Kubernetes Beyond - Codemotion Milan 2017
Andrea Tosatto - Kubernetes Beyond - Codemotion Milan 2017Codemotion
 
AWS를 활용한 첫 빅데이터 프로젝트 시작하기(김일호)- AWS 웨비나 시리즈 2015
AWS를 활용한 첫 빅데이터 프로젝트 시작하기(김일호)- AWS 웨비나 시리즈 2015AWS를 활용한 첫 빅데이터 프로젝트 시작하기(김일호)- AWS 웨비나 시리즈 2015
AWS를 활용한 첫 빅데이터 프로젝트 시작하기(김일호)- AWS 웨비나 시리즈 2015Amazon Web Services Korea
 
CloudStack DC Meetup - Apache CloudStack Overview and 4.1/4.2 Preview
CloudStack DC Meetup - Apache CloudStack Overview and 4.1/4.2 PreviewCloudStack DC Meetup - Apache CloudStack Overview and 4.1/4.2 Preview
CloudStack DC Meetup - Apache CloudStack Overview and 4.1/4.2 PreviewChip Childers
 
Kubernetes Cluster API - managing the infrastructure of multi clusters (k8s ...
Kubernetes Cluster API - managing the infrastructure of  multi clusters (k8s ...Kubernetes Cluster API - managing the infrastructure of  multi clusters (k8s ...
Kubernetes Cluster API - managing the infrastructure of multi clusters (k8s ...Tobias Schneck
 
KubernetesPPT.pptx
KubernetesPPT.pptxKubernetesPPT.pptx
KubernetesPPT.pptxRyuzaki360
 
Cinema booking system | Movie Booking System
Cinema booking system | Movie Booking SystemCinema booking system | Movie Booking System
Cinema booking system | Movie Booking Systemsekarsadasivam
 
Streaming Movies brings you Streamlined Applications -- How Adopting Netflix ...
Streaming Movies brings you Streamlined Applications -- How Adopting Netflix ...Streaming Movies brings you Streamlined Applications -- How Adopting Netflix ...
Streaming Movies brings you Streamlined Applications -- How Adopting Netflix ...Michael Elder
 
Scale Your Data Tier with Windows Server AppFabric
Scale Your Data Tier with Windows Server AppFabricScale Your Data Tier with Windows Server AppFabric
Scale Your Data Tier with Windows Server AppFabricWim Van den Broeck
 
Simplify and Boost Spark 3 Deployments with Hypervisor-Native Kubernetes
Simplify and Boost Spark 3 Deployments with Hypervisor-Native KubernetesSimplify and Boost Spark 3 Deployments with Hypervisor-Native Kubernetes
Simplify and Boost Spark 3 Deployments with Hypervisor-Native KubernetesDatabricks
 

Similar to Ottimizzare le performance dell'API Server K8s come utilizzare cache e eventi per implementare il Change Data Capture (20)

01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
 
A quick introduction to AKS
A quick introduction to AKSA quick introduction to AKS
A quick introduction to AKS
 
Operatorhub.io and your Kubernetes cluster | DevNation Tech Talk
Operatorhub.io and your Kubernetes cluster | DevNation Tech TalkOperatorhub.io and your Kubernetes cluster | DevNation Tech Talk
Operatorhub.io and your Kubernetes cluster | DevNation Tech Talk
 
Introducing windows server_app_fabric
Introducing windows server_app_fabricIntroducing windows server_app_fabric
Introducing windows server_app_fabric
 
Elastic Morocco Meetup Nov 2020
Elastic Morocco Meetup Nov 2020Elastic Morocco Meetup Nov 2020
Elastic Morocco Meetup Nov 2020
 
Event Streaming Architectures with Confluent and ScyllaDB
Event Streaming Architectures with Confluent and ScyllaDBEvent Streaming Architectures with Confluent and ScyllaDB
Event Streaming Architectures with Confluent and ScyllaDB
 
Kubernetes/ EKS - 김광영 (AWS 솔루션즈 아키텍트)
Kubernetes/ EKS - 김광영 (AWS 솔루션즈 아키텍트)Kubernetes/ EKS - 김광영 (AWS 솔루션즈 아키텍트)
Kubernetes/ EKS - 김광영 (AWS 솔루션즈 아키텍트)
 
Cisco project ideas
Cisco   project ideasCisco   project ideas
Cisco project ideas
 
App fabric introduction
App fabric introductionApp fabric introduction
App fabric introduction
 
Service Discovery in MicroServices
Service Discovery in MicroServicesService Discovery in MicroServices
Service Discovery in MicroServices
 
Andrea Tosatto - Kubernetes Beyond - Codemotion Milan 2017
Andrea Tosatto - Kubernetes Beyond - Codemotion Milan 2017Andrea Tosatto - Kubernetes Beyond - Codemotion Milan 2017
Andrea Tosatto - Kubernetes Beyond - Codemotion Milan 2017
 
AWS를 활용한 첫 빅데이터 프로젝트 시작하기(김일호)- AWS 웨비나 시리즈 2015
AWS를 활용한 첫 빅데이터 프로젝트 시작하기(김일호)- AWS 웨비나 시리즈 2015AWS를 활용한 첫 빅데이터 프로젝트 시작하기(김일호)- AWS 웨비나 시리즈 2015
AWS를 활용한 첫 빅데이터 프로젝트 시작하기(김일호)- AWS 웨비나 시리즈 2015
 
Amazon EKS Deep Dive
Amazon EKS Deep DiveAmazon EKS Deep Dive
Amazon EKS Deep Dive
 
CloudStack DC Meetup - Apache CloudStack Overview and 4.1/4.2 Preview
CloudStack DC Meetup - Apache CloudStack Overview and 4.1/4.2 PreviewCloudStack DC Meetup - Apache CloudStack Overview and 4.1/4.2 Preview
CloudStack DC Meetup - Apache CloudStack Overview and 4.1/4.2 Preview
 
Kubernetes Cluster API - managing the infrastructure of multi clusters (k8s ...
Kubernetes Cluster API - managing the infrastructure of  multi clusters (k8s ...Kubernetes Cluster API - managing the infrastructure of  multi clusters (k8s ...
Kubernetes Cluster API - managing the infrastructure of multi clusters (k8s ...
 
KubernetesPPT.pptx
KubernetesPPT.pptxKubernetesPPT.pptx
KubernetesPPT.pptx
 
Cinema booking system | Movie Booking System
Cinema booking system | Movie Booking SystemCinema booking system | Movie Booking System
Cinema booking system | Movie Booking System
 
Streaming Movies brings you Streamlined Applications -- How Adopting Netflix ...
Streaming Movies brings you Streamlined Applications -- How Adopting Netflix ...Streaming Movies brings you Streamlined Applications -- How Adopting Netflix ...
Streaming Movies brings you Streamlined Applications -- How Adopting Netflix ...
 
Scale Your Data Tier with Windows Server AppFabric
Scale Your Data Tier with Windows Server AppFabricScale Your Data Tier with Windows Server AppFabric
Scale Your Data Tier with Windows Server AppFabric
 
Simplify and Boost Spark 3 Deployments with Hypervisor-Native Kubernetes
Simplify and Boost Spark 3 Deployments with Hypervisor-Native KubernetesSimplify and Boost Spark 3 Deployments with Hypervisor-Native Kubernetes
Simplify and Boost Spark 3 Deployments with Hypervisor-Native Kubernetes
 

More from Luigi Fugaro

Sharp Coding 2023 - Luigi Fugaro - ACRE.pdf
Sharp Coding 2023 - Luigi Fugaro - ACRE.pdfSharp Coding 2023 - Luigi Fugaro - ACRE.pdf
Sharp Coding 2023 - Luigi Fugaro - ACRE.pdfLuigi Fugaro
 
Red Hat Summit Connect 2023 - Redis Enterprise, the engine of Generative AI
Red Hat Summit Connect 2023 - Redis Enterprise, the engine of Generative AIRed Hat Summit Connect 2023 - Redis Enterprise, the engine of Generative AI
Red Hat Summit Connect 2023 - Redis Enterprise, the engine of Generative AILuigi Fugaro
 
Unleashing the Power of Vector Search in .NET - DotNETConf2024.pdf
Unleashing the Power of Vector Search in .NET - DotNETConf2024.pdfUnleashing the Power of Vector Search in .NET - DotNETConf2024.pdf
Unleashing the Power of Vector Search in .NET - DotNETConf2024.pdfLuigi Fugaro
 
Unleashing the Power of Vector Search in .NET - SharpCoding2024.pdf
Unleashing the Power of Vector Search in .NET - SharpCoding2024.pdfUnleashing the Power of Vector Search in .NET - SharpCoding2024.pdf
Unleashing the Power of Vector Search in .NET - SharpCoding2024.pdfLuigi Fugaro
 
Caching Patterns for lazy devs for lazy loading - Luigi Fugaro VDTJAN23
Caching Patterns for lazy devs for lazy loading - Luigi Fugaro VDTJAN23Caching Patterns for lazy devs for lazy loading - Luigi Fugaro VDTJAN23
Caching Patterns for lazy devs for lazy loading - Luigi Fugaro VDTJAN23Luigi Fugaro
 
Codemotion Milan '22 - Real Time Data - No CRDTs, no party!
Codemotion Milan '22 - Real Time Data - No CRDTs, no party!Codemotion Milan '22 - Real Time Data - No CRDTs, no party!
Codemotion Milan '22 - Real Time Data - No CRDTs, no party!Luigi Fugaro
 
OpenSlava 2018 - Cloud Native Applications with OpenShift
OpenSlava 2018 - Cloud Native Applications with OpenShiftOpenSlava 2018 - Cloud Native Applications with OpenShift
OpenSlava 2018 - Cloud Native Applications with OpenShiftLuigi Fugaro
 
Redis - Non solo cache
Redis - Non solo cacheRedis - Non solo cache
Redis - Non solo cacheLuigi Fugaro
 
JDV for Codemotion Rome 2017
JDV for Codemotion Rome 2017JDV for Codemotion Rome 2017
JDV for Codemotion Rome 2017Luigi Fugaro
 
2.5tier Javaday (italian)
2.5tier Javaday (italian)2.5tier Javaday (italian)
2.5tier Javaday (italian)Luigi Fugaro
 

More from Luigi Fugaro (10)

Sharp Coding 2023 - Luigi Fugaro - ACRE.pdf
Sharp Coding 2023 - Luigi Fugaro - ACRE.pdfSharp Coding 2023 - Luigi Fugaro - ACRE.pdf
Sharp Coding 2023 - Luigi Fugaro - ACRE.pdf
 
Red Hat Summit Connect 2023 - Redis Enterprise, the engine of Generative AI
Red Hat Summit Connect 2023 - Redis Enterprise, the engine of Generative AIRed Hat Summit Connect 2023 - Redis Enterprise, the engine of Generative AI
Red Hat Summit Connect 2023 - Redis Enterprise, the engine of Generative AI
 
Unleashing the Power of Vector Search in .NET - DotNETConf2024.pdf
Unleashing the Power of Vector Search in .NET - DotNETConf2024.pdfUnleashing the Power of Vector Search in .NET - DotNETConf2024.pdf
Unleashing the Power of Vector Search in .NET - DotNETConf2024.pdf
 
Unleashing the Power of Vector Search in .NET - SharpCoding2024.pdf
Unleashing the Power of Vector Search in .NET - SharpCoding2024.pdfUnleashing the Power of Vector Search in .NET - SharpCoding2024.pdf
Unleashing the Power of Vector Search in .NET - SharpCoding2024.pdf
 
Caching Patterns for lazy devs for lazy loading - Luigi Fugaro VDTJAN23
Caching Patterns for lazy devs for lazy loading - Luigi Fugaro VDTJAN23Caching Patterns for lazy devs for lazy loading - Luigi Fugaro VDTJAN23
Caching Patterns for lazy devs for lazy loading - Luigi Fugaro VDTJAN23
 
Codemotion Milan '22 - Real Time Data - No CRDTs, no party!
Codemotion Milan '22 - Real Time Data - No CRDTs, no party!Codemotion Milan '22 - Real Time Data - No CRDTs, no party!
Codemotion Milan '22 - Real Time Data - No CRDTs, no party!
 
OpenSlava 2018 - Cloud Native Applications with OpenShift
OpenSlava 2018 - Cloud Native Applications with OpenShiftOpenSlava 2018 - Cloud Native Applications with OpenShift
OpenSlava 2018 - Cloud Native Applications with OpenShift
 
Redis - Non solo cache
Redis - Non solo cacheRedis - Non solo cache
Redis - Non solo cache
 
JDV for Codemotion Rome 2017
JDV for Codemotion Rome 2017JDV for Codemotion Rome 2017
JDV for Codemotion Rome 2017
 
2.5tier Javaday (italian)
2.5tier Javaday (italian)2.5tier Javaday (italian)
2.5tier Javaday (italian)
 

Recently uploaded

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

Ottimizzare le performance dell'API Server K8s come utilizzare cache e eventi per implementare il Change Data Capture

  • 1. OTTIMIZZARE LE PERFORMANCE DELL'API SERVER K8S: COME UTILIZZARE CACHE ED EVENTI PER IMPLEMENTARE IL CHANGE DATA CAPTURE By Diego Braga, Product Manager @ Krateo PlatformOps & Luigi Fugaro, Sr. Solution Architect @ Redis
  • 3.
  • 4. WHY ARE WE PRESENTING THIS TALK? Kubernetes is becoming the de facto industrial standard for orchestrating cloud-native applications. What if we want to treat Kubernetes as a platform that is interrogated by different clients via API? This could generate a lot of requests to the API server. Kubernetes doesn't offer caching out of the box, so what could be the best pattern to implement it?
  • 5. WHAT IS A CACHE Prompt: "Briefly describe what is a cache." Response: "A cache is a hardware or software component that stores data so future requests for that data can be served faster. The data stored in a cache might be the results of an earlier computation, or duplicates of data stored elsewhere. A cache hit occurs when the requested data can be found in a cache, while a cache miss occurs when it cannot." Caches are utilized because the data stored in a cache can often be delivered faster than re-fetching or recomputing the original data. This is due to the principles of the locality of reference, where programs access data and instructions in localized areas. Common types of caches include CPU caches, web caches, and database caches. By storing frequently accessed information, caches reduce data access latency, decrease bandwidth consumption, and improve overall system performance.
  • 6. CACHE-ASIDE READ-THROUGH WRITE-THROUGH Cache-miss managed at application level. Cache-miss managed at cache provider level. Write data in the cache and automatically update the db. SYNC CACHING PATTERNS WRITE-BEHIND Write data in the cache and automatically update the db. ASYNC
  • 7. CHANGE DATA CAPTURE Prompt: "Briefly describe what is change data capture." Response: "Change Data Capture (CDC) is a design pattern that enables tracking and capturing changes in data so that other software (like ETL tools, data replication tools, or data auditing tools) can respond to those changes. The changes might include insertions, updates, and deletions that are performed on a database table." AUTOMATION OFFLOADING CQRS DESIGN PATTERN
  • 8. KUBERNETES API SERVER The API server is a component of the Kubernetes control plane that exposes the Kubernetes API. The API server is the front end for the Kubernetes control plane
  • 9. KUBERNETES INFORMERS As the center of Kubernetes communication components, API Server receives requests, contacts etcd, and manages all the resource objects. So it would be under pressure easily. To ease API Server’s pressure, Kubernetes employed a message system called Informer, which guarantees message delivery and provides high- performance real-time delivery, like any other famous message system. Informers query the resource data and store it in a local cache. Once stored, an event is only generated when it detects a change in the object (or resource) state.
  • 10. KUBERNETES CLIENT The following client libraries are officially maintained by Kubernetes SIG API Machinery. C DOTNET GO HASKELL JAVA JAVASCRIPT PERL PYTHON RUBY
  • 11. USE CASE Leveraging client-javascript, we wrote a backend that exposes an API to query Kubernetes resources: via query parameter is it possible to use Redis as cache or interact directly with the API server
  • 12. USE CASE ARCHITECTURE CACHE WARM UP When the Informer is instantiated, all the existing resources are pushed into the cache AVOID CACHE MISS The client will always find an entry in the cache if the resource exists in Kubernetes CACHE UPDATE The Change Data Capture is implemented via the Informer that is notified for every resource change from the API server - and the microservice will set, update or delete the key 2 3 1 Client Webserver (express.js) Cache Kubernetes API server Informer (client-javascript) /cache=true /cache=false
  • 13. CODE SNIPPET A new Informer is instantiated for any kind of Resource available in the cluster (namespaces or cluster-scoped) and it interacts directly with the cache
  • 14. CODE SNIPPET If the 'cache' query parameter is set to 'true' (or not specified), the webservice will inquiry the cache, otherwise it will call directly the API server
  • 15. LOG SNIPPET When a new Kubernetes Resource is created / updated / deleted (i.e. via 'kubectl'), the Change Data Capture pattern is implemented with the Informer that creates / updates / deletes the key in the cache
  • 16. MAX No Cache MAX Cache 0 1000 2000 3000 4000 5000 10 requests 50 requests 100 requests 150 requests 200 requests USE CASE RESULTS Max 10 concurrent requests to inquiry a single resource Duration of 30 seconds
  • 17. AVG No Cache AVG Cache 0.00 500.00 1000.00 1500.00 2000.00 10 requests 50 requests 100 requests 150 requests 200 requests USE CASE RESULTS Max 10 concurrent requests to inquiry a single resource Duration of 30 seconds
  • 18. CONCLUSIONS Kubernetes is not only an orchestrator for containerized applications but a platform that can be elevated by leveraging all the existing features. One feature that is missing is caching for clients that interact with Kubernetes as a backend that exposes resources via API. Change Data Capture is a pattern that is already implemented in Kubernetes client libraries with the Informer object. There are different caching patterns that can be implemented at the application level or cache provider level. Placing a cache between the client and the API server can enhance latencies by one order of magnitude.