azure redis cache - cache on steroids!

21
AZURE REDIS CACHE Cache on Steroids!

Upload: francois-boucher

Post on 16-Jan-2017

113 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Azure Redis Cache - Cache on Steroids!

AZURE REDIS CACHE Cache on Steroids!

Page 2: Azure Redis Cache - Cache on Steroids!

ABOUT ME

Page 3: Azure Redis Cache - Cache on Steroids!

AGENDA• Redis Cache Introduction• Azure Redis• Demo - Sample Application• Data Types• Queue Pattern• Pub / Sub• Azure Scalability (Tiers)

Page 4: Azure Redis Cache - Cache on Steroids!
Page 5: Azure Redis Cache - Cache on Steroids!

REDIS DEFINITION

Redis is an open source, (BSD licensed), in-memory data structure store, used as database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, and geospatial indexes with radius queries.

REDIS - REmote DIctionary Server

Redis.io

Page 6: Azure Redis Cache - Cache on Steroids!

WHO USES REDIS?

Page 7: Azure Redis Cache - Cache on Steroids!

COMMON REDIS USAGES• Show latest items in home page • Leaderboards • Counting Stuff - Page Hits • Session State , Output Cache• Unique Visitors • Caching

Page 8: Azure Redis Cache - Cache on Steroids!

CREATE YOUR FIRST REDIS CACHE

Page 9: Azure Redis Cache - Cache on Steroids!

REDIS - DATA TYPES• String - key value

• Lists - list of string, sorted by insertion order

• Hashes - map between string fields and string values

• Sets - unordered collection of strings

• Sorted Set - similar to sets but each entry has an associated “score”

Page 10: Azure Redis Cache - Cache on Steroids!

SAMPLE APPLICATION -TWEETER• Tweets

• Timeline

• Accounts

• Account Statistics

• Followers

• Following

• Favorite Hashtagsby Marc Dugas

Page 11: Azure Redis Cache - Cache on Steroids!

Features• Can store any kind of data (JPEG images, serialized JSON)• Maximum size 512MB

Operations• INCR, DECR, INCRBY, APPEND, EXPIRE

Uses• Counters (Hits), Rate Limiter (API)

key value

STRING DATA TYPE

Page 12: Azure Redis Cache - Cache on Steroids!

key

9

numberoffollowers

tweetcount 843

HASH DATA TYPEFeatures• Map between string fields and string value• 4 billion fields per hash

Operations• HGET, HSET, HINCRBY

Uses• Statistics for Entity (ex: Number of Followers)

Page 13: Azure Redis Cache - Cache on Steroids!

d a bc

LIST DATA TYPEFeatures• List of strings sorted by insertion order• Can add to head or tail• 4 billion elements per list• Very fast access to items from head/tail

Operations• LPUSH, RPUSH, LRANGE, LTRIM, LPOP, RPOP

Uses• Timeline

Page 14: Azure Redis Cache - Cache on Steroids!

ae

c

bd

f

SET DATA TYPEFeatures• Unordered collection of strings, no repeating members• Add/Remove and test for existing extremely quick• 4 billion elements per set• Union and Intersection between sets

Operations• SADD, SREM, SUNION, SINTER

Uses• Common Followers

Page 15: Azure Redis Cache - Cache on Steroids!

Features• Similar to Set → no repeating members• Each member is associated with a score that is used to order the set

Operations• ZADD, ZRANGE, ZRANK

Uses• Leaderboards

c

9

a

3

b

-1

member

score

SORTED SET DATA TYPE

Page 16: Azure Redis Cache - Cache on Steroids!

background workers

waitinglist

processinglist

producer

QUEUE PATTERN

Approach• Leverage the Redis List Commands to create a distributed queuing mechanism

Operations• Enqueue LPUSH (add to waitinglist)• Dequeue RPOPLPUSH (RPOP from waitinglist, LPUSH on processinglist)• Post Processing LREM (remove from processinglist )

Page 17: Azure Redis Cache - Cache on Steroids!

Features• Implementation of the Publish/Subscribe paradigm• Messages are “published” into channels (no knowledge of subscribers)• Subscribers express interest in channel and receive messages from that channel

Operations• PUBLISH , SUBSCRIBE, UNSUBSCRIBE

Uses• Real time applications, SignalR Scaleoutpublish

er

channel

subscribers

PUBLISH/SUBSCRIBE PATTERN

Page 18: Azure Redis Cache - Cache on Steroids!

REDIS COMMANDS

• Console in Azure Portal• Redis command line tools

redis.io/commands

Page 19: Azure Redis Cache - Cache on Steroids!

METRICS

Page 20: Azure Redis Cache - Cache on Steroids!

Tier Pricing Tier

Node(s) Size MBPS Request per second

SLA

Basic

C0 - C6 1 node

250MB - 53GB 5 - 2,000 600 - 150,000

Standard

2 nodes Primary/Secondary

Premium P1 - P4 1 - 1000 node(s) 6GB - 53GB 2,000 - 4,000 140,000 - 250,000

AZURE REDIS

Premium Tier• Faster hardware• Higher throughput, lower latencies• Persistence• Cluster

Page 21: Azure Redis Cache - Cache on Steroids!

WHAT’S NEXT? Azure Redis Cache - azure.microsoft.com/en-us/services/cache Redis Cache - redis.io

Twitter: @fboucheros Blog:frankysnotes.com Blog (FR): cloudenfrancais.com