SlideShare a Scribd company logo
1 of 28
Download to read offline
© 2018 Software AG. All rights reserved.
[DEV5935] CACHING IN APPLICATIONS
STILL MATTERS !
Anthony Dahanne
@anthonydahanne
blog.dahanne.net
Henri Tremblay
@henri_tremblay
blog.tremblay.pro
LET US INTRODUCE OURSELVES
„Henri Tremblay, Senior Software Engineer @
Terracotta, a Software AG company
„Working on Ehcache mostly
„Lead developer of EasyMock and Objenesis
„Java Champion, Oracle Groundbreaker Ambassador
and Montréal JUG leader
„Anthony Dahanne, Senior Software Engineer @
Terracotta, a Software AG company
„Working on the Terracotta Management Console
„Working on Terracotta cloud deployments (Docker,
Kubernetes, AWS, etc.)
„Montréal JUG leader
AGENDA
Caching 101
Caching on the JVM
Clustered Caching with Terracotta Server
CACHING 101
CACHE DEFINITION
“Store of things
that will be required in the future,
and can be retrieved rapidly.”
from wiktionary.com
CACHE DEFINITION
A Map (key/value mappings) with
• capacity control (via eviction)
• freshness control (via expiry)
WHERE IS CACHING USED ?
LET’S START WITH THE CPU !
Core
L1 D-cache
L1 I-cache
L2 Cache
L3 Cache
Core
L1 D-cache
L1 I-cache
L2 Cache
Core
L1 D-cache
L1 I-cache
L2 Cache
Core
L1 D-cache
L1 I-cache
L2 Cache
Not that long ago (Intel I7 series) :
L1 Instruction Cache and Data Cache : 32KB
L2 Cache : 256KB
L3 Cache : 8MB
LATENCIES TO REMEMBER
L1 cache reference 0.5 ns
L2 cache reference 7 ns 14x L1 cache
Main memory reference 100 ns 20x L2 cache
Read 1 MB sequentially from memory 250,000 ns 250 us
Read 1 MB sequentially from SSD* 1,000,000 ns 1,000 us 1 ms ~1GB/sec SSD
Read 1 MB sequentially from disk 20,000,000 ns 20,000 us 20 ms 80x memory
Send packet CA->Netherlands->CA 150 ms 150 ms
from github.com/jboner
WHERE IS CACHING USED ?
Browser Caching CDN Caching
CPU Caching
Application Caching
Disk Caching
CACHING THEORY : AMDAHL’S LAW
“the theoretical speedup is always limited by the part of the task that cannot
benefit from the improvement.”, from Wikipedia
s : speedup in latency
p : percentage of the execution time
CACHING THEORY : THE LONG TAIL
CACHING GLOSSARY
• Hit : when the cache returns a value
• Miss : when the cache does not have a value
• Cold / Hot : when the cache is empty / full
WHAT TO MEASURE WHEN CACHING
• Cache Usage (empty ? full ?)
• HitRatio : hits / (misses + hits)
• HitRate : hits / second
• Eviction rate
• Size (in entries or bytes)
CACHING ON THE JVM
EHCACHE
HISTORY OF CACHING ON THE JVM
Review Ballot
2001
Public Review
2013
First Release
2003
2.0 “Express”
2010
2.3 Offheap
2011
JSR-107
First Release
2003
Terracotta 5
2016
TERRACOTTA
2009
Ehcache acquisition
Public Release
2014
1.1
2017
Ehcache 3
2016
EHCACHE REBOOT : EHCACHE3
• 3.0 (May 2016)
• Compatible with JSR-107
• User managed cache
• Copiers & Serializers
• Strong typing
• 3.1 (Jun 2016)
• Clustered tier added
• 3.2 (November 2016)
• High Availability with Terracotta
Server
• 3.5 (March 2018)
• Embracing Java 8 / dropping Java
6 support
• Documented resilience strategies
• 3.6 (September 2018)
• On-heap performance
improvement
JSR-107 AND EHCACHE 3 INTEGRATIONS
• JSR-107
• Spring (since 4.1, Spring Boot since 1.2)
• Guice
• jcache-cdi
• Hibernate (since 5.2.0)
• JHipster (since 3.12)
• Bootique (since 0.21)
• Ehcache 3
• Apache Shiro
• Apache Camel (since 2.18)
CACHING PATTERNS
• No Caching
CACHING PATTERNS
• No Caching
• Cache aside
Business logic
Cache
GET(K)
PUT(K,V)
NULL
LOAD(K)
SoR
K,V
K,V
V
THUNDERING HERD
Client 1
Client 2
Client n
...
Cache
GET(K)
PUT(K,V)
NULL
LOAD(K)
SoR
K,V
K,V
V
PREVENTING THE THUNDERING HERD
Client 1
Client 2
Client n
...
Cache
GET(K)
PUT(K,V)
NULL
LOAD(K)
SoR
K,V
K,V
V
Waiting...
CACHING PATTERNS
• No Caching
• Cache aside
• Cache through
V
Business logic Cache
GET(K) LOAD(K)
PUT(K,V)
K,V
SoR
K,VV
CLUSTERED CACHING
WITH TERRACOTTA SERVER
TERRACOTTA SERVER RESOURCES
from ehcache.org documentation
n
…
SEVERAL CLIENTS, ACTIVE PASSIVE TERRACOTTA CLUSTER
MySQL
Webapp with
Ehcache3 Clustered
Terracotta Server Terracotta Server
LINKS AND REFERENCES
• Old version of this conference by Anthony (Devoxx):
• Slideshare: https://www.slideshare.net/anthonydahanne/terracotta-ehcache-simpler-faster-distributed
• Youtube: https://www.youtube.com/watch?v=-j6cNZc5wYM
• Caching 101: Caching on the JVM (and beyond) by Louis Jacomet & Aurelien Broszniowski (Devoxx UK)
• Youtube: https://www.youtube.com/watch?v=FQfd8x29Ud8
• Ehcache3 documentation: http://www.ehcache.org/
• Ehcache3 and Terracotta Server demos: https://github.com/ehcache/ehcache3-samples
• The essence of caching, by Greg Luck
• Youtube: https://www.youtube.com/watch?v=TszcAWgCXD0
WHO HAS LEARNED SOMETHING
TODAY?
?
© 2018 Software AG. All rights reserved. For internal use only"28
http://ehcache.org
@ehcache
http://terracotta.org
@terracottatech
http://montreal-jug.org
@montrealjug
http://easymock.org
@easymock
Questions?
Anthony Dahanne
@anthonydahanne
blog.dahanne.net
Henri Tremblay
@henri_tremblay
blog.tremblay.pro

More Related Content

What's hot

Spinnaker VLDB 2011
Spinnaker VLDB 2011Spinnaker VLDB 2011
Spinnaker VLDB 2011
sandeep_tata
 

What's hot (20)

Spinnaker VLDB 2011
Spinnaker VLDB 2011Spinnaker VLDB 2011
Spinnaker VLDB 2011
 
Making Ceph awesome on Kubernetes with Rook - Bassam Tabbara
Making Ceph awesome on Kubernetes with Rook - Bassam TabbaraMaking Ceph awesome on Kubernetes with Rook - Bassam Tabbara
Making Ceph awesome on Kubernetes with Rook - Bassam Tabbara
 
RedisConf17 - Redis Cluster at flickr and tripod
RedisConf17 - Redis Cluster at flickr and tripodRedisConf17 - Redis Cluster at flickr and tripod
RedisConf17 - Redis Cluster at flickr and tripod
 
Ceph QoS: How to support QoS in distributed storage system - Taewoong Kim
Ceph QoS: How to support QoS in distributed storage system - Taewoong KimCeph QoS: How to support QoS in distributed storage system - Taewoong Kim
Ceph QoS: How to support QoS in distributed storage system - Taewoong Kim
 
RGW Beyond Cloud: Live Video Storage with Ceph - Shengjing Zhu, Yiming Xie
RGW Beyond Cloud: Live Video Storage with Ceph - Shengjing Zhu, Yiming XieRGW Beyond Cloud: Live Video Storage with Ceph - Shengjing Zhu, Yiming Xie
RGW Beyond Cloud: Live Video Storage with Ceph - Shengjing Zhu, Yiming Xie
 
MySQL Head to Head Performance
MySQL Head to Head PerformanceMySQL Head to Head Performance
MySQL Head to Head Performance
 
Leveraging Docker and CoreOS to provide always available Cassandra at Instacl...
Leveraging Docker and CoreOS to provide always available Cassandra at Instacl...Leveraging Docker and CoreOS to provide always available Cassandra at Instacl...
Leveraging Docker and CoreOS to provide always available Cassandra at Instacl...
 
Seastar / ScyllaDB, or how we implemented a 10-times faster Cassandra
Seastar / ScyllaDB,  or how we implemented a 10-times faster CassandraSeastar / ScyllaDB,  or how we implemented a 10-times faster Cassandra
Seastar / ScyllaDB, or how we implemented a 10-times faster Cassandra
 
[OpenStack Days Korea 2016] Track4 - Deep Drive: k8s with Docker
[OpenStack Days Korea 2016] Track4 - Deep Drive: k8s with Docker[OpenStack Days Korea 2016] Track4 - Deep Drive: k8s with Docker
[OpenStack Days Korea 2016] Track4 - Deep Drive: k8s with Docker
 
Virtual training Intro to the Tick stack and InfluxEnterprise
Virtual training  Intro to the Tick stack and InfluxEnterpriseVirtual training  Intro to the Tick stack and InfluxEnterprise
Virtual training Intro to the Tick stack and InfluxEnterprise
 
Running Cassandra in AWS
Running Cassandra in AWSRunning Cassandra in AWS
Running Cassandra in AWS
 
KubeCon US 2021 - Recap - DCMeetup
KubeCon US 2021 - Recap - DCMeetupKubeCon US 2021 - Recap - DCMeetup
KubeCon US 2021 - Recap - DCMeetup
 
Kubernetes Summit 2018 - Kubernetes: Stateless -> Stateful
Kubernetes Summit 2018 - Kubernetes: Stateless -> StatefulKubernetes Summit 2018 - Kubernetes: Stateless -> Stateful
Kubernetes Summit 2018 - Kubernetes: Stateless -> Stateful
 
Back to the future with C++ and Seastar
Back to the future with C++ and SeastarBack to the future with C++ and Seastar
Back to the future with C++ and Seastar
 
SUSE - performance analysis-with_ceph
SUSE - performance analysis-with_cephSUSE - performance analysis-with_ceph
SUSE - performance analysis-with_ceph
 
NetflixOSS Open House Lightning talks
NetflixOSS Open House Lightning talksNetflixOSS Open House Lightning talks
NetflixOSS Open House Lightning talks
 
Ceph Day London 2014 - Best Practices for Ceph-powered Implementations of Sto...
Ceph Day London 2014 - Best Practices for Ceph-powered Implementations of Sto...Ceph Day London 2014 - Best Practices for Ceph-powered Implementations of Sto...
Ceph Day London 2014 - Best Practices for Ceph-powered Implementations of Sto...
 
Troubleshooting redis
Troubleshooting redisTroubleshooting redis
Troubleshooting redis
 
Daniel Sikar: Running Coherence Clustered Cache on Amazon EC2 - 09/11/2010
Daniel Sikar: Running Coherence Clustered Cache on Amazon EC2 - 09/11/2010Daniel Sikar: Running Coherence Clustered Cache on Amazon EC2 - 09/11/2010
Daniel Sikar: Running Coherence Clustered Cache on Amazon EC2 - 09/11/2010
 
Running a DynamoDB-compatible Database on Managed Kubernetes Services
Running a DynamoDB-compatible Database on Managed Kubernetes ServicesRunning a DynamoDB-compatible Database on Managed Kubernetes Services
Running a DynamoDB-compatible Database on Managed Kubernetes Services
 

Similar to Caching in applications still matters

Tachyon meetup San Francisco Oct 2014
Tachyon meetup San Francisco Oct 2014Tachyon meetup San Francisco Oct 2014
Tachyon meetup San Francisco Oct 2014
Claudiu Barbura
 
OGG Architecture Performance
OGG Architecture PerformanceOGG Architecture Performance
OGG Architecture Performance
Enkitec
 
Oracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture PerformanceOracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture Performance
Enkitec
 
Why Software Defined Storage is Critical for Your IT Strategy
Why Software Defined Storage is Critical for Your IT StrategyWhy Software Defined Storage is Critical for Your IT Strategy
Why Software Defined Storage is Critical for Your IT Strategy
andreas kuncoro
 

Similar to Caching in applications still matters (20)

Terracotta Ehcache : Simpler, faster, distributed
Terracotta Ehcache : Simpler, faster, distributedTerracotta Ehcache : Simpler, faster, distributed
Terracotta Ehcache : Simpler, faster, distributed
 
Using JCache to speed up your apps
Using JCache to speed up your appsUsing JCache to speed up your apps
Using JCache to speed up your apps
 
Ehcache 3 @ BruJUG
Ehcache 3 @ BruJUGEhcache 3 @ BruJUG
Ehcache 3 @ BruJUG
 
Scale ColdFusion with Terracotta Distributed Caching for Ehchache
Scale ColdFusion with Terracotta Distributed Caching for EhchacheScale ColdFusion with Terracotta Distributed Caching for Ehchache
Scale ColdFusion with Terracotta Distributed Caching for Ehchache
 
Ehcache3 — JSR-107 on steroids
Ehcache3 — JSR-107 on steroidsEhcache3 — JSR-107 on steroids
Ehcache3 — JSR-107 on steroids
 
JCache Using JCache
JCache Using JCacheJCache Using JCache
JCache Using JCache
 
IMC Summit 2016 Breakout - Greg Luck - How to Speed Up Your Application Using...
IMC Summit 2016 Breakout - Greg Luck - How to Speed Up Your Application Using...IMC Summit 2016 Breakout - Greg Luck - How to Speed Up Your Application Using...
IMC Summit 2016 Breakout - Greg Luck - How to Speed Up Your Application Using...
 
Distributed caching-computing v3.8
Distributed caching-computing v3.8Distributed caching-computing v3.8
Distributed caching-computing v3.8
 
Tachyon meetup San Francisco Oct 2014
Tachyon meetup San Francisco Oct 2014Tachyon meetup San Francisco Oct 2014
Tachyon meetup San Francisco Oct 2014
 
Caching reboot: javax.cache & Ehcache 3
Caching reboot: javax.cache & Ehcache 3Caching reboot: javax.cache & Ehcache 3
Caching reboot: javax.cache & Ehcache 3
 
Distributed caching and computing v3.7
Distributed caching and computing v3.7Distributed caching and computing v3.7
Distributed caching and computing v3.7
 
Where Django Caching Bust at the Seams
Where Django Caching Bust at the SeamsWhere Django Caching Bust at the Seams
Where Django Caching Bust at the Seams
 
Think Distributed: The Hazelcast Way
Think Distributed: The Hazelcast WayThink Distributed: The Hazelcast Way
Think Distributed: The Hazelcast Way
 
OGG Architecture Performance
OGG Architecture PerformanceOGG Architecture Performance
OGG Architecture Performance
 
Oracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture PerformanceOracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture Performance
 
Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)
Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)
Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)
 
IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...
IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...
IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...
 
Caching and JCache with Greg Luck 18.02.16
Caching and JCache with Greg Luck 18.02.16Caching and JCache with Greg Luck 18.02.16
Caching and JCache with Greg Luck 18.02.16
 
Why Software Defined Storage is Critical for Your IT Strategy
Why Software Defined Storage is Critical for Your IT StrategyWhy Software Defined Storage is Critical for Your IT Strategy
Why Software Defined Storage is Critical for Your IT Strategy
 
Java In-Process Caching - Performance, Progress and Pittfalls
Java In-Process Caching - Performance, Progress and PittfallsJava In-Process Caching - Performance, Progress and Pittfalls
Java In-Process Caching - Performance, Progress and Pittfalls
 

More from Anthony Dahanne

Confoo2013 make your java-app rest enabled
Confoo2013 make your java-app rest enabledConfoo2013 make your java-app rest enabled
Confoo2013 make your java-app rest enabled
Anthony Dahanne
 

More from Anthony Dahanne (17)

Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024
 
No more Dockerfiles? Buildpacks to help you ship your image!
No more Dockerfiles? Buildpacks to help you ship your image!No more Dockerfiles? Buildpacks to help you ship your image!
No more Dockerfiles? Buildpacks to help you ship your image!
 
CNCF Québec Meetup du 16 Novembre 2023
CNCF Québec Meetup du 16 Novembre 2023CNCF Québec Meetup du 16 Novembre 2023
CNCF Québec Meetup du 16 Novembre 2023
 
Buildpacks: the other way to build container images
Buildpacks: the other way to build container imagesBuildpacks: the other way to build container images
Buildpacks: the other way to build container images
 
Tu changes d'emploi - retour d'experience d'un développeur
Tu changes d'emploi - retour d'experience d'un développeurTu changes d'emploi - retour d'experience d'un développeur
Tu changes d'emploi - retour d'experience d'un développeur
 
Java applications containerized and deployed
Java applications containerized and deployedJava applications containerized and deployed
Java applications containerized and deployed
 
Contribuer à la traduction française de kubernetes
Contribuer à la traduction française de kubernetesContribuer à la traduction française de kubernetes
Contribuer à la traduction française de kubernetes
 
Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !
 
Kubernetes Java Operator
Kubernetes Java OperatorKubernetes Java Operator
Kubernetes Java Operator
 
Kubernetes for java developers - Tutorial at Oracle Code One 2018
Kubernetes for java developers - Tutorial at Oracle Code One 2018Kubernetes for java developers - Tutorial at Oracle Code One 2018
Kubernetes for java developers - Tutorial at Oracle Code One 2018
 
Kubernetes for Java Developers
Kubernetes for Java DevelopersKubernetes for Java Developers
Kubernetes for Java Developers
 
Docker and java
Docker and javaDocker and java
Docker and java
 
Docker and java, at Montréal JUG
Docker and java, at Montréal JUGDocker and java, at Montréal JUG
Docker and java, at Montréal JUG
 
Writing a Jenkins / Hudson plugin
Writing a Jenkins / Hudson pluginWriting a Jenkins / Hudson plugin
Writing a Jenkins / Hudson plugin
 
Confoo2013 make your java-app rest enabled
Confoo2013 make your java-app rest enabledConfoo2013 make your java-app rest enabled
Confoo2013 make your java-app rest enabled
 
Ci for-android-apps
Ci for-android-appsCi for-android-apps
Ci for-android-apps
 
Asynctasks
AsynctasksAsynctasks
Asynctasks
 

Recently uploaded

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 

Recently uploaded (20)

Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 

Caching in applications still matters

  • 1. © 2018 Software AG. All rights reserved. [DEV5935] CACHING IN APPLICATIONS STILL MATTERS ! Anthony Dahanne @anthonydahanne blog.dahanne.net Henri Tremblay @henri_tremblay blog.tremblay.pro
  • 2. LET US INTRODUCE OURSELVES „Henri Tremblay, Senior Software Engineer @ Terracotta, a Software AG company „Working on Ehcache mostly „Lead developer of EasyMock and Objenesis „Java Champion, Oracle Groundbreaker Ambassador and Montréal JUG leader „Anthony Dahanne, Senior Software Engineer @ Terracotta, a Software AG company „Working on the Terracotta Management Console „Working on Terracotta cloud deployments (Docker, Kubernetes, AWS, etc.) „Montréal JUG leader
  • 3. AGENDA Caching 101 Caching on the JVM Clustered Caching with Terracotta Server
  • 5. CACHE DEFINITION “Store of things that will be required in the future, and can be retrieved rapidly.” from wiktionary.com
  • 6. CACHE DEFINITION A Map (key/value mappings) with • capacity control (via eviction) • freshness control (via expiry)
  • 7. WHERE IS CACHING USED ? LET’S START WITH THE CPU ! Core L1 D-cache L1 I-cache L2 Cache L3 Cache Core L1 D-cache L1 I-cache L2 Cache Core L1 D-cache L1 I-cache L2 Cache Core L1 D-cache L1 I-cache L2 Cache Not that long ago (Intel I7 series) : L1 Instruction Cache and Data Cache : 32KB L2 Cache : 256KB L3 Cache : 8MB
  • 8. LATENCIES TO REMEMBER L1 cache reference 0.5 ns L2 cache reference 7 ns 14x L1 cache Main memory reference 100 ns 20x L2 cache Read 1 MB sequentially from memory 250,000 ns 250 us Read 1 MB sequentially from SSD* 1,000,000 ns 1,000 us 1 ms ~1GB/sec SSD Read 1 MB sequentially from disk 20,000,000 ns 20,000 us 20 ms 80x memory Send packet CA->Netherlands->CA 150 ms 150 ms from github.com/jboner
  • 9. WHERE IS CACHING USED ? Browser Caching CDN Caching CPU Caching Application Caching Disk Caching
  • 10. CACHING THEORY : AMDAHL’S LAW “the theoretical speedup is always limited by the part of the task that cannot benefit from the improvement.”, from Wikipedia s : speedup in latency p : percentage of the execution time
  • 11. CACHING THEORY : THE LONG TAIL
  • 12. CACHING GLOSSARY • Hit : when the cache returns a value • Miss : when the cache does not have a value • Cold / Hot : when the cache is empty / full
  • 13. WHAT TO MEASURE WHEN CACHING • Cache Usage (empty ? full ?) • HitRatio : hits / (misses + hits) • HitRate : hits / second • Eviction rate • Size (in entries or bytes)
  • 15. EHCACHE HISTORY OF CACHING ON THE JVM Review Ballot 2001 Public Review 2013 First Release 2003 2.0 “Express” 2010 2.3 Offheap 2011 JSR-107 First Release 2003 Terracotta 5 2016 TERRACOTTA 2009 Ehcache acquisition Public Release 2014 1.1 2017 Ehcache 3 2016
  • 16. EHCACHE REBOOT : EHCACHE3 • 3.0 (May 2016) • Compatible with JSR-107 • User managed cache • Copiers & Serializers • Strong typing • 3.1 (Jun 2016) • Clustered tier added • 3.2 (November 2016) • High Availability with Terracotta Server • 3.5 (March 2018) • Embracing Java 8 / dropping Java 6 support • Documented resilience strategies • 3.6 (September 2018) • On-heap performance improvement
  • 17. JSR-107 AND EHCACHE 3 INTEGRATIONS • JSR-107 • Spring (since 4.1, Spring Boot since 1.2) • Guice • jcache-cdi • Hibernate (since 5.2.0) • JHipster (since 3.12) • Bootique (since 0.21) • Ehcache 3 • Apache Shiro • Apache Camel (since 2.18)
  • 19. CACHING PATTERNS • No Caching • Cache aside Business logic Cache GET(K) PUT(K,V) NULL LOAD(K) SoR K,V K,V V
  • 20. THUNDERING HERD Client 1 Client 2 Client n ... Cache GET(K) PUT(K,V) NULL LOAD(K) SoR K,V K,V V
  • 21. PREVENTING THE THUNDERING HERD Client 1 Client 2 Client n ... Cache GET(K) PUT(K,V) NULL LOAD(K) SoR K,V K,V V Waiting...
  • 22. CACHING PATTERNS • No Caching • Cache aside • Cache through V Business logic Cache GET(K) LOAD(K) PUT(K,V) K,V SoR K,VV
  • 24. TERRACOTTA SERVER RESOURCES from ehcache.org documentation
  • 25. n … SEVERAL CLIENTS, ACTIVE PASSIVE TERRACOTTA CLUSTER MySQL Webapp with Ehcache3 Clustered Terracotta Server Terracotta Server
  • 26. LINKS AND REFERENCES • Old version of this conference by Anthony (Devoxx): • Slideshare: https://www.slideshare.net/anthonydahanne/terracotta-ehcache-simpler-faster-distributed • Youtube: https://www.youtube.com/watch?v=-j6cNZc5wYM • Caching 101: Caching on the JVM (and beyond) by Louis Jacomet & Aurelien Broszniowski (Devoxx UK) • Youtube: https://www.youtube.com/watch?v=FQfd8x29Ud8 • Ehcache3 documentation: http://www.ehcache.org/ • Ehcache3 and Terracotta Server demos: https://github.com/ehcache/ehcache3-samples • The essence of caching, by Greg Luck • Youtube: https://www.youtube.com/watch?v=TszcAWgCXD0
  • 27. WHO HAS LEARNED SOMETHING TODAY? ?
  • 28. © 2018 Software AG. All rights reserved. For internal use only"28 http://ehcache.org @ehcache http://terracotta.org @terracottatech http://montreal-jug.org @montrealjug http://easymock.org @easymock Questions? Anthony Dahanne @anthonydahanne blog.dahanne.net Henri Tremblay @henri_tremblay blog.tremblay.pro