+ All Categories
Home > Technology > Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Date post: 10-Feb-2017
Category:
Upload: amazon-web-services-korea
View: 624 times
Download: 4 times
Share this document with a friend
38
Amazon ElastiCache AWS In-Memory Data Store Dan Zamansky Senior Product Manager Time : 11:30 12:00
Transcript
Page 1: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Amazon ElastiCacheAWS In-Memory Data Store

Dan Zamansky

Senior Product Manager

Time : 11:30 – 12:00

Page 2: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Amazon ElastiCache

AGENDA

• Why In-Memory?

• ElastiCache

• Understanding Key Features

• Redis - Common Use Cases

Page 3: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Why In-Memory?

Page 4: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Modern Applications Require Real-Time Performance

• We live in a connected world (IoT)• Phones, Tablets, Cars, Air Conditioners, Toasters

• Experiences are increasingly contextual

• Apps need to provide real-time responses

• Database performance is frequently the bottleneck

• Load is spikey and unpredictable

Page 5: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Businesses Need To Be Ready For Success!

Page 6: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

What is ElastiCache?

Page 7: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Amazon RDS

Amazon DynamoDB Amazon Redshift

Amazon ElastiCache

Compute Storage

AWS Global Infrastructure

Database

Application Services

Deployment & Administration

Networking

AWS Database Services

High Performance In-Memory Key-

Value Store in the Cloud

Page 8: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

In-Memory Key-Value Store

High-performance

Redis and Memcached

Fully managed; Zero admin

Hardened by AmazonAmazon

ElastiCache

Page 9: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Fully managed service = Automated Operations

Redis/Memcached Datastore hosted on Amazon EC2 Amazon ElastiCache

Page 10: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

AmazonRDS

Request RateHigh Low

Cost/GBHigh Low

LatencyLow High

Data VolumeLow High

AmazonGlacier

AmazonCloudSearch

Struct

ure

Low

High

AmazonDynamoDB

AmazonElastiCache

Page 11: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Memcached

Slab allocator

In-memory key-value datastorevery popular as a caching solution

Supports strings, objects

Multi-threaded

Insanely fast!

Very established

No persistence

Patterns for sharding

Page 12: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Redis – the in-memory king

Powerful ~200 commands

In-memory key-value datastore

Supports data typesstrings, lists, hashes, sets, sorted sets, bitmaps & HyperLogLogs

Single-threaded

Atomic operationssupports transactionshas ACID properties

Ridiculously fast!<1ms latency for most commands

Read replicas

Persistencesnapshots or append-only log

Pub/sub functionality

Page 13: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Amazon ElastiCache

Redis Multi-AZ

Easy Monitoring via CloudWatch

Fully Managed

Enhanced Redis Engine

Easy to Deploy & Use

ElastiCache vs. Self-Managed Redis

No Cross-AZ Data Transfer Costs

Engineered For Cloud Scale

Page 14: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Amazon ElastiCache

Enhanced Redis Engine – Hardened by Amazon

RDB Without Fork

• Mitigate the risk of increased swap

usage during syncs and snapshots.

Dynamic write throttling

• To improve output buffer

management when the node’s

memory is close to being exhausted

Smoother failovers

• Clusters recover faster as replicas will

avoid flushing their data to do a full

re-sync with the primary.

Page 15: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Mitigating Swap During Redis Fork

Page 16: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Prim

ary

Availability Zone A Availability Zone B

Replic

a

Replic

a

writesUse Primary Endpoint

reads

Use Read Replicas

Auto-Failover

Chooses replica with lowest replication lag

DNS endpoint is same

ElastiCache for Redis Multi-AZ

ElastiCache for Redis

ElastiCache for Redis

ElastiCache for Redis

Automatic Failover to a read replica in case of primary node failure

ElastiCacheAutomatessnapshots for persistence

Page 17: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

ElastiCache with Redis Multi-AZ

Region

Availability Zone A Availability Zone B

Auto Scaling group

ElastiCache cluster

Page 18: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

ElastiCache with Redis Multi-AZ

Region

Availability Zone A Availability Zone B

Auto Scaling group

ElastiCache cluster

Page 19: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

ElastiCache with Redis Multi-AZ

Region

Availability Zone A Availability Zone B

Auto Scaling group

ElastiCache cluster

Page 20: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

ElastiCache with Redis Multi-AZ

Region

Availability Zone A Availability Zone B

Auto Scaling group

ElastiCache cluster

Page 21: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Mitigating Replica Flushing – Enhanced Engine

Master Replicas

Page 22: Amazon ElastiCache (Dan Zamansky) - AWS DB Day
Page 23: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Alarms

Monitoring with CloudWatch

• Easily Accessible via the ElastiCache console

• Track health of your nodes

• Set alarms to act when need to address running into limitations

Page 24: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

What apps can ElastiCache power?

Page 25: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

We Run The Most Demanding Real-Time WorkloadsThousands of Customers Implementing Large Scale Caching, Leaderboards,

Session Management, Messaging, Queuing and more

Gaming AdTech Media Mobile Other

Page 26: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Let’s Talk Redis. Key Use Cases

Page 27: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Use Case #1 - Caching

Elastic LoadBalancing

EC2 App Instances

RDS MySQL DB Instance

ElastiCache

Database Writes

App Reads

ClientsCacheUpdates

Database Reads

Page 28: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Amazon ElastiCache

Eliminate database hotspots

Predictable Performance

Cut Load on Backend

Increase Read Throughput

Reduce App Latency

Caching Will Make Your Database More Efficient

Reduce Database Cost

Page 29: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Adding Caching to Your Application is Easy

Common Caching Technique #1 – Lazy Caching:

Page 30: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

IGA Works Uses ElastiCache to Power Real-Time App Monetization

By using RDS we saved on operations

cost for our relational databases. Using

ElastiCache we could boost the read

performance of RDS and offload the

massive request rate

Jeongsang BaekVP Engineering, IGA Works

“• IGA Works is Korea’s leading mobile business platform

• Adpopcorn is an ad monetization platform for mobile applications

that supports 130 million devices

• Storing Ad Inventory in ElastiCache in front of RDS guaranteed real-

time ad bidding and serving, while RDS provides the durable

database layer

Page 31: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Expedia’s Real-time Analytics Application Uses Amazon ElastiCache

Expedia is a leader in the $1 trillion travel industry, with an extensive portfolio that includes some of the world’s most trusted travel brands.

With ElastiCache Redis as caching

layer, the write throughput on

DynamoDB has been set to 3500,

down from 35000, reducing the cost

by 6x.

Kuldeep ChowhanEngineering Manager, Expedia

“ • Expedia’s real-time analytics application collects data for its “test &

learn” experiments on Expedia sites.

• The analytics application processes ~200 million messages daily.

• Re:invent talk: https://www.youtube.com/watch?v=ie4dWGT76LM

Page 32: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Not if I destroy it first!

It’s mine!

• Very popular for gaming apps

• Need uniqueness + ordering

• Easy with Redis Sorted Sets

ZADD "leaderboard" 1201 "Gollum”

ZADD "leaderboard" 963 "Sauron"

ZADD "leaderboard" 1092 "Bilbo"

ZADD "leaderboard" 1383 "Frodo”

ZREVRANGE "leaderboard" 0 -1

1) "Frodo"

2) "Gollum"

3) "Bilbo"

4) "Sauron”

ZREVRANK "leaderboard" "Sauron"

(integer) 3

Use Case 2 - Real-time Leaderboard

Page 33: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

TV Globo (Media)

• Rede Globo is the second largest TV network in the

world.

• TV Globo used ElastiCache Redis for second screen

application during the World Cup in Brazil in 2014.

• ElastiCache was used for caching and leaderboards.

• Massive spikes in usage during games and peak

events.

Page 34: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Use Case 3 - Chat and Messaging

• PUBLISH and SUBSCRIBE Redis commands

• Game or Mobile chat, real-time comment streams

• Server intercommunication

SUBSCRIBE chat_channel:114PUBLISH chat_channel:114 "Hello all">> ["message", "chat_channel:114", "Hello all"]UNSUBSCRIBE chat_channel:114

Page 35: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

• Popular for recommendation engines and message board ranking

• Redis counters – increment likes/dislikes

• Redis hashes – list of everyone’s ratings

• Process with algorithm like Slope One or Jaccardian similarity

• Ruby example - https://github.com/davidcelis/recommendable

Use Case 4 – Ratings

INCR item:38927:likesHSET item:38927:ratings "Susan" 1

INCR item:38927:dislikesHSET item:38927:ratings "Tommy" -1

Page 36: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

• Ex: Throttling requests to an API

• Leverages Redis Counters

ELB

Externally Facing A

PI

Reference: http://redis.io/commands/INCR

FUNCTION LIMIT_API_CALL(APIaccesskey)limit = HGET(APIaccesskey, “limit”)time = CURRENT_UNIX_TIME()keyname = APIaccesskey + ":” + timecount = GET(keyname)IF current != NULL && count > limit THEN

ERROR ”API request limit exceeded"ELSE

MULTIINCR(keyname)EXPIRE(keyname,10)

EXECPERFORM_API_CALL()

END

Use Case 5 - Rate Limiting

Page 37: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

• Redis is a powerful in-memory data structure server that allows you to easily build high performance apps

• ElastiCache provides the hardened, secure, highly-available, and performant platform to run in-memory data stores in the cloud

Recap

Page 38: Amazon ElastiCache (Dan Zamansky) - AWS DB Day

Thank You


Recommended