Terracotta Ehcache : Simpler, faster, distributed

Post on 08-Jan-2017

159 views 1 download

Transcript of Terracotta Ehcache : Simpler, faster, distributed

© 2016 Software AG. All rights reserved. For internal use only

TERRACOTTA EHCACHE: SIMPLER, FASTER, DISTRIBUTEDDEVOXX BELGIUM NOVEMBER 9TH 2016 ANTHONY DAHANNE @ANTHONYDAHANNE

�Anthony Dahanne, Software Engineer @ Terracotta, a Software AG company

�Working on the Terracotta Management Console, and its integration in Terracotta products

�And strong Docker supporter :-P , trying to containerize as much as I can !

LET ME INTRODUCE MYSELF

�Come visit us at Booth #1 ! Oculus Rift to win !!!

AGENDA

Caching 101

Caching on the JVM

Clustered Caching with Terracotta Server

Deployment examples

CACHING 101

CACHE DEFINITION

“Store of things that will be required in the future,

and can be retrieved rapidly.”from wiktionary.com

A Map (key / value mappings) with capacity control (via eviction) and freshness control (via expiry)

WHERE IS CACHING USED ?

from ArsTechnica

LATENCIES TO REMEMBERL1 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

Round trip within same datacenter 500,000 ns 500 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 CachingCPU Caching

Application CachingDisk 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

CACHING ON THE JVM

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

EHCACHE

First Release

2003

Terracotta 5

2016

TERRACOTTA

Ehcache3

2016

2009

Ehcache acquisition

Public Release

2014

EHCACHE REBOOT : EHCACHE3

• 3.0 (May 2016) • Compatible with JSR 107 (javax.cache) • User managed cache • Copiers & Serializers • Strong typing

• 3.1 (Jun 2016) • Clustered tier added

• 3.2 (2 days ago) • High Availability with Terracotta Server

CACHING PATTERNS

• No Caching • Cache aside

• Cache through

• Demo !

Business logic

CacheGET(K)

PUT(K,V)

NULL

LOAD(K)

V

SoRK,V

K,V

Business logic Cache

GET(K) LOAD(K)

V

PUT(K,V)

K,VSoRK,VV

CLUSTERED CACHING WITH TERRACOTTA SERVER

TERRACOTTA SERVER RESOURCES

from ehcache.org documentation

MULTI CONTAINER DEPLOYMENT

PostgreSQL

Terracotta Server

Webapp with Ehcache3 Clustered

Webapp with Ehcache3 Clustered

Webapp with Ehcache3 Clustered

DEPLOYMENT EXAMPLES

App Server

App ServerApp Server

DEPLOYMENT

App ServerApp Server

Ehcache

App ServerJBOSS SOA-PApp Server

Ehcache

Layer 7

“Presentation Zone” “Application Zone”Individual & Families

Issuers

3rd Parties (B2B)

187K simultaneous users / 6K processes requests/s 10’s of Terracotta Servers / 100’s of caching clients

LINKS AND REFERENCES

• The essence of caching, by Greg Luck (available on youtube)

• Caching 101: Caching on the JVM (and beyond) by Louis Jacomet & Aurelien Broszniowski (available on youtube)

• Ehcache3 documentation (available on ehcache.org)

• Ehcache3 and Terracotta Server demos (available on github)

© 2016 Software AG. All rights reserved. For internal use only23