26
CACHING Oldie but Goldie Raluca Breaur 20th of April 2013

Iasi codecamp 20 april 2013 Caching - oldie but goldie - Raluca Breaur

Embed Size (px)

Citation preview

CACHING

Oldie but Goldie

Raluca Breaur

20th of April 2013

Cache

Source

of

data

Advantages

“There are only two hard things

in Computer Science:

cache invalidation

and naming things.” Phil Karlton

Eviction

Stale data strategy

Time to live

Time to idle

Eviction algorithms

LFU – Least Frequently Used

LRU – Least Recently Used

FIFO

Levels of cache

Loading

HIT

CACHE SOURCE

OF

DATA

MISS

CACHE SOURCE

OF

DATA

Cache performance - Statistics

Hits

Misses

Size

Average GetTime

Eviction Count

Common Data Patterns

Locality Hot Set Data

changes

Catalog

(Countries)

Low

Low

Low

Inventory

(Stocks)

High

High

High

Conversation

(Shopping Cart)

High

High

Low

Caches around us

Browser cache

Use cache control headers: max age, no cache

Database

• Persistence Layer – JPA – 2 layers of cache

High computation

Service – Spring 3.1 Cache Abstraction

JCache

Web Service / 3rd party

Multiple clients - Standalone Cache Server

Service – Spring 3.1 Cache Abstraction/JCache

Cache Providers - JCACHE

java.util.Map GUAVA caches

Questions