Professional Documents
Culture Documents
DAT208 - Supercharge Your Real-Time Apps With Amazon ElastiCache
DAT208 - Supercharge Your Real-Time Apps With Amazon ElastiCache
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What to expect
1 2 3
Hear Understand Plan
about what real time Internals on how how you would
applications need Amazon leverage this by
from a data store, ElastiCache appreciating how
what Amazon achieves Extreme Lyft and others use
ElastiCache provides Performance @ this to super charge
and the new features scale their applications
we launched
Purpose-built databases
1 million+
TB
Global
Microseconds
Millions
Mobile, IoT, devices
Up-down-out-in
Pay as you go
Open Redis API
About Redis
Fast In-memory
<1 ms latency for most commands
key-value store
Open source
Powerful
~200 commands, Lua scripting,
Simple geospatial, and pub/sub
No persistence Multi-threaded
Fully compatible with In-memory data store Network isolation, Scale writes and
open-source Redis and cache for microsecond encryption at rest/transit, reads with sharding
and Memcached response times HIPAA, PCI, FedRAMP, multi and replicas
AZ, and automatic failover
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Extreme performance
170 TB
250,000
in-memory capacity
Nitro
200,000
hardware
150,000
100,000
bare metal
50,000
0
Scalable
Large X Large 2X Large 4X Large 8X Large/12X 16X Large/24X
Large Large
Vanilla R4 Vanilla R5 Tuned R5
Redis has single thread architecture
Simplicity
No race conditions, no synchronizations
Easy to understand and extend
Easy to support rich functionality
Share-nothing architecture—scale by sharding.
Improves cache coherency
Redis connection processing: sequential
Redis port
Client 1 Client I/O 1 Redis
command
Redis server
Redis connection processing: sequential
Redis port
Client 2 Client 1 Client I/O 2 Client I/O 1 Redis
command
Redis server
Redis connection processing: sequential
Redis port
Client 3 Client 2 Client 1 Client I/O 3 Client I/O 2 Client I/O 1 Redis
command
Redis server
Redis connection processing: parallel
Redis port
Dedicated thread
Client I/O 1
Client 1
Main Redis thread
Redis server
Redis connection processing: parallel
Dedicated thread
Client I/O 2
Client 2
Redis port
Dedicated thread
Client I/O 1
Client 1
Main Redis thread
Redis server
Redis connection processing: parallel
Dedicated thread
Client I/O 3
Client 3
Dedicated thread
Client I/O 2
Client 2
Redis port
Dedicated thread
Client I/O 1
Client 1
Main Redis thread
Redis server
Optimized instances + enhanced I/O
Scale up to 170 TB of
in-memory capacity
450,000
AWS Nitro
400,000 hardware
350,000
300,000
250,000
bare metal
200,000
0 Dynamic network
X Large 2X Large 4X Large 8X Large/12X Large 16X Large/24X Large processing to enhance
Vanilla R4 Vanilla R5 Tuned R5 (non enhanced I/O) Tuned R5 (enhanced I/O) input/output (I/O)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Easily scalable
Keyspace
disabled Slot 1 …
Vertical scaling
Slot 16383
1 Primary 0…n replicas
Horizontally scaled
Cluster mode Slot 0-5461
Keyspace
enabled
Slot 5462-10922
Horizontal scaling
Slot 10923-16383
0…n replicas
1…n Primaries or shards
Redis cluster mode
Configuration
endpoint
Reads/writes
App 1
Reads/writes
App 1
No downtime scale out: Amazon ElastiCache
No application interruption P P
No downtime scale in: Amazon ElastiCache
No application interruption P P
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Caching
Challenge
Retrieving data from disk-based databases
and applications is slow. Workarounds such
as specialized hardware, proprietary in-
memory databases, and data reduction are
expensive, have high lock-in, don’t scale,
and are difficult to manage
Solution
Use Redis, an open source, in-memory data
store and cache, to store frequently used
data in-memory for microsecond latency
and high throughput
Use cases
Database query caching, persistent session
caching, and full-web page caching
Session store
Challenge
Need low latency and high
concurrency data stores to process
fast moving ephemeral session data
such as authentication tokens,
cookies, and session state
Solution
Use Redis as an in-memory key-value
store and cache with appropriate key
expiration strategies to store and
manage ephemeral session data for
microsecond responses
Apps
Web and mobile apps
Real-time streaming & analytics store
Challenge
Need a fast data store to
process fast moving streaming
data in real-time
Solution
Use Redis as an in-memory
data store with versatile data
structures such as streams, lists,
and sets to ingest, process, and
analyze real-time data with
sub-millisecond latency
Apps
Social media, ad targeting,
personalization, IoT, and
time-series data analytics
Geospatial apps
Challenge
Need low latency and high
concurrency data stores to process
fast moving location data in
real-time
Solution
Use Redis as an in-memory data
store with purpose-built data
structures such as sorted sets,
encoding/decoding of location
data, and APIs for location-specific
indexing, searching, and sorting
Apps
Ride-hailing, dating, social media,
gaming, eCommerce
Leaderboards
Challenge
Leaderboards need low latency and
high concurrency data stores to
process changing scores and update
ranks in real-time
Solution
Use Redis as an in-memory data
store with data structures such as
sorted sets and ranked lists that
ensure uniqueness of elements while
maintaining lists sorted by scores
with microsecond
Apps
Gaming leaderboards,
sales leaderboards
Chat & messaging
Challenge
Chat & messaging apps requires a
low latency and high throughput
communication channel over which a
client can send messages that are
redistributed to other participants
Solution
Use Redis as an in-memory store and
cache with Redis Streams and
PUB/SUB features to build high
performance chat & messaging apps
Apps
Chat rooms, comment streams,
machine to machine communication
ElastiCache for Redis customers
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Locations, locations, locations
5 sec
loop
PUT /v1/locations
{
"lat": 37.61,
"lng": -122.38
}
?
200 OK
low latency
Twemproxy
Prefix routing
Consistency
Fully managed locations clusters
geohash -> [user_id]
2. Data validation
localhost:6380
3. Reverse shadow
traffic
4. Remove old cluster
Learnings
Fully managed Scalability Security & compliance OSS compatibility Extreme performance
Self service online Scale up/down Rename Command Redis 5.0.3 Enhanced I/O
migration from ec2
Reader endpoints Customer Managed Redis 5.0.4 T3 Instance Support
Self-service Master Key support
Maintenance updates Memcached 1.5.16
Auth Token Rotation
Redis 5.0.5
Coming soon…
AWS Identity
and Access
Management
Related Amazon ElastiCache Sessions
Session Type Title Time Location
DAT323-R What’s new with Amazon ElastiCache: We have been hard at 2019-12-04 13:00 Mirage, Events Center B2 Red
work this year. In this session, you’ll learn Online Migration
Breakout Tool, performance enhancement like Enhanced I/O, Security
like Customer Master Key, and scalability like Online Scaling
DAT323-R1 up/down cluster-mode), and more 2019-12-05 16:00 Aria, Level 3 West, Ironwood 5
MGM, Level 3,
DAT349-R Chalk talk Beyond Caching: Advanced design patterns in Redis 2019-12-03 17:30
Redis is the "Swiss Army knife" of distributed apps. In this session
South Concourse 301
we will go through use-cases, and demos of how to solve
Chalk talk
DAT349-R1 problems like managing state, processing events and more. 2019-12-05 11:30 Aria, Level 1 East, Joshua 3
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.