SlideShare a Scribd company logo
1 of 37
Download to read offline
JCache
(JSR107)
David Brimley
The standard for Java Caching
Who is this guy?
Senior Solutions Architect @ Hazelcast
Java Developer for 17 years
@dbrimley
In Memory Data Grids for 8 years
Worked for Investment Banks
Started out coding Basic on a Commodore Vic-20
My fav computer was my old BBC Model B
Long suffering Spurs fan.
HSBC, Nomura, Credit Suisse, BZW, RBoS
Oracle Coherence 4 Years
Pivotal Gemfire 4 Years
David Brimley
Runs HUGL (Hazelcast User Group London)
Low latency trading systems
What we’ll cover…
• Why Caching?
• Introduction to JCache.
• Using Caches.
• Entry Processors.
• Listeners.
• Annotations.
• Missing Bits.
• Questions.
Who uses caching?

Quick Show of hands
Why Caching?
Why Caching?
The Speed Factor (Memory .v. Disk)
L1 cache reference 0.5 ns
Branch mispredict 5.0 ns
L2 cache reference 7.0 ns
Mutex lock/unlock 25.00 ns
Main memory reference 100.00 ns
Compress 1k bytes with ZupZ 3,000.00 ns
Send 1k bytes over 1Gpbs network 10,000.00 ns 0.01 ms
Read 4k randomly from SSD 150,000.00 ns 0.15 ms
Read 1 MB sequentially from memory 250,000.00 ns 0.25 ms
Round trip within same datacenter 500,000.00 ns 0.50 ms
Read 1 MB sequentially from SSD 1,000,000.00 ns 1.00 ms
Disk seek 10,000,000.00 ns 10.00 ms
Read 1 MB sequentially from disk 20,000,000.00 ns 20.00 ms
Send packet CA->Netherlands->CA 150,000,000.00 ns 150.00 ms
https://gist.github.com/jboner/2841832
Why Caching?
Graph of Memory Prices Decreasing with Time (1957-2014)
http://www.jcmit.com/mem2014.htm
The Cost Factor
Why Caching?
Lots of Use Cases
Slow Database
HTTP Proxy
Browser
Persistence Framework
Disk
Application
Hard to scale Database
Lots of Cache Types
Local Cache
Data Grid
Document Store
JPA Second Level
JPA First Level
Introduction to
JCache
Introduction to JCache
• Caching for the Java Platform

• Produced via the JCP / JSR107

• Ratified March 2014

• 10 years in the making.

• Works with SDK.

• Spec Leads: Greg Luck, Brian Oliver
java.util.Map (Java 6/7)
Key-Value Based API
Supports Atomic Updates
Entries Don’t Expire
Entries Aren’t Evicted
Entries Stored On-Heap
Store-By-Reference
https://gist.github.com/jboner/2841832
Introduction to JCache
Map .v. Cache
javax.cache.Cache (Java 6)
Key-Value Based API
Supports Atomic Updates
Entries May Expire
Entries May Be Evicted
Entries Stored Anyware (ie: topologies)
Store-By-Value and Store-By-Reference
Supports Integration (ie: Loaders/Writers)
Supports Observation (ie: Listeners
Entry Processors
Statistics
JCache makes NO

assumptions about
topology.



Single Process or
Distributed
Introduction to JCache
Introduction to JCache
• JCP Project

http://jcp.org/en/jsr/detail?id=107

• Source Code

https://github.com/jsr107

• Forum

https://groups.google.com/forum/?
fromgroups#!forum/jsr107

JSR107 TCK Compliant Vendors
Introduction to JCache
https://jcp.org/aboutJava/communityprocess/implementations/jsr107/index.html
I pity the fool that claims
to support JCache without
TCK compliance
As of 5th March 2015
Introduction to JCache
Something to remember when comparing vendors of
distributed caches…
Do NOT Benchmark
with a single
instance!
Using Caches
Using Caches
<dependency>

<groupId>javax.cache</groupId>

<artifactId>cache-api</artifactId>

<version>1.0.0</version>

</dependency>
Maven Central
Using Caches
Classes
Caching

“service loader”

CachingProvider

“SPI Implementation”

CacheManager

“manager of caches”

Cache

“interface to a Cache”

Using Caches
Classes
Code Walkthrough
Entry Processors
Entry Processors
Compute in place
• Atomic Operations in situ of data.
• Eliminate Round-Trips (if distributed)
• Lock Free
• Needs Serialisation (if distributed)
Application Application
Cache Cache
Entry Processors
Classes
Code Walkthrough
Listeners
Listeners
Callbacks for events in Cache
• Follows Observer Pattern

• Interface per event type

• Created, Updated, Removed, Expired

• Iterations of Events passed back

• MutableCacheEntryListenerConfiguration
Listeners
Classes
Code Walkthrough
Cache Loaders /
Writers
Cache Loaders / Writer
Cache Misses / Cache Persist
Application
Cache
Backing Store
Cache Loaders / Writer
Classes
Code Walkthrough
Annotations
Annotations
Spring 4.1, Guice, CDI
• @CacheResult

• @CachePut

• @CacheRemove

• @CacheRemoveAll


Annotations
Classes
Code Walkthrough
Missing Bits
Missing Bits
The Future of JCache
• Async API

• Query

• JEE 8

• Servlet 4.0 (Session Cache)

• Java 8 Lang Features (Lambda/Streams)
Questions ?
HAZELCAST
• Free London Training
• Hazelcast User Group
• Visit our Booth

Visit our Booth

5th Floor



Get Free Training (Canary Wharf, Thursday 12th March)

http://hazelcast.com/events/

Join the Hazelcast User Group London (HUGL)

http://www.meetup.com/Hazelcast-User-Group-London-HUGL/
Download Hazelcast, the leading open source IMDG
http://www.hazelcast.org
THANK YOU.
@dbrimley
david@hazelcast.com

More Related Content

What's hot

Using MySQL in Automated Testing
Using MySQL in Automated TestingUsing MySQL in Automated Testing
Using MySQL in Automated Testing
Morgan Tocker
 
Optimizing MySQL for Cascade Server
Optimizing MySQL for Cascade ServerOptimizing MySQL for Cascade Server
Optimizing MySQL for Cascade Server
hannonhill
 
Barcelona mysqlnd qc
Barcelona mysqlnd qcBarcelona mysqlnd qc
Barcelona mysqlnd qc
Anis Berejeb
 
MySQL: From Single Instance to Big Data
MySQL: From Single Instance to Big DataMySQL: From Single Instance to Big Data
MySQL: From Single Instance to Big Data
Morgan Tocker
 
Caching: A Guided Tour - 10/12/2010
Caching: A Guided Tour - 10/12/2010Caching: A Guided Tour - 10/12/2010
Caching: A Guided Tour - 10/12/2010
Jason Ragsdale
 

What's hot (20)

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
 
Using MySQL in Automated Testing
Using MySQL in Automated TestingUsing MySQL in Automated Testing
Using MySQL in Automated Testing
 
Web session replication with Hazelcast
Web session replication with HazelcastWeb session replication with Hazelcast
Web session replication with Hazelcast
 
Hazelcast
HazelcastHazelcast
Hazelcast
 
Optimizing MySQL for Cascade Server
Optimizing MySQL for Cascade ServerOptimizing MySQL for Cascade Server
Optimizing MySQL for Cascade Server
 
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...
 
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
 
Understanding MySql locking issues
Understanding MySql locking issuesUnderstanding MySql locking issues
Understanding MySql locking issues
 
Barcelona mysqlnd qc
Barcelona mysqlnd qcBarcelona mysqlnd qc
Barcelona mysqlnd qc
 
MySQL Server Defaults
MySQL Server DefaultsMySQL Server Defaults
MySQL Server Defaults
 
MySQL Rebuild using Logical Backups
MySQL Rebuild using Logical Backups MySQL Rebuild using Logical Backups
MySQL Rebuild using Logical Backups
 
MySQL Usability Guidelines
MySQL Usability GuidelinesMySQL Usability Guidelines
MySQL Usability Guidelines
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance Tuning
 
Caching in asp.net mvc
Caching in asp.net mvcCaching in asp.net mvc
Caching in asp.net mvc
 
MySQL NoSQL APIs
MySQL NoSQL APIsMySQL NoSQL APIs
MySQL NoSQL APIs
 
Supercharge JavaEE applications using JCache
Supercharge JavaEE applications using JCacheSupercharge JavaEE applications using JCache
Supercharge JavaEE applications using JCache
 
Postgres on OpenStack
Postgres on OpenStackPostgres on OpenStack
Postgres on OpenStack
 
MySQL: From Single Instance to Big Data
MySQL: From Single Instance to Big DataMySQL: From Single Instance to Big Data
MySQL: From Single Instance to Big Data
 
Caching: A Guided Tour - 10/12/2010
Caching: A Guided Tour - 10/12/2010Caching: A Guided Tour - 10/12/2010
Caching: A Guided Tour - 10/12/2010
 
Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability
 

Similar to JCache (JSR107) - QCon London 2015 & JBCNConf Barcelona 2015

Playframework + Twitter Bootstrap
Playframework + Twitter BootstrapPlayframework + Twitter Bootstrap
Playframework + Twitter Bootstrap
Kevingo Tsai
 
Java EE 6, Eclipse, GlassFish @EclipseCon 2010
Java EE 6, Eclipse, GlassFish @EclipseCon 2010Java EE 6, Eclipse, GlassFish @EclipseCon 2010
Java EE 6, Eclipse, GlassFish @EclipseCon 2010
Ludovic Champenois
 
Java EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseConJava EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseCon
Ludovic Champenois
 
T4T Training day - NodeJS
T4T Training day - NodeJST4T Training day - NodeJS
T4T Training day - NodeJS
Tim Sommer
 

Similar to JCache (JSR107) - QCon London 2015 & JBCNConf Barcelona 2015 (20)

In-memory No SQL- GIDS2014
In-memory No SQL- GIDS2014In-memory No SQL- GIDS2014
In-memory No SQL- GIDS2014
 
What to expect from Java 9
What to expect from Java 9What to expect from Java 9
What to expect from Java 9
 
Nodejs - Should Ruby Developers Care?
Nodejs - Should Ruby Developers Care?Nodejs - Should Ruby Developers Care?
Nodejs - Should Ruby Developers Care?
 
Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...
Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...
Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...
 
Playframework + Twitter Bootstrap
Playframework + Twitter BootstrapPlayframework + Twitter Bootstrap
Playframework + Twitter Bootstrap
 
Java EE 7 Soup to Nuts at JavaOne 2014
Java EE 7 Soup to Nuts at JavaOne 2014Java EE 7 Soup to Nuts at JavaOne 2014
Java EE 7 Soup to Nuts at JavaOne 2014
 
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
 
Codemotion 2015 Infinispan Tech lab
Codemotion 2015 Infinispan Tech labCodemotion 2015 Infinispan Tech lab
Codemotion 2015 Infinispan Tech lab
 
Programming in HTML5 With Java Script and CSS3
Programming in HTML5 With Java Script and CSS3Programming in HTML5 With Java Script and CSS3
Programming in HTML5 With Java Script and CSS3
 
Setting up a free open source java e-commerce website
Setting up a free open source java e-commerce websiteSetting up a free open source java e-commerce website
Setting up a free open source java e-commerce website
 
GlassFish and JavaEE, Today and Future
GlassFish and JavaEE, Today and FutureGlassFish and JavaEE, Today and Future
GlassFish and JavaEE, Today and Future
 
Breathing new life into JSP with OSGi? Why!!! - R Auge
Breathing new life into JSP with OSGi? Why!!! - R AugeBreathing new life into JSP with OSGi? Why!!! - R Auge
Breathing new life into JSP with OSGi? Why!!! - R Auge
 
Java EE 6, Eclipse, GlassFish @EclipseCon 2010
Java EE 6, Eclipse, GlassFish @EclipseCon 2010Java EE 6, Eclipse, GlassFish @EclipseCon 2010
Java EE 6, Eclipse, GlassFish @EclipseCon 2010
 
Play 2 Java Framework with TDD
Play 2 Java Framework with TDDPlay 2 Java Framework with TDD
Play 2 Java Framework with TDD
 
Play2 Java
Play2 JavaPlay2 Java
Play2 Java
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
 
Java EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseConJava EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseCon
 
Tools Coverage for the Java EE Platform @ Silicon Valley Code Camp 2010
Tools Coverage for the Java EE Platform @ Silicon Valley Code Camp 2010Tools Coverage for the Java EE Platform @ Silicon Valley Code Camp 2010
Tools Coverage for the Java EE Platform @ Silicon Valley Code Camp 2010
 
Play Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewPlay Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level Overview
 
T4T Training day - NodeJS
T4T Training day - NodeJST4T Training day - NodeJS
T4T Training day - NodeJS
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

JCache (JSR107) - QCon London 2015 & JBCNConf Barcelona 2015