SlideShare une entreprise Scribd logo
1  sur  29
Télécharger pour lire hors ligne
Ehcache 3
JSR-107 on Steroids
alex snaps — principal software engineer at terracotta
@alexsnaps
A little about me
• Introducing new bugs to the world for 30+ years
• Coding in Java for 16+ years
• Works at Terracotta for 6+ years
• DSO, Ehcache, Quartz, …
• OSS Contributor
• Into API design, concurrency, distributed systems…
A little of history
[014] - Easy Hibernate Cache 0.5
  by Greg Luck (http://freshmeat.net/users/gregrluck/)
  Saturday, November 29th 2003 12:54
Software Development :: Libraries :: Java Libraries
About: Easy Hibernate Cache is a fast and simple, pure Java, in-process
cache, which acts as a pluggable cache for Hibernate 2.1. It has a small
memory footprint, minimal dependencies, and full documentation.
License: The Apache License
A little of history
• Terracotta founded in 2003, in San Francisco
• Open sourced DSO in 2006
• Acquires Ehcache in Aug. 2009
• Releases Ehcache 2.0 Mar. 2010
• Software AG acquires Terracotta in 2011
• JSR-107 Final Mar. 2014 (13 years after the JSR review ballot!)
• Work on Ehcache 3.0 begins…
javax.cache
Picture by Leo Reynolds
JSR 107
• Java Community Process driven standard
• Specifies API and semantics for temporary, 

in-memory caching of Java objects, including object creation,
shared access, spooling, invalidation, and consistency across
JVM's
Caching
• Data structure holding temporary copy of data
• Trades memory usage for reduced latency
• Targets:
• Data which is reused
• Data which is expensive to retrieve / compute
• Keeps the data close(r) to the processing unit
javax.cache API
• CacheManagers managing … Caches !
• Expiry
• Integration
• Cache Entry Listeners
• Entry Processors
• Caching Annotations
• Some Management
CacheManager
• Caching.getCachingProvider() static method
• CachingProvider.getCacheManager()
• CachingProvider
• CacheManager repository
• Identified by name & ClassLoader
CacheManager
• CacheManager
• Manages Cache lifecycle:
• Create & Destroy
• Repository of (named) Cache instances
• Manages Cache JMX (stats & management)
• … is .unwrap()’ able
Demo
… showing off a couple of caveats!
Ehcache
steroids for javax.cache
Tiered Storage
• Very similar to Ehcache 2.x
• Lowest & slowest tier is the “authority”
• Higher & faster tiers effectively act as caches
• Available today:
• Heap,
• Off-Heap,
• Disk
Store by value vs. by ref
• JSR 107 “store modes”
• “by value” (default),
• “by reference” (optional)
• What about “I don’t care” ?
• Introducing Ehcache org.ehcache.spi.copy.Copier
Custom Serialization
• Defaults to Java Serialization for
• JSR 107’s store-by-value
• Storing data elsewhere than the heap
• Introducing org.ehcache.spi.serialization.Serializer
Proper Typing
• Why is that important?
• No one wants to catch ClassCastException
• Application lifecycle!
• Ehcache records the key & value types in all its stores!
• But… there is a MutableConfiguration bug
CacheLoader & -Writer
• Ehcache’s CacheLoader/Writer API
• Enables the Cache through pattern
• Consistently across all Cache operations
• Single CacheLoaderWriter interface
• Throughput favoring Cache, not SoR
WriteBehind
• Scale out writes to your SoR
• Batching and/or coalescing them
• Even simpler than with Ehcache 2
• No more sizing gotcha!
WriterCache
Application
code
RDBMS
Writer
Expiry Policy
• JSR 107’s ExpiryPolicy
• No contextual information about the Expiry calculated
• Works for simple expiry (Accessed, Created, Modified, …)
• Introducing the org.ehcache.expiry.Expiry
Eviction Prioritizer & Veto
• Eviction not addressed by 107 at all
• org.ehcache.config.EvictionPrioritizer
• org.ehcache.config.EvictionVeto
• Both are hints though!
Transactions
• Full blown XA Resource
• including recovery support
• Developed as a independent Ehcache module
• Currently (still?) included in the main “distribution”
Future
… or a couple of days ago
Automatic Resource Control
• Size your on heap caches in natural units
• n bytes
• Percentage of the (maximal) available VM heap
• Define “resource pools” shared across caches
Clustering
• Terracotta Server Array version 5.0 (work in progress)
• Single stripe available as FOSS
• Uses our offheap-store library
• Passive fail-over
• Ehcache’s consistency mode:
• Strong
• Eventual
• Proper life cycle (finally!)
Resilience Strategy
• A cache is to be resilient
• Yet… sh*t happens
• Storage failures
• SLA violations (timeouts?)
• Very explicit contract at this time
• To be refined when clustering is wrapping up
… and moar!
• Looking at Hibernate 2nd Level Cache (through 107!)
• Advanced features to Spring (& Spring Boot)
• … your ideas!?
Where from here?
ehcache.org
Questions?
www.ehcache.org

Contenu connexe

Tendances

Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
elliando dias
 
Cloud computing 3702
Cloud computing 3702Cloud computing 3702
Cloud computing 3702
Jess Coburn
 

Tendances (19)

Caching technology comparison
Caching technology comparisonCaching technology comparison
Caching technology comparison
 
Postgres on OpenStack
Postgres on OpenStackPostgres on OpenStack
Postgres on OpenStack
 
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
 
PostgreSQL Query Cache - "pqc"
PostgreSQL Query Cache - "pqc"PostgreSQL Query Cache - "pqc"
PostgreSQL Query Cache - "pqc"
 
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
 
Aem dispatcher – tips & tricks
Aem dispatcher – tips & tricksAem dispatcher – tips & tricks
Aem dispatcher – tips & tricks
 
The secret life of a dispatcher (Adobe CQ AEM)
The secret life of a dispatcher (Adobe CQ AEM)The secret life of a dispatcher (Adobe CQ AEM)
The secret life of a dispatcher (Adobe CQ AEM)
 
Caching
CachingCaching
Caching
 
Caching with Memcached and APC
Caching with Memcached and APCCaching with Memcached and APC
Caching with Memcached and APC
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve Internet
 
Best Practices with PostgreSQL on Solaris
Best Practices with PostgreSQL on SolarisBest Practices with PostgreSQL on Solaris
Best Practices with PostgreSQL on Solaris
 
The new repository in AEM 6
The new repository in AEM 6The new repository in AEM 6
The new repository in AEM 6
 
Deep Dive into RDS PostgreSQL Universe
Deep Dive into RDS PostgreSQL UniverseDeep Dive into RDS PostgreSQL Universe
Deep Dive into RDS PostgreSQL Universe
 
VMworld 2013: vSphere Flash Read Cache Technical Overview
VMworld 2013: vSphere Flash Read Cache Technical Overview VMworld 2013: vSphere Flash Read Cache Technical Overview
VMworld 2013: vSphere Flash Read Cache Technical Overview
 
Alfresco tuning part1
Alfresco tuning part1Alfresco tuning part1
Alfresco tuning part1
 
Postgres Plus Cloud Database on OpenStack
Postgres Plus Cloud Database on OpenStackPostgres Plus Cloud Database on OpenStack
Postgres Plus Cloud Database on OpenStack
 
Web session replication with Hazelcast
Web session replication with HazelcastWeb session replication with Hazelcast
Web session replication with Hazelcast
 
Cloud computing 3702
Cloud computing 3702Cloud computing 3702
Cloud computing 3702
 
Implementing High Availability Caching with Memcached
Implementing High Availability Caching with MemcachedImplementing High Availability Caching with Memcached
Implementing High Availability Caching with Memcached
 

Similaire à Ehcache3 — JSR-107 on steroids

Accumulo Summit 2015: Real-Time Distributed and Reactive Systems with Apache ...
Accumulo Summit 2015: Real-Time Distributed and Reactive Systems with Apache ...Accumulo Summit 2015: Real-Time Distributed and Reactive Systems with Apache ...
Accumulo Summit 2015: Real-Time Distributed and Reactive Systems with Apache ...
Accumulo Summit
 

Similaire à Ehcache3 — JSR-107 on steroids (20)

Ehcache 3 @ BruJUG
Ehcache 3 @ BruJUGEhcache 3 @ BruJUG
Ehcache 3 @ BruJUG
 
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
 
Caching reboot: javax.cache & Ehcache 3
Caching reboot: javax.cache & Ehcache 3Caching reboot: javax.cache & Ehcache 3
Caching reboot: javax.cache & Ehcache 3
 
Hazelcast 101
Hazelcast 101Hazelcast 101
Hazelcast 101
 
Caching in applications still matters
Caching in applications still mattersCaching in applications still matters
Caching in applications still matters
 
Ehcache 3: JSR-107 on steroids at Devoxx Morocco
Ehcache 3: JSR-107 on steroids at Devoxx MoroccoEhcache 3: JSR-107 on steroids at Devoxx Morocco
Ehcache 3: JSR-107 on steroids at Devoxx Morocco
 
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
 
How does Apache Pegasus (incubating) community develop at SensorsData
How does Apache Pegasus (incubating) community develop at SensorsDataHow does Apache Pegasus (incubating) community develop at SensorsData
How does Apache Pegasus (incubating) community develop at SensorsData
 
JCache Using JCache
JCache Using JCacheJCache Using JCache
JCache Using JCache
 
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
 
Mini-Training: To cache or not to cache
Mini-Training: To cache or not to cacheMini-Training: To cache or not to cache
Mini-Training: To cache or not to cache
 
ContainerCon EU 2016 - Software-Defined Storage and Container Schedulers
ContainerCon EU 2016 - Software-Defined Storage and Container SchedulersContainerCon EU 2016 - Software-Defined Storage and Container Schedulers
ContainerCon EU 2016 - Software-Defined Storage and Container Schedulers
 
Distributed applications using Hazelcast
Distributed applications using HazelcastDistributed applications using Hazelcast
Distributed applications using Hazelcast
 
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
 
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
 
Caching your rails application
Caching your rails applicationCaching your rails application
Caching your rails application
 
Real-Time Distributed and Reactive Systems with Apache Kafka and Apache Accumulo
Real-Time Distributed and Reactive Systems with Apache Kafka and Apache AccumuloReal-Time Distributed and Reactive Systems with Apache Kafka and Apache Accumulo
Real-Time Distributed and Reactive Systems with Apache Kafka and Apache Accumulo
 
Accumulo Summit 2015: Real-Time Distributed and Reactive Systems with Apache ...
Accumulo Summit 2015: Real-Time Distributed and Reactive Systems with Apache ...Accumulo Summit 2015: Real-Time Distributed and Reactive Systems with Apache ...
Accumulo Summit 2015: Real-Time Distributed and Reactive Systems with Apache ...
 
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...
 
06 integrate elasticsearch
06 integrate elasticsearch06 integrate elasticsearch
06 integrate elasticsearch
 

Dernier

ALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdfALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdf
Madan Karki
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
Teachers record management system project report..pdf
Teachers record management system project report..pdfTeachers record management system project report..pdf
Teachers record management system project report..pdf
Kamal Acharya
 

Dernier (20)

RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdfRESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
 
ALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdfALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdf
 
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdfInstruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
 
Lab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docxLab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docx
 
Linux Systems Programming: Semaphores, Shared Memory, and Message Queues
Linux Systems Programming: Semaphores, Shared Memory, and Message QueuesLinux Systems Programming: Semaphores, Shared Memory, and Message Queues
Linux Systems Programming: Semaphores, Shared Memory, and Message Queues
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility Applications
 
"United Nations Park" Site Visit Report.
"United Nations Park" Site  Visit Report."United Nations Park" Site  Visit Report.
"United Nations Park" Site Visit Report.
 
ROAD CONSTRUCTION PRESENTATION.PPTX.pptx
ROAD CONSTRUCTION PRESENTATION.PPTX.pptxROAD CONSTRUCTION PRESENTATION.PPTX.pptx
ROAD CONSTRUCTION PRESENTATION.PPTX.pptx
 
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdfInvolute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
 
Electrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission lineElectrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission line
 
Theory for How to calculation capacitor bank
Theory for How to calculation capacitor bankTheory for How to calculation capacitor bank
Theory for How to calculation capacitor bank
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
 
BURGER ORDERING SYSYTEM PROJECT REPORT..pdf
BURGER ORDERING SYSYTEM PROJECT REPORT..pdfBURGER ORDERING SYSYTEM PROJECT REPORT..pdf
BURGER ORDERING SYSYTEM PROJECT REPORT..pdf
 
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
 
Circuit Breaker arc phenomenon.pdf engineering
Circuit Breaker arc phenomenon.pdf engineeringCircuit Breaker arc phenomenon.pdf engineering
Circuit Breaker arc phenomenon.pdf engineering
 
Teachers record management system project report..pdf
Teachers record management system project report..pdfTeachers record management system project report..pdf
Teachers record management system project report..pdf
 
Diploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfDiploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdf
 
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
 
Operating System chapter 9 (Virtual Memory)
Operating System chapter 9 (Virtual Memory)Operating System chapter 9 (Virtual Memory)
Operating System chapter 9 (Virtual Memory)
 

Ehcache3 — JSR-107 on steroids

  • 1. Ehcache 3 JSR-107 on Steroids alex snaps — principal software engineer at terracotta @alexsnaps
  • 2. A little about me • Introducing new bugs to the world for 30+ years • Coding in Java for 16+ years • Works at Terracotta for 6+ years • DSO, Ehcache, Quartz, … • OSS Contributor • Into API design, concurrency, distributed systems…
  • 3. A little of history [014] - Easy Hibernate Cache 0.5   by Greg Luck (http://freshmeat.net/users/gregrluck/)   Saturday, November 29th 2003 12:54 Software Development :: Libraries :: Java Libraries About: Easy Hibernate Cache is a fast and simple, pure Java, in-process cache, which acts as a pluggable cache for Hibernate 2.1. It has a small memory footprint, minimal dependencies, and full documentation. License: The Apache License
  • 4. A little of history • Terracotta founded in 2003, in San Francisco • Open sourced DSO in 2006 • Acquires Ehcache in Aug. 2009 • Releases Ehcache 2.0 Mar. 2010 • Software AG acquires Terracotta in 2011 • JSR-107 Final Mar. 2014 (13 years after the JSR review ballot!) • Work on Ehcache 3.0 begins…
  • 6. JSR 107 • Java Community Process driven standard • Specifies API and semantics for temporary, 
 in-memory caching of Java objects, including object creation, shared access, spooling, invalidation, and consistency across JVM's
  • 7. Caching • Data structure holding temporary copy of data • Trades memory usage for reduced latency • Targets: • Data which is reused • Data which is expensive to retrieve / compute • Keeps the data close(r) to the processing unit
  • 8. javax.cache API • CacheManagers managing … Caches ! • Expiry • Integration • Cache Entry Listeners • Entry Processors • Caching Annotations • Some Management
  • 9. CacheManager • Caching.getCachingProvider() static method • CachingProvider.getCacheManager() • CachingProvider • CacheManager repository • Identified by name & ClassLoader
  • 10. CacheManager • CacheManager • Manages Cache lifecycle: • Create & Destroy • Repository of (named) Cache instances • Manages Cache JMX (stats & management) • … is .unwrap()’ able
  • 11. Demo … showing off a couple of caveats!
  • 13. Tiered Storage • Very similar to Ehcache 2.x • Lowest & slowest tier is the “authority” • Higher & faster tiers effectively act as caches • Available today: • Heap, • Off-Heap, • Disk
  • 14. Store by value vs. by ref • JSR 107 “store modes” • “by value” (default), • “by reference” (optional) • What about “I don’t care” ? • Introducing Ehcache org.ehcache.spi.copy.Copier
  • 15. Custom Serialization • Defaults to Java Serialization for • JSR 107’s store-by-value • Storing data elsewhere than the heap • Introducing org.ehcache.spi.serialization.Serializer
  • 16. Proper Typing • Why is that important? • No one wants to catch ClassCastException • Application lifecycle! • Ehcache records the key & value types in all its stores! • But… there is a MutableConfiguration bug
  • 17. CacheLoader & -Writer • Ehcache’s CacheLoader/Writer API • Enables the Cache through pattern • Consistently across all Cache operations • Single CacheLoaderWriter interface • Throughput favoring Cache, not SoR
  • 18. WriteBehind • Scale out writes to your SoR • Batching and/or coalescing them • Even simpler than with Ehcache 2 • No more sizing gotcha!
  • 20. Expiry Policy • JSR 107’s ExpiryPolicy • No contextual information about the Expiry calculated • Works for simple expiry (Accessed, Created, Modified, …) • Introducing the org.ehcache.expiry.Expiry
  • 21. Eviction Prioritizer & Veto • Eviction not addressed by 107 at all • org.ehcache.config.EvictionPrioritizer • org.ehcache.config.EvictionVeto • Both are hints though!
  • 22. Transactions • Full blown XA Resource • including recovery support • Developed as a independent Ehcache module • Currently (still?) included in the main “distribution”
  • 23. Future … or a couple of days ago
  • 24. Automatic Resource Control • Size your on heap caches in natural units • n bytes • Percentage of the (maximal) available VM heap • Define “resource pools” shared across caches
  • 25. Clustering • Terracotta Server Array version 5.0 (work in progress) • Single stripe available as FOSS • Uses our offheap-store library • Passive fail-over • Ehcache’s consistency mode: • Strong • Eventual • Proper life cycle (finally!)
  • 26. Resilience Strategy • A cache is to be resilient • Yet… sh*t happens • Storage failures • SLA violations (timeouts?) • Very explicit contract at this time • To be refined when clustering is wrapping up
  • 27. … and moar! • Looking at Hibernate 2nd Level Cache (through 107!) • Advanced features to Spring (& Spring Boot) • … your ideas!?