Amazon ElastiCache
AWSIn-Memory DataStore
Dan Zamansky
Senior Product Manager
Time : 11:30 – 12:00
Amazon ElastiCache
AGENDA
• Why In-Memory?
• ElastiCache
• Understanding Key Features
• Redis - Common Use Cases
Why In-Memory?
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
Businesses Need To Be Ready For Success!
What is ElastiCache?
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
In-Memory Key-Value Store
High-performance
Redis and Memcached
Fully managed; Zero admin
Hardened by Amazon
Amazon
ElastiCache
Fully managed service = Automated Operations
Redis/Memcached Datastore hosted on Amazon EC2 Amazon ElastiCache
Amazon
RDS
Request Rate
High Low
Cost/GB
High Low
Latency
Low High
Data Volume
Low High
Amazon
Glacier
Amazon
CloudSearch
Structure
Low
High
Amazon
DynamoDB
Amazon
ElastiCache
Memcached
Slab allocator
In-memory key-value datastore
very popular as a caching solution
Supports strings, objects
Multi-threaded
Insanely fast!
Very established
No persistence
Patterns for sharding
Redis – the in-memory king
Powerful
~200 commands
In-memory key-value datastore
Supports data types
strings, lists, hashes, sets, sorted sets,
bitmaps & HyperLogLogs
Single-threaded
Atomic operations
supports transactions
has ACID properties
Ridiculously fast!
<1ms latency for most commands
Read replicas
Persistence
snapshots or append-only log
Pub/sub functionality
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
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.
Mitigating Swap During Redis Fork
Primary
Availability Zone A Availability Zone B
Replica
Replica
writes
Use 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
ElastiCache
Automates
snapshots for
persistence
ElastiCache with Redis Multi-AZ
Region
Availability Zone A Availability Zone B
Auto Scaling group
ElastiCache cluster
ElastiCache with Redis Multi-AZ
Region
Availability Zone A Availability Zone B
Auto Scaling group
ElastiCache cluster
ElastiCache with Redis Multi-AZ
Region
Availability Zone A Availability Zone B
Auto Scaling group
ElastiCache cluster
ElastiCache with Redis Multi-AZ
Region
Availability Zone A Availability Zone B
Auto Scaling group
ElastiCache cluster
Mitigating Replica Flushing – Enhanced Engine
Master Replicas
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
What apps can ElastiCache power?
We Run The Most Demanding Real-Time Workloads
Thousands of Customers Implementing Large Scale Caching, Leaderboards,
Session Management, Messaging, Queuing and more
Gaming AdTech Media Mobile Other
Let’s Talk Redis. Key Use Cases
Use Case #1 - Caching
Elastic Load
Balancing
EC2 App
Instances
RDS MySQL
DB Instance
ElastiCache
Database Writes
App
Reads
Clients
Cache
Updates
Database Reads
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
Adding Caching to Your Application is Easy
Common Caching Technique #1 – Lazy Caching:
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 Baek
VP 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
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 Chowhan
Engineering 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
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
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.
Use Case 3 - Chat and Messaging
• PUBLISH and SUBSCRIBE Redis commands
• Game or Mobile chat, real-time comment streams
• Server intercommunication
SUBSCRIBE chat_channel:114
PUBLISH chat_channel:114 "Hello all"
>> ["message", "chat_channel:114", "Hello all"]
UNSUBSCRIBE chat_channel:114
• 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:likes
HSET item:38927:ratings "Susan" 1
INCR item:38927:dislikes
HSET item:38927:ratings "Tommy" -1
• 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 + ":” + time
count = GET(keyname)
IF current != NULL && count > limit THEN
ERROR ”API request limit exceeded"
ELSE
MULTI
INCR(keyname)
EXPIRE(keyname,10)
EXEC
PERFORM_API_CALL()
END
Use Case 5 - Rate Limiting
• 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
Thank You

Amazon ElastiCache (Dan Zamansky) - AWS DB Day

  • 1.
    Amazon ElastiCache AWSIn-Memory DataStore DanZamansky Senior Product Manager Time : 11:30 – 12:00
  • 2.
    Amazon ElastiCache AGENDA • WhyIn-Memory? • ElastiCache • Understanding Key Features • Redis - Common Use Cases
  • 3.
  • 4.
    Modern Applications RequireReal-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
  • 5.
    Businesses Need ToBe Ready For Success!
  • 6.
  • 7.
    Amazon RDS Amazon DynamoDBAmazon 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
  • 8.
    In-Memory Key-Value Store High-performance Redisand Memcached Fully managed; Zero admin Hardened by Amazon Amazon ElastiCache
  • 9.
    Fully managed service= Automated Operations Redis/Memcached Datastore hosted on Amazon EC2 Amazon ElastiCache
  • 10.
    Amazon RDS Request Rate High Low Cost/GB HighLow Latency Low High Data Volume Low High Amazon Glacier Amazon CloudSearch Structure Low High Amazon DynamoDB Amazon ElastiCache
  • 11.
    Memcached Slab allocator In-memory key-valuedatastore very popular as a caching solution Supports strings, objects Multi-threaded Insanely fast! Very established No persistence Patterns for sharding
  • 12.
    Redis – thein-memory king Powerful ~200 commands In-memory key-value datastore Supports data types strings, lists, hashes, sets, sorted sets, bitmaps & HyperLogLogs Single-threaded Atomic operations supports transactions has ACID properties Ridiculously fast! <1ms latency for most commands Read replicas Persistence snapshots or append-only log Pub/sub functionality
  • 13.
    Amazon ElastiCache Redis Multi-AZ Easy Monitoringvia 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
  • 14.
    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.
  • 15.
  • 16.
    Primary Availability Zone AAvailability Zone B Replica Replica writes Use 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 ElastiCache Automates snapshots for persistence
  • 17.
    ElastiCache with RedisMulti-AZ Region Availability Zone A Availability Zone B Auto Scaling group ElastiCache cluster
  • 18.
    ElastiCache with RedisMulti-AZ Region Availability Zone A Availability Zone B Auto Scaling group ElastiCache cluster
  • 19.
    ElastiCache with RedisMulti-AZ Region Availability Zone A Availability Zone B Auto Scaling group ElastiCache cluster
  • 20.
    ElastiCache with RedisMulti-AZ Region Availability Zone A Availability Zone B Auto Scaling group ElastiCache cluster
  • 21.
    Mitigating Replica Flushing– Enhanced Engine Master Replicas
  • 23.
    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
  • 24.
    What apps canElastiCache power?
  • 25.
    We Run TheMost Demanding Real-Time Workloads Thousands of Customers Implementing Large Scale Caching, Leaderboards, Session Management, Messaging, Queuing and more Gaming AdTech Media Mobile Other
  • 26.
    Let’s Talk Redis.Key Use Cases
  • 27.
    Use Case #1- Caching Elastic Load Balancing EC2 App Instances RDS MySQL DB Instance ElastiCache Database Writes App Reads Clients Cache Updates Database Reads
  • 28.
    Amazon ElastiCache Eliminate database hotspots PredictablePerformance Cut Load on Backend Increase Read Throughput Reduce App Latency Caching Will Make Your Database More Efficient Reduce Database Cost
  • 29.
    Adding Caching toYour Application is Easy Common Caching Technique #1 – Lazy Caching:
  • 30.
    IGA Works UsesElastiCache 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 Baek VP 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
  • 31.
    Expedia’s Real-time AnalyticsApplication 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 Chowhan Engineering 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
  • 32.
    Not if I destroy itfirst! 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
  • 33.
    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.
  • 34.
    Use Case 3- Chat and Messaging • PUBLISH and SUBSCRIBE Redis commands • Game or Mobile chat, real-time comment streams • Server intercommunication SUBSCRIBE chat_channel:114 PUBLISH chat_channel:114 "Hello all" >> ["message", "chat_channel:114", "Hello all"] UNSUBSCRIBE chat_channel:114
  • 35.
    • Popular forrecommendation 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:likes HSET item:38927:ratings "Susan" 1 INCR item:38927:dislikes HSET item:38927:ratings "Tommy" -1
  • 36.
    • Ex: Throttlingrequests 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 + ":” + time count = GET(keyname) IF current != NULL && count > limit THEN ERROR ”API request limit exceeded" ELSE MULTI INCR(keyname) EXPIRE(keyname,10) EXEC PERFORM_API_CALL() END Use Case 5 - Rate Limiting
  • 37.
    • Redis isa 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
  • 38.