Más contenido relacionado La actualidad más candente (20) Similar a ElastiCache & Redis: Database Week SF (20) Más de Amazon Web Services (20) ElastiCache & Redis: Database Week SF1. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon ElastiCache:
In-Memory Data Store for Use
as a Fast Database and Cache
Smitty Weygant
Solutions Architect
2. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Why ElastiCache?
ElastiCache Overview
ElastiCache Capabilities
ElastiCache Redis
ElastiCache Memcached
Common Usage Patterns
Customer Examples
Agenda
3. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Internet-scale Apps Need Low Latency and High Concurrency
Users 1M+
Data volume TB-PB-EB
Locality Global
Performance Milliseconds
-Microseconds
Request Rate Millions
Access Mobile, IoT,
Devices
Scale Up-Out-In
Economics Pay as you go
Developer access Instant API access
Gaming
leaderboards
Financial
trading
Social
media
Ride
hailing
Media
streaming
Dating Session
stores
4. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Developers Use Various Approaches to Reduce Latency
Specialized hardware such
as multi-core processors,
GPU’s, accelerators
In-memory databases
and data grids
Data reduction approaches
such as sampling,
aggregation
5. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Doesn’t Scale
Difficult to
Manage
Poor
Experience
Current Approaches Don’t Work
Expensive
Scalability limited
by data volumes
and regions
Specialized hardware
and software requires
learning new skills
Data reduction result in
poor customer
experience
Specialized hardware and
in-memory databases are
expensive
$
6. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Introducing Amazon ElastiCache
Fully-managed, Redis or Memcached compatible, low-latency, in-memory data store
Fully
Managed
Extreme
Performance
Easily
Scalable
AWS manages all
hardware and software
setup, configuration,
monitoring
In-memory data store and
cache for sub-millisecond
response times
Read scaling with
replicas. Write and memory
scaling with sharding.
Non disruptive scaling
7. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Key Features
Amazon ElastiCache
for Redis
8. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ElastiCache Redis
Fully Managed & Hardened
Secure & Compliant
AWS manages hardware, software, setup, configuration,
monitoring, failure recovery, and backups
VPC for cluster isolation, encryption at rest/transit,
HIPAA compliance
Highly Available & Reliable
Read replicas, multiple primaries, multi-AZ with
automatic failover
Easily Scalable
Cluster with up to 6.1 TiB of in-memory data
Read scaling with replicas
Write and memory scaling with sharding
Scale out or in
#1 Key-Value Store*
Fast in-memory data store in the cloud. Use as a database,
cache, message broker, queue
*: https://db-engines.com/en/ranking
9. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Redis—#1 Key-Value Data Store*
Fast
<1ms latency for most commands
Open source
Simple
Highly available
Replication
Atomic operations
Supports transactions
In-memory key-value
store
Powerful
~200 commands, Lua scripting,
Geospatial, Pub/Sub
Various data structures
Strings, lists, hashes, sets,
sorted sets, bitmaps,
and HyperLogLogs
*: https://db-engines.com/en/ranking
10. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Fully Managed & Hardened
Dynamic write
throttling
AWS manages all hardware
and software setup,
configuration, patching
Detailed monitoring
metrics,
CloudWatch integration
Smooth
failovers
Optimized
swap memory
11. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Secure & Compliant
• VPC
• Isolate cluster to chosen
IP range
• Encryption
• In-Transit: Encrypt all
communications between
clients, server, nodes
• At-Rest: Encrypt backups
on disk and in Amazon S3
• Support for Redis AUTH
• Fully managed: Setup
via API, CLI or console,
automatic certificate
issuance, renewal
• Compliance
• HIPAA Eligibility for
ElastiCache Redis 3.2.6
R R R
Availability Zone A Availability Zone B Availability Zone C
Private Subnet Private Subnet Private Subnet
Security Group Security Group Security Group
Security Group Security Group Security Group
Public Subnet Public Subnet Public Subnet
Encryption
at REST
Amazon S3
Bucket
Encryption In-Transit Redis AUTH
Redis RDB
Snapshot
R: Redis Cluster
12. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Highly Available & Reliable
• Read replicas for read
availability
• Multi-AZ with auto
failover
• Automatic failure detection
and replica promotion
• Repair failed nodes
• Redis cluster sharding
• Faster failover
• Availability due to
partitioning
Availability Zone B Availability Zone C
Redis Cluster
Availability Zone A
P
R
Slots 0–5454
Slots10910–16363
R
Slots 5455–10909
R
R
Slots 0–5454
Slots10910–16363
P
Slots 5455–10909
R
P
Slots 0–5454
Slots10910–16363
R
Slots 5455–10909
Shards, primaries, and read replicas
Example: 3 shard cluster,
2 read replicas
P: Primary
R: Replica
S: Shard
S S S
13. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Easily Scalable with Redis Cluster Mode
• Scale memory and
compute
• Scale up to a cluster of
6.1 TiB of in-memory data
• A cluster consists of 1 to
15 shards
• Each shard has a primary
node and up to 5 replica
nodes across multiple AZs
for read scaling
• Increase writes by adding
shards
Availability Zone B Availability Zone C
Redis Cluster
Availability Zone A
P
R
Slots 0–5454
Slots10910–16363
R
Slots 5455–10909
R
R
Slots 0–5454
Slots10910–16363
P
Slots 5455–10909
R
P
Slots 0–5454
Slots10910–16363
R
Slots 5455–10909
Shards, primaries, and read replicas
Example: 3 shard cluster,
2 read replicas
P: Primary
R: Replica
S: Shard
S S S
14. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Online Cluster Resizing—Zero Downtime
• Add or remove shards
to scale out/in
• Zero downtime—cluster
continues to serve
read/write requests
• No client side changes
or app rewrites
• Scale up to 6.1TB of
in-memory capacity
P
Shard 1
P
Shard 2
P
Shard 3
0–5461 5462–10922 10923–16383
Simple API
AWS elasticache modify-replication-group-shard-configuration –
replication-group-id re-group-id
--apply-immediately – node-groupd-count 5
P: Primary
15. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Online Cluster Resizing—Zero Downtime Scale
Out
P
Shard 1
P
Shard 2
P
Shard 3
0–5461 5462–10922 10923–16383
Amazon
EC2
No Application Interruption P
Shard 4
2910–5094,
9831––10922
P
Shard 5
5784–6875,
14200–16383
Reads/Writes
Added Added
Unified slot distribution across shards
0–2909,
5095–5461
5462–5783,
6876–9830
10923–14199
P: Primary
16. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Online Cluster Resizing—Zero Downtime Scale In
P
Shard 1
P
Shard 2
P
Shard 3
0–5461 5462–10922 10923–16383
Amazon
EC2
No Application Interruption P
Shard 4
2910–5094,
9831––10922
P
Shard 5
5784–6875,
14200–16383
Reads/Writes
Removed Removed
Unified slot distribution across shards
0–2909,
5095–5461
5462–5783,
6876–9830
10923–14199
P: Primary
17. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon ElastiCache
for Memcached
Key Features
18. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ElastiCache Memcached
Secure &
Hardened
Fully Managed
Memcached
Easily
Scalable
VPC for cluster
isolation
Fast in-memory data store
in the cloud. Use as a cache
to reduce latency and
improve throughput
Sharding to scale in-memory
cache with up to 20 nodes and
8.14 TiB per cluster
$
19. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Memcached—Fast Caching
Fast
Open source
No persistence
Very established
Easy to scale
In-memory
key-value datastore
Slab allocator
Supports strings, objects
Multi-threaded
20. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Common Usage
PatternsAmazon ElastiCache
21. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Usage Patterns
Gaming
leaderboards
Chat apps
PubSub
Caching
Session
store
Machine Learning
Real-time model scoring
Real-time
Analytics store
Media
streaming store
Job
queue
Geospatial
22. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Caching
23. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Real-time Analytics Store
24. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Gaming—Real-time Leaderboards
25. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Geospatial
26. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Media Streaming Store
27. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Session Store
28. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Chat Apps
29. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Job Queue
30. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Machine Learning (Real-time Model Scoring)
31. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Customers
Amazon ElastiCache
32. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
GE’s Predix Platform Powered by ElastiCache Redis
Using ElastiCache Redis with Open Service
Broker, Predix Platform from GE Digital allows
developers to easily create Redis clusters with
standard, pre-configured parameters, sizing
and network security.
Developers build container-based stateless
applications on AWS and ElastiCache is used to
manage session state for these applications.
The architecture makes is easy and simple for
developers to build applications.
Container
Runtime VPC
Control Plane
Data Plane
App
Server
Broker
ElastiCache
VPC
EC2
API
GE is the world’s largest digital industrial company.
We use [ElastiCache Redis] to make it super easy
and simple for developers to use Amazon services.
Amazon ElastiCache team implemented the Redis
AUTH feature in four regions in two months
enabling application level security.”
– Amulya Sharma
Senior Staff Software Engineer
GE Digital
“
33. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
BBC’s Nanoservices Architecture with ElastiCache
BBC is using the nanoservices pattern to
design for serverless, and to maximise
the potential of continuous delivery,
reusability, and flexibility.
BBC uses ElastiCache Redis to power the
nanoservices architecture. ElastiCache
Redis is used to achieve sub-millisecond
responses, not just in caching content,
but as a control (metadata store) and
communication (queue) layer.
The BBC has over 1,000 nanoservices in
production. Together, they create a range of
dynamic web pages, and also APIs for mobile and
TV apps. [BBC’s nanoservices architecture] is built
on an AWS-hosted platform that makes extensive
use of Amazon ElastiCache.”
– Matthew Clark
Head of Architecture, BBC
“
Content
cache
Metadata
store
Queue
Developer
Architecture
R
R
RNanoservice
Store
User
Data (APIs, etc.)
Nanoservice
platform
34. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Expedia’s Real-time Analytics with 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.
Expedia’s real-time analytics application
collects data for its “test & learn”
experiments on Expedia sites. The analytics
application processes ~200 million
messages daily.
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
“
Kinesis
Firehose
Real-time
streams of lodging
mark data
EC2
Redshift
Aurora
S3
Ingest
multiple data
streams
Join/
compare
events
ElastiCache
(Redis)
Reference data
on-premises
Historical queries on
up to 2 years of data
Staging near
real-time data
Operational queries
of real-time data
35. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Adobe API Platform Powered by ElastiCache Redis
Use Case: Data sharing across an
auto-scaling group of EC2 instances.
API request volume has grown from
1M/day to 21M/day in 7 months.
Re:invent talk:
https://www.youtube.com/watch?v=cEkHBqhQnog
We use ElastiCache Redis for shared
cache of our EC2 instances, with
high availability and low latency.”
–Frank Wiebe
Principal Scientist, Adobe
“
36. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Customers
37. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Learn about
Redis
ElastiCache for Redis | Memcached
Get started with ElastiCache
Reach out to your account team to learn more
Get started
38. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thank You!
https://aws.amazon.com/elasticache/
Amazon ElastiCache
39. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Appendix
Amazon ElastiCache
40. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Memcached vs. Redis
Simple Cache offload to database pressure and lower latency
Atomic counter support
Data Sharding (supported in Redis 3.X)
Need support for advanced datatypes such as Lists, Sets, Hashs
Multi-threaded Architecture (takes full advantage of all CPU cores)
Need ability to auto sort data to support Ranking or Leaderboards
Need Pub/Sub capabilities
High Availability and Failover
Persistence
Data volume max size 6.1 TiB 8.14 TiB
Max key/value size 512MB | 512MB 256 bytes | 1MB
41. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Scaling
Feature Cluster mode enabled
(Horizontal scaling)
Cluster mode disabled
(Vertical scaling)
Failover
15–30 sec
(Non-DNS)
~1.5min
(DNS-based)
Failover risk
Writes affected—partial dataset
(less risk with more partitions)
Reads available
Writes affected on entire data set
Reads available
Performance
Scales with cluster size
(100 nodes 15 primaries + 0–5
replicas per shard)
6 node
(1 primary + 0-5 replicas)
Max connections
Primaries: 65,000 x 15 = 975,000
Replicas: 65,000 x 75 = 4,875,000
Primaries: 65,000
Replicas: 65,000 x 5 = 325,000
Storage 6+ TiB 407 GB
Cost Smaller notes but more $$ Larger nodes less $
Example
Assume workload
needs 175 GB
9 x cache.r3.xlarge ($0.455hr) = $4.095hr
255GB
1 x cache.r3.8xlarge = $3.640hr
237GB
R
R
R
R
R
R
Configuration
Endpoint
Primary
Endpoint
Slot 0
Slot 1 …
Slot 16383
Slot 0–5461
Slot 5462–10922
Slot 10923–
16383
42. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IGA Works Uses RDS+ElastiCache to Power
Real-Time App Monetization
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.
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
“
43. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ElastiCache Powers Careem’s Ride Hailing App
Careem is a popular ride hailing app in
Middle East.
Average response time of the API layer is
<32ms, mandating an in-memory layer
for performance.
Careem uses ElastiCache Redis to power their
ride hailing app with sub-millisecond geo
lookups to match drivers and riders.
ElastiCache is helping Careem with reliability,
performance, and developer productivity.
[Using ElastiCache Redis] We were able to
increase the frequency of pings to 4 per minute
(every 15s) which improved our ETAs and
customer experience. Average time to match
reduced from 2 minutes to 15 seconds and we
saved on developer’s time by 25%.”
–Tafseer ul Islam Siddiqui
Chief Software Architect, Careem
“
44. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Magazine Luiza Has Built a “Second Screen
Experience” with RDS+ElastiCache
Magazine Luiza is one of the largest
retailers in Brazil, 700+ stores and 36
million customers.
Application: “Second Screen Experience”
during the world cup in Brazil for enhancing
viewing and personalized ads based on
real-time game score.
Database load spikes significantly
during games.
We use ElastiCache for caching database objects and
session data… without ElastiCache, we experienced
latency and all instances on that Availability Zone
started to get unhealthy.”
–Thiago Catoto
IT Manager, Magazine Luiza
“
45. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
RDS and ElastiCache are Behind Grab’s
Taxi-Booking App
Grab is a popular taxi hailing app in
southeast Asia.
Average response time of the API layer is
<40ms, mandating an in-memory layer to
achieve such performance.
A small devops team that tried running
Redis on EC2 before, but that was too much
work. Using both RDS and ElastiCache in
Multi-AZ allowed them to outsource all the
management to AWS.
The latency of a cab call must be low, and remain
low even in times of peak traffic of hundreds of
thousands of cab requests per minute. We use
ElastiCache for Redis in front of RDS MySQL to keep
our systems’ real time performance at any scale.”
–Ryan Ooi
Sr. Devops Engineer, Grab
“
46. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Rede Globo (Media)
• Rede Globo is the second
largest TV network in
the world.
• Rede 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.