22

Caching in the Cloud. Code Camp Iași April 2016

Embed Size (px)

Citation preview

Cloud editionCachingRADU PINTILIELIVIU MAZILU

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

CODECAMPChallenges in distributed applicationsSQL Azure FederationHDInsightDocumentDBAzure Search

Previous subjects

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

What are we going to discussCaching fundamentalsAzure and cachingRedisPatternsCase Scenarios

Caching: Cloud edition

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

Why would we cache?Decrease load on databaseStore data close to the applicationSpeed up data accessScale-out applications

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

What is expected of a cache?Caching fundamentals

- Key/value CRUD - Store any entity type (no special attributes) - LRU / absolute / sliding evictions- Concurrent access - Cache per application (multitenant)

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

Nice to have featuresCaching fundamentals

- Bulk operations - Enumeration and queries - Clustering and replication for high-availability - Change notifications - Transactions - Data persistence

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

Caching in AzureApp-FabricIn-Role CacheManaged Cache serviceAzure Redis Cache

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

RedisOpen sourceKey-value cache and storeIn-memorySingle-threaded (atomic operations)Server, can do master/slaveKnows as: data structure server

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

FeaturesStores entities, lists, and sets Item eviction (LRU, absolute, and sliding) Item locking Atomic transactions for groups of commands Bulk operations

REDIS

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

KeysBinary safeShould not be very long or very shortShould stick to a pattern for keys:

users:1:posts posts:10:tags

Db:Tags

REDIS

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

Data typesStringSetListSorted setHash+bitmap, hyperloglog

REDIS

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

Eviction policiesnoevictionallkeys-lruvolatile-lruallkeys-randomvolatile-randomvolatile-ttl

REDIS

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

Additional featuresLua scriptingCache can be persisted periodically(RDB) or consistently(AOF)Built-in Pub/Sub messagingSharding/partitioning

REDIS

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

Azure Redis CacheFully managed service (PaaS)Guaranteed SLAProvides SSLVertically scalable: changing tiersHorizontally scalable: adding shardsVirtual networks

REDIS

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

PatternsOn Demand / Cache AsideBackground Data PushCircuit Breaker

CACHING

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

Demos topicsStack Overflow tagsCache asideAutocompleteLua script usage

REDIS

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

SCENARIOSAzure hosted applicationsMulti-level caching

output cachesession state

precomputed dataHybrid applicationsHigh performance, scalable environments

USE CASE

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

What we discussedCaching fundamentalsAzure and cachingRedisPatternsScenarios

Caching: Cloud edition

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

Questions

?

April 23, 2016Caching: Cloud edition

© EXPERT NETWORK

THANK YOU