SlideShare a Scribd company logo
© 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

PDF
Docker Summit 2016 - Kubernetes: Sweets and Bitters
PDF
Kubernetes User Group: 維運 Kubernetes 的兩三事
PPTX
實際架構實踐演化與解決方案
PDF
inwinSTACK - ceph integrate with kubernetes
PDF
Kubernetes Day 2017 - Build, Ship and Run Your APP, Production !!
PDF
Apache OpenWhiskで実現するプライベートFaaS環境 #tjdev
PPTX
Understanding DSE Search by Matt Stump
PDF
How we got to 1 millisecond latency in 99% under repair, compaction, and flus...
Docker Summit 2016 - Kubernetes: Sweets and Bitters
Kubernetes User Group: 維運 Kubernetes 的兩三事
實際架構實踐演化與解決方案
inwinSTACK - ceph integrate with kubernetes
Kubernetes Day 2017 - Build, Ship and Run Your APP, Production !!
Apache OpenWhiskで実現するプライベートFaaS環境 #tjdev
Understanding DSE Search by Matt Stump
How we got to 1 millisecond latency in 99% under repair, compaction, and flus...

What's hot (20)

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

Similar to Caching in applications still matters (20)

PDF
Terracotta Ehcache : Simpler, faster, distributed
PDF
Using JCache to speed up your apps
PDF
Ehcache 3 @ BruJUG
PDF
Scale ColdFusion with Terracotta Distributed Caching for Ehchache
PDF
Ehcache3 — JSR-107 on steroids
PDF
PPTX
IMC Summit 2016 Breakout - Greg Luck - How to Speed Up Your Application Using...
PPTX
Distributed caching-computing v3.8
PDF
Low-Cost, Unlimited Metrics Storage with Thanos: Monitor All Your K8s Cluster...
PPTX
Tachyon meetup San Francisco Oct 2014
PDF
Caching reboot: javax.cache & Ehcache 3
PPTX
Distributed caching and computing v3.7
PDF
Where Django Caching Bust at the Seams
PPTX
Think Distributed: The Hazelcast Way
PDF
OGG Architecture Performance
PDF
Oracle GoldenGate Architecture Performance
PDF
Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)
PDF
IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...
PDF
Caching and JCache with Greg Luck 18.02.16
PDF
Why Software Defined Storage is Critical for Your IT Strategy
Terracotta Ehcache : Simpler, faster, distributed
Using JCache to speed up your apps
Ehcache 3 @ BruJUG
Scale ColdFusion with Terracotta Distributed Caching for Ehchache
Ehcache3 — JSR-107 on steroids
IMC Summit 2016 Breakout - Greg Luck - How to Speed Up Your Application Using...
Distributed caching-computing v3.8
Low-Cost, Unlimited Metrics Storage with Thanos: Monitor All Your K8s Cluster...
Tachyon meetup San Francisco Oct 2014
Caching reboot: javax.cache & Ehcache 3
Distributed caching and computing v3.7
Where Django Caching Bust at the Seams
Think Distributed: The Hazelcast Way
OGG Architecture Performance
Oracle GoldenGate Architecture Performance
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 ...
Caching and JCache with Greg Luck 18.02.16
Why Software Defined Storage is Critical for Your IT Strategy
Ad

More from Anthony Dahanne (20)

PDF
JDConf 2025 - Paketo Buildpacks : the best way to build Java container images
PPTX
Not a Kubernetes fan? The state of PaaS in 2025
PPTX
No More Dockerfiles! Buildpacks to Help You Ship Your Image!
PDF
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
PPTX
Not a Kubernetes fan? The state of PaaS in 2024
PPTX
No more Dockerfiles? Buildpacks to help you ship your image!
PPTX
CNCF Québec Meetup du 16 Novembre 2023
PDF
Buildpacks: the other way to build container images
PDF
Tu changes d'emploi - retour d'experience d'un développeur
PPTX
Java applications containerized and deployed
PDF
Contribuer à la traduction française de kubernetes
PDF
Get you Java application ready for Kubernetes !
PDF
Kubernetes Java Operator
PDF
Kubernetes for java developers - Tutorial at Oracle Code One 2018
PDF
Kubernetes for Java Developers
PDF
Docker and java
PPTX
Docker and java, at Montréal JUG
PDF
Writing a Jenkins / Hudson plugin
PDF
Confoo2013 make your java-app rest enabled
ODP
Ci for-android-apps
JDConf 2025 - Paketo Buildpacks : the best way to build Java container images
Not a Kubernetes fan? The state of PaaS in 2025
No More Dockerfiles! Buildpacks to Help You Ship Your Image!
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Not a Kubernetes fan? The state of PaaS in 2024
No more Dockerfiles? Buildpacks to help you ship your image!
CNCF Québec Meetup du 16 Novembre 2023
Buildpacks: the other way to build container images
Tu changes d'emploi - retour d'experience d'un développeur
Java applications containerized and deployed
Contribuer à la traduction française de kubernetes
Get you Java application ready for Kubernetes !
Kubernetes Java Operator
Kubernetes for java developers - Tutorial at Oracle Code One 2018
Kubernetes for Java Developers
Docker and java
Docker and java, at Montréal JUG
Writing a Jenkins / Hudson plugin
Confoo2013 make your java-app rest enabled
Ci for-android-apps

Recently uploaded (20)

PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
AI in Product Development-omnex systems
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Transform Your Business with a Software ERP System
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Nekopoi APK 2025 free lastest update
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
medical staffing services at VALiNTRY
PPTX
history of c programming in notes for students .pptx
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
System and Network Administraation Chapter 3
PPTX
Introduction to Artificial Intelligence
Operating system designcfffgfgggggggvggggggggg
AI in Product Development-omnex systems
VVF-Customer-Presentation2025-Ver1.9.pptx
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Transform Your Business with a Software ERP System
How Creative Agencies Leverage Project Management Software.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
Nekopoi APK 2025 free lastest update
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
CHAPTER 2 - PM Management and IT Context
medical staffing services at VALiNTRY
history of c programming in notes for students .pptx
Softaken Excel to vCard Converter Software.pdf
Design an Analysis of Algorithms I-SECS-1021-03
2025 Textile ERP Trends: SAP, Odoo & Oracle
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
wealthsignaloriginal-com-DS-text-... (1).pdf
System and Network Administraation Chapter 3
Introduction to Artificial Intelligence

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