SlideShare une entreprise Scribd logo
1  sur  40
©	2018,	Amazon	Web	Services,	Inc.	or	its	Affiliates.	All	rights	reserved
Pop-up Loft
Building High Performance Apps with In-Memory Data
Mikhail Prudnikov
prudniko@amazon.com
Sr Solutions Architect
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
In-memory key-value store supporting
• Redis 3.2.10
• Memcached 1.4.34
High-performance
Fully managed; zero admin
Highly available and reliable
Hardened by Amazon
Amazon
ElastiCache
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Powerful
~200 commands + Lua scripting
In-memory data structure server
Utility data structures
Strings, lists, hashes, sets, sorted sets,
bitmaps & HyperLogLogs
Simple
Atomic operations
supports transactions
Ridiculously fast!
<1ms latency for most commands
Highly available
replication
Persistence
Open source
Redis overview
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
S5
S1
S2
S4 S3
Client
§ 16384 hash slots per cluster
§ Slot for a key is CRC16(key) mod 16384
§ Slots are distributed across the cluster into shards
§ Developers must use a Redis cluster aware client
§ Clients are redirected to the correct shard
§ Smart clients store a map
Shard S1 = slots 0–3276
Shard S2 = slots 3277–6553
Shard S3 = slots 6554–9829
Shard S4 = slots 9830–13106
Shard S5 = slots 13107–16383
Redis cluster: automatic client-side sharding
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
reads/
writes
reads
AZ1
AZ2
reads
search
reads
search
clients
c a c h e c l u s t e r
r e l a t i o n a l
d a t a
Healthy
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
reads/
writes
reads
AZ1
AZ2
reads
search
reads
search
clients
c a c h e c l u s t e r
r e l a t i o n a l
d a t a
Heavy
pressure
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Lambda
3 Shards
…
var params = {
ApplyImmediately: true,
NodeGroupCount: 5,
ReplicationGroupId: ‘rep-group-id’,
… }
elasticache.modifyReplicationGroupShardConfiguration(params, function(err, data) {
if (err) console.log(err, err.stack);
else console.log(data);
}); …
5 Shards
MEMORY
HIGH!
Amazon
CloudWatch
Cluster Resized
AWS SNS
Online Re-Sharding—CW alarm triggered
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
reads/
writes
reads
AZ1
AZ2
reads
search
reads
search
c a c h e c l u s t e r
clients
r e l a t i o n a l
d a t a
Healthy—
auto scaled
out
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Session
management
Database caching APIs
(HTTP responses)
IOT
Streaming data
analytics
(Filtering/aggregation)
Pub/sub
Social media
(Sentiment analysis)
Standalone
database
(Metadata store)
Leaderboards
Usage Patterns
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Caching
Clients
Amazon
ElastiCache
Redis
Amazon
DynamoDB
Elastic Load
Balancing
Amazon
EC2
Amazon
RDS
write-through
reads/
writes
DDB streams
mysql.lambda_async
reads/
writes
Amazon
S3
reads/writes
Object data
Unstructured data
Relational data
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Caching NoSQL
Amazon
EC2 reads/
writes
reads
MongoDB
Cluster
Cassandra
Cluster
ü Smaller NoSQL DB clusters needed = lower costs
ü Faster data retrieval = better performance
Elasticsearch
Cluster
Clients
Amazon
EC2
reads/
writes
Amazon
ElastiCache
Redis
reads
MongoDB
Cluster
DBObject doc = collection.findOne();
Cache serialized DBObject in Redis (good)
Cache rows in Redis hash (faster/more efficient)
Cassandra
Cluster
Amazon
ElastiCache
Redis
Amazon
EC2
reads/
writes
reads
ResultSet rs = session.execute(stmt);
Cache serialized ResultSet in Redis (good)
Cache rows in Redis hash (faster/more efficient)
ü Smaller NoSQL DB clusters needed = lower costs
ü Faster data retrieval = better performance
Caching NoSQL databases with Amazon ElastiCache
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon
Kinesis
Analytics
Amazon
Kinesis
Streams
Amazon
Kinesis
Streams
Amazon
ElastiCache
(Redis)
cleansed
stream
Streaming data enrichment/processing
Datasources
raw
stream
Subscribers
AWS Lambda function 1
Continual data
filtering/enrichment
Real-time
pub/sub
AWS Lambda function 2
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Big data architectures using Redis
Amazon Kinesis
DataSources
AWS Lambda
Apache Storm
on EMR
Spark Streaming
on Amazon EMR
Amazon
Kinesis app
Amazon
EC2
AWS IoT
Amazon
ElastiCache
Collect
Store
Process
Amazon
S3
Apache Kafka
AWS
Lambda
Custom
app
Spark on
Amazon
EMR
Analyze
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Rules Engine
Amazon
ElastiCache
Redis
AWS
Lambda
Direct integration
LambdaSNS SQS
S3 KinesisDDB
AWS
IoT devices
AWS
IoT
Sensor store
IoT powered by ElastiCache
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Mobile apps powered by ElastiCache
Amazon API
Gateway
AWS
Lambda
Amazon
ElastiCache
Redis
GEOADD
GEORADIUS
Search points of interest
Update points of interest
https://aws.amazon.com/blogs/database/amazon-elasticache-utilizing-redis-geospatial-capabilities/
Amazon
DynamoDB
DDB streams
Amazon
EC2
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Ad tech powered by ElastiCache
Clients
Advertisers
https://aws.amazon.com/caching/database-caching/
Ad network
Ad slot
Consumer
Ad slot
publishers
Ad placement
(websites/apps)
Amazon
ElastiCache
Redis
<40 ms
Clickstream
(shopping
events)
User visits
page
Publisher
places ad slot
for auction
Ad network
calls for bidsBidders respond
with bids
Winners bid
ad displayed
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Chat apps powered by ElastiCache
https://aws.amazon.com/blogs/database/amazon-elasticache-utilizing-redis-geospatial-capabilities/
Clients
Chat apps
Application Load
Balancer
WebSockets
Amazon
ElastiCache
Redis
PubSub
Serverpersistent
connections
Elastic
Beanstalk
SUBSCRIBE chat_channel:114
PUBLISH chat_channel:114 "Hello all"
>> ["message", "chat_channel:114", "Hello all"]
UNSUBSCRIBE chat_channel:114
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• Very popular for gaming apps that need
uniqueness and 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
Gaming—real-time leaderboards
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Ex: throttling requests to an API
uses Redis counters
ELB
Externally
facing API
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
Rate limiting
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What data should I cache?
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• R e f e r e n c e d a t a : p r o d u c t c a t e g o r i e s ( u s e r l o n g e r T T L s )
• R e f e r e n c e d a t a : p r o d u c t i m a g e s ( u s e r l o n g e r T T L s )
• R e f e r e n c e d a t a : p r o d u c t d e t a i l s ( u s e r l o n g e r T T L s )
• D y n a m i c : d a t a b a s e r e s u l t s e t s : ( u s e r s h o r t e r T T L s )
• D y n a m i c : A P I r e s p o n s e s ( u s e r s h o r t e r T T L s )
• A n y t h i n g t h a t i s c a c h e a b l e !
What data to cache
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How do I cache my data?
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Cache-aside—lazy loading
Cache-aside—lazy loading
Amazon
ElastiCache
Applications
Amazon
RDS
1
2
3
1) Check cache, if HIT return
2) If Cache MISS
3) Update cache
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Cache-aside—write-through
Cache-aside—write-through
Amazon
ElastiCache
Applications
Amazon
RDS
1
2
1) Update primary DB
2) Update cache
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Cache strategies
DB result set
Pro
When data retrieval logic is abstracted from the code consuming the ResultSet, caching the ROW can
be extremely effective and can be implemented against any RDBMS
Con
Data retrieval still requires extracting values from the ROW and does not further simplify data access, it
only reduces data-retrieval latency
SELECT * FROM x WHERE y
ID First_Name Last_Name City
123 Michael Labib Chicago
ResultSet object (ROW) Key: query, value: CRS as byte array
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Cache strategies
JSON
SELECT * FROM x WHERE y
ID First_Name Last_Name City
123 Michael Labib Chicago
Key: 123, Value: ‘{ “firstname”: “Michael”,
“lastname”: “Labib”,
“city”: “Chicago” } ‘
String firstName = rs.getString(First_Name)
Pro
Very easy to implement. Cache any desired database fields and values into a Redis string. For example,
store your retrieved data into a JSON object stored in a Redis string.
Con
Cannot get individual JSON properties
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Cache strategies
Application objects
SELECT * FROM x WHERE y
ID First_Name Last_Name City
123 Michael Labib Chicago
Key: CUSTOMER_ID:123,
Value: Customer object as byte array
String firstName = rs.getString(First_Name);
customer.setFirstName(firstName);
String lastName = rs.getString(Last_Name);
customer.setLastName(lastName);
Pro
Use application objects in their native structure and data state when serialized
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Cache strategies
Using Redis data structures
SELECT * FROM x WHERE y
ID First_Name Last_Name City
123 Michael Labib Chicago
Key: CUSTOMER_ID:123, Value: rsHash
String firstName = rs.getString(First_Name);
rsHash.put(“firstName", firstName);
String lastName = rs.getString(Last_Name);
rsHash.put(“lastName", lastName);
jedis.hmset(“CUSTOMER_ID:123", rsHash);
Pro
In addition to reducing data retrieval latency, cache data into specific data structure that simplifies the
data access pattern
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• Understand the frequency of change of underlying data
• Set appropriate TTLs on keys that match that frequency
• Choose appropriate eviction policies that are aligned with application requirements
• Isolate your cluster by purpose (for example, cache cluster, queue, standalone database, and so on)
• Maintain cache freshness with write-throughs
• Performance test and size your cluster appropriately
• Monitor Cache HIT/MISS ratio and alarm on poor performance
• Use failover API to test application resiliency
Caching tips
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Cluster sizing best practices
• Storage—clusters should have adequate memory
• Recommended: memory needed + 25% reserved memory (for Redis) + some room for growth
(optional 10%)
• Optimize using eviction policies and TTLs
• Scale up or out before reaching max-memory using CloudWatch alarms
• Use memory optimized nodes for cost effectiveness (R4 support)
• Performance—performance should not be compromised
• Benchmark operations using Redis Benchmark tool
• For more READIOPS—add replicas
• For more WRITEIOPS—add shards (scale out)
• For more network IO—use network optimized instances and scale out
• Use pipelining for bulk reads/writes
• Consider Big(O) time complexity for data structure commands
• Cluster isolation (apps sharing key space)—choose a strategy that works for your workload
• Identify what kind of isolation is needed based on the workload and environment
• Isolation: No Isolation $ | Isolation by Purpose $$ | Full Isolation $$$
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Redis benchmark tool
Open source utility to benchmark performance
example: src/redis-benchmark -h r3-xlarge-perf.foio87.0001.use1.cache.amazonaws.com -p 6379 -n -150000 -d 100
Syntax:
redis-benchmark -h <host> -p <port> -c 50 -n 1000 -d 500 –q
-c <clients>—Specifies the number of parallel connections (default 50).
-n <requests>—Specifies the number of requests (default 1000000).
-d <size>—Specifies the data size of GET and SET values in bytes.
-t <test1,test2>—Comma-separated list of tests to perform.
-q—Quiet operation, displays only the result.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Redis max-memory policies
Select a max-memory policy based on your workload needs
• noeviction: return errors when the memory limit has been reached and the client is trying to execute
commands that might result in more memory to be used
• allkeys-lru: evict keys trying to remove the less recently used (LRU) keys first
• volatile-lru: evict keys trying to remove the less recently used (LRU) keys first, but only among keys
that have an expire set
• allkeys-random: evict random keys to make space for the new data added
• volatile-random: evict random keys to make space for the new data added, but only evict keys with an
expire set
• volatile-ttl: evict only keys with an expire set, and try to evict keys with a shorter time to live (TTL) first
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Key ElastiCache CloudWatch metrics
• CPUUtilization
• Memcached—up to 90% ok
• Redis—divide by cores (ex: 90% / 4 = 22.5%)
• SwapUsage low
• CacheMisses/CacheHits Ratio low/stable
• Evictions near zero
• Exception: Russian-doll caching
• CurrConnections stable
• Setup alarms with CloudWatch metrics
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ElastiCache modifiable parameters
• Maxclients: 65000 (unchangeable)
• Use connection pooling
• timeout—closes a connection after it has been idle for a given interval
• tcp-keepalive—detects dead peers given an interval
• Databases: 16 (default) for non-clustered mode
• Logical partition
• Reserved-memory: 25% (default)
• Recommended
§ 50% of maxmemory to use before 2.8.22
§ 25% after 2.8.22—ElastiCache
• Maxmemory-policy:
• The eviction policy for keys when maximum memory usage is reached
• Possible values: volatile-lru, allkeys-lru, volatile-random, allkeys-random, volatile-ttl,
noeviction
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What we’re building
Availability Zone #1
REINVENT-RDS-SG
Test
Instance
VPC: REINVENT 10.0.0.0/16
Public1:
10.0.0.0/24
Private1: 10.0.2.0/24
REINVENT-EC-SG
REINVENT-APP-SG
APACHE HTTP SERVER
REDIS 3.2 CLIENT
JMETER 3.2
JUNIT 4 TEST APP
JAVA 1.8.0
Test
Instance
SSH,
HTTP
Performance testing lab—infrastructure
topology
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Workshop: JMeter and JUnit tests overview
RDSLoad:testRDSLoad() (This executes only one time)
1. Drops database CustomerDB if it exists, referencing SQL stored in DropCustomerDB
2. Creates database CustomerDB, referencing SQL stored in CreateCustomerDB
3. Creates table customer, referencing SQL stored in CreateCustomerTbl
4. Loads 1000 customer records stored in CUSTOMER.sql
RedisLoad:testRedisLoad() (This executes only one time)
1. Flushes all the data in the Redis Cluster to prepare it
2. Queries the customer database table for the total count of customer records, referencing SQL stored in
CountCustomerTbl
3. Iterates over the total count and queries for each row, referencing SQL stored in SelectCustomerTbl
4. Stores each SQL ResultSet row into a Redis HashMap with the key name being the SQL statement for
that individual customer query
Data loading
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Workshop: JMeter and JUnit tests overview
Stress testing: 20k requests/second
RDSBenchmark:testRDS()
1. Randomly selects a customer row to retrieve from customer IDs 1–1000
2. Retrieves the SELECT SQL STATEMENT and appends the random customer ID integer referencing SQL stored in
SelectCustomerTbl
3. Executes SQL statement and iterates/displays the fetched row
RedisBenchmark:testRedis()
1. Randomly selects a customer hashmap to retrieve from customer IDs 1–1000
2. Retrieves the SELECT SQL STATEMENT and appends the random customer ID integer referencing SQL stored in
SelectCustomerTbl
3. Executes Redis HASHMAP HGETALL command to retrieve/display the fetched hash
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Workshop: JMeter and JUnit tests overview
//Generating a random num 1-1000 representing customer ids
randomKey = Integer.toString(rand.nextInt(1000));
//Retrieving Customer Select SQL Statement & appending customer id
sql = query + randomKey;
stmt = connection.createStatement();
//executing query
rs = stmt.executeQuery(sql);
//iterating and displaying results
while( rs.next() ) { …
//Generating a random num 1-1000 representing customer ids
randomKey = Integer.toString(rand.nextInt(1000));
//Retrieving Customer Select SQL Statement & appending customer id
key = query + randomKey;
//executing command
map = jedis.hgetAll(key);
//iterating and displaying results
for (String name : map.keySet() ) { …
©	2018,	Amazon	Web	Services,	Inc.	or	its	Affiliates.	All	rights	reserved
Pop-up Loft
aws.amazon.com/activate
Everything and Anything Startups
Need to Get Started on AWS

Contenu connexe

Tendances

DAT324_Expedia Flies with DynamoDB Lightning Fast Stream Processing for Trave...
DAT324_Expedia Flies with DynamoDB Lightning Fast Stream Processing for Trave...DAT324_Expedia Flies with DynamoDB Lightning Fast Stream Processing for Trave...
DAT324_Expedia Flies with DynamoDB Lightning Fast Stream Processing for Trave...Amazon Web Services
 
Data Transformation Patterns in AWS - AWS Online Tech Talks
Data Transformation Patterns in AWS - AWS Online Tech TalksData Transformation Patterns in AWS - AWS Online Tech Talks
Data Transformation Patterns in AWS - AWS Online Tech TalksAmazon Web Services
 
Data Warehousing with Amazon Redshift
Data Warehousing with Amazon RedshiftData Warehousing with Amazon Redshift
Data Warehousing with Amazon RedshiftAmazon Web Services
 
10 Hacks for Optimizing MySQL in the Cloud - AWS Online Tech Talks
10 Hacks for Optimizing MySQL in the Cloud - AWS Online Tech Talks10 Hacks for Optimizing MySQL in the Cloud - AWS Online Tech Talks
10 Hacks for Optimizing MySQL in the Cloud - AWS Online Tech TalksAmazon Web Services
 
Build on Amazon Aurora with MySQL Compatibility (DAT348-R4) - AWS re:Invent 2018
Build on Amazon Aurora with MySQL Compatibility (DAT348-R4) - AWS re:Invent 2018Build on Amazon Aurora with MySQL Compatibility (DAT348-R4) - AWS re:Invent 2018
Build on Amazon Aurora with MySQL Compatibility (DAT348-R4) - AWS re:Invent 2018Amazon Web Services
 
ElastiCache Deep Dive: Design Patterns for In-Memory Data Stores (DAT302-R1) ...
ElastiCache Deep Dive: Design Patterns for In-Memory Data Stores (DAT302-R1) ...ElastiCache Deep Dive: Design Patterns for In-Memory Data Stores (DAT302-R1) ...
ElastiCache Deep Dive: Design Patterns for In-Memory Data Stores (DAT302-R1) ...Amazon Web Services
 
Best Practices for Migrating Oracle Databases to the Cloud - AWS Online Tech ...
Best Practices for Migrating Oracle Databases to the Cloud - AWS Online Tech ...Best Practices for Migrating Oracle Databases to the Cloud - AWS Online Tech ...
Best Practices for Migrating Oracle Databases to the Cloud - AWS Online Tech ...Amazon Web Services
 
Data Warehousing and Data Lake Analytics, Together - AWS Online Tech Talks
Data Warehousing and Data Lake Analytics, Together - AWS Online Tech TalksData Warehousing and Data Lake Analytics, Together - AWS Online Tech Talks
Data Warehousing and Data Lake Analytics, Together - AWS Online Tech TalksAmazon Web Services
 
How Amazon.com Uses AWS Analytics
How Amazon.com Uses AWS AnalyticsHow Amazon.com Uses AWS Analytics
How Amazon.com Uses AWS AnalyticsAmazon Web Services
 
Amazon Elasticsearch and Databases
Amazon Elasticsearch and DatabasesAmazon Elasticsearch and Databases
Amazon Elasticsearch and DatabasesAmazon Web Services
 
Aurora Serverless: Scalable, Cost-Effective Application Deployment (DAT336) -...
Aurora Serverless: Scalable, Cost-Effective Application Deployment (DAT336) -...Aurora Serverless: Scalable, Cost-Effective Application Deployment (DAT336) -...
Aurora Serverless: Scalable, Cost-Effective Application Deployment (DAT336) -...Amazon Web Services
 
Loading Data into Amazon Redshift
Loading Data into Amazon RedshiftLoading Data into Amazon Redshift
Loading Data into Amazon RedshiftAmazon Web Services
 
Building Serverless Analytics Pipelines with AWS Glue (ANT308) - AWS re:Inven...
Building Serverless Analytics Pipelines with AWS Glue (ANT308) - AWS re:Inven...Building Serverless Analytics Pipelines with AWS Glue (ANT308) - AWS re:Inven...
Building Serverless Analytics Pipelines with AWS Glue (ANT308) - AWS re:Inven...Amazon Web Services
 
ABD304-R-Best Practices for Data Warehousing with Amazon Redshift & Spectrum
ABD304-R-Best Practices for Data Warehousing with Amazon Redshift & SpectrumABD304-R-Best Practices for Data Warehousing with Amazon Redshift & Spectrum
ABD304-R-Best Practices for Data Warehousing with Amazon Redshift & SpectrumAmazon Web Services
 
Loading Data into Redshift with Lab
Loading Data into Redshift with LabLoading Data into Redshift with Lab
Loading Data into Redshift with LabAmazon Web Services
 
Building Data Lakes That Cost Less and Deliver Results Faster - AWS Online Te...
Building Data Lakes That Cost Less and Deliver Results Faster - AWS Online Te...Building Data Lakes That Cost Less and Deliver Results Faster - AWS Online Te...
Building Data Lakes That Cost Less and Deliver Results Faster - AWS Online Te...Amazon Web Services
 

Tendances (20)

Data Design for Microservices
Data Design for MicroservicesData Design for Microservices
Data Design for Microservices
 
DAT324_Expedia Flies with DynamoDB Lightning Fast Stream Processing for Trave...
DAT324_Expedia Flies with DynamoDB Lightning Fast Stream Processing for Trave...DAT324_Expedia Flies with DynamoDB Lightning Fast Stream Processing for Trave...
DAT324_Expedia Flies with DynamoDB Lightning Fast Stream Processing for Trave...
 
Data Transformation Patterns in AWS - AWS Online Tech Talks
Data Transformation Patterns in AWS - AWS Online Tech TalksData Transformation Patterns in AWS - AWS Online Tech Talks
Data Transformation Patterns in AWS - AWS Online Tech Talks
 
Data Warehousing with Amazon Redshift
Data Warehousing with Amazon RedshiftData Warehousing with Amazon Redshift
Data Warehousing with Amazon Redshift
 
10 Hacks for Optimizing MySQL in the Cloud - AWS Online Tech Talks
10 Hacks for Optimizing MySQL in the Cloud - AWS Online Tech Talks10 Hacks for Optimizing MySQL in the Cloud - AWS Online Tech Talks
10 Hacks for Optimizing MySQL in the Cloud - AWS Online Tech Talks
 
Build on Amazon Aurora with MySQL Compatibility (DAT348-R4) - AWS re:Invent 2018
Build on Amazon Aurora with MySQL Compatibility (DAT348-R4) - AWS re:Invent 2018Build on Amazon Aurora with MySQL Compatibility (DAT348-R4) - AWS re:Invent 2018
Build on Amazon Aurora with MySQL Compatibility (DAT348-R4) - AWS re:Invent 2018
 
ElastiCache Deep Dive: Design Patterns for In-Memory Data Stores (DAT302-R1) ...
ElastiCache Deep Dive: Design Patterns for In-Memory Data Stores (DAT302-R1) ...ElastiCache Deep Dive: Design Patterns for In-Memory Data Stores (DAT302-R1) ...
ElastiCache Deep Dive: Design Patterns for In-Memory Data Stores (DAT302-R1) ...
 
How Amazon uses AWS Analytics
How Amazon uses AWS AnalyticsHow Amazon uses AWS Analytics
How Amazon uses AWS Analytics
 
Best Practices for Migrating Oracle Databases to the Cloud - AWS Online Tech ...
Best Practices for Migrating Oracle Databases to the Cloud - AWS Online Tech ...Best Practices for Migrating Oracle Databases to the Cloud - AWS Online Tech ...
Best Practices for Migrating Oracle Databases to the Cloud - AWS Online Tech ...
 
Using Data Lakes
Using Data LakesUsing Data Lakes
Using Data Lakes
 
Data Warehousing and Data Lake Analytics, Together - AWS Online Tech Talks
Data Warehousing and Data Lake Analytics, Together - AWS Online Tech TalksData Warehousing and Data Lake Analytics, Together - AWS Online Tech Talks
Data Warehousing and Data Lake Analytics, Together - AWS Online Tech Talks
 
How Amazon.com Uses AWS Analytics
How Amazon.com Uses AWS AnalyticsHow Amazon.com Uses AWS Analytics
How Amazon.com Uses AWS Analytics
 
Amazon Elasticsearch and Databases
Amazon Elasticsearch and DatabasesAmazon Elasticsearch and Databases
Amazon Elasticsearch and Databases
 
Aurora Serverless: Scalable, Cost-Effective Application Deployment (DAT336) -...
Aurora Serverless: Scalable, Cost-Effective Application Deployment (DAT336) -...Aurora Serverless: Scalable, Cost-Effective Application Deployment (DAT336) -...
Aurora Serverless: Scalable, Cost-Effective Application Deployment (DAT336) -...
 
Loading Data into Amazon Redshift
Loading Data into Amazon RedshiftLoading Data into Amazon Redshift
Loading Data into Amazon Redshift
 
Building Serverless Analytics Pipelines with AWS Glue (ANT308) - AWS re:Inven...
Building Serverless Analytics Pipelines with AWS Glue (ANT308) - AWS re:Inven...Building Serverless Analytics Pipelines with AWS Glue (ANT308) - AWS re:Inven...
Building Serverless Analytics Pipelines with AWS Glue (ANT308) - AWS re:Inven...
 
ABD304-R-Best Practices for Data Warehousing with Amazon Redshift & Spectrum
ABD304-R-Best Practices for Data Warehousing with Amazon Redshift & SpectrumABD304-R-Best Practices for Data Warehousing with Amazon Redshift & Spectrum
ABD304-R-Best Practices for Data Warehousing with Amazon Redshift & Spectrum
 
Loading Data into Redshift with Lab
Loading Data into Redshift with LabLoading Data into Redshift with Lab
Loading Data into Redshift with Lab
 
Data Warehouses and Data Lakes
Data Warehouses and Data LakesData Warehouses and Data Lakes
Data Warehouses and Data Lakes
 
Building Data Lakes That Cost Less and Deliver Results Faster - AWS Online Te...
Building Data Lakes That Cost Less and Deliver Results Faster - AWS Online Te...Building Data Lakes That Cost Less and Deliver Results Faster - AWS Online Te...
Building Data Lakes That Cost Less and Deliver Results Faster - AWS Online Te...
 

Similaire à Building High Performance Apps with In-memory Data

What's New for AWS Purpose Built, Non-relational Databases - DAT204 - re:Inve...
What's New for AWS Purpose Built, Non-relational Databases - DAT204 - re:Inve...What's New for AWS Purpose Built, Non-relational Databases - DAT204 - re:Inve...
What's New for AWS Purpose Built, Non-relational Databases - DAT204 - re:Inve...Amazon Web Services
 
Building low latency apps with a serverless architecture and in-memory data I...
Building low latency apps with a serverless architecture and in-memory data I...Building low latency apps with a serverless architecture and in-memory data I...
Building low latency apps with a serverless architecture and in-memory data I...AWS Germany
 
RET305-Turbo Charge Your E-Commerce Site wAmazon Cache and Search Solutions.pdf
RET305-Turbo Charge Your E-Commerce Site wAmazon Cache and Search Solutions.pdfRET305-Turbo Charge Your E-Commerce Site wAmazon Cache and Search Solutions.pdf
RET305-Turbo Charge Your E-Commerce Site wAmazon Cache and Search Solutions.pdfAmazon Web Services
 
FINRA's Managed Data Lake: Next-Gen Analytics in the Cloud - ENT328 - re:Inve...
FINRA's Managed Data Lake: Next-Gen Analytics in the Cloud - ENT328 - re:Inve...FINRA's Managed Data Lake: Next-Gen Analytics in the Cloud - ENT328 - re:Inve...
FINRA's Managed Data Lake: Next-Gen Analytics in the Cloud - ENT328 - re:Inve...Amazon Web Services
 
The Non-Relational Revolution
The Non-Relational RevolutionThe Non-Relational Revolution
The Non-Relational RevolutionMikhail Prudnikov
 
AWS Database and Analytics State of the Union
AWS Database and Analytics State of the UnionAWS Database and Analytics State of the Union
AWS Database and Analytics State of the UnionAmazon Web Services
 
Tinder and DynamoDB: It's a Match! Massive Data Migration, Zero Down Time - D...
Tinder and DynamoDB: It's a Match! Massive Data Migration, Zero Down Time - D...Tinder and DynamoDB: It's a Match! Massive Data Migration, Zero Down Time - D...
Tinder and DynamoDB: It's a Match! Massive Data Migration, Zero Down Time - D...Amazon Web Services
 
ABD312_Deep Dive Migrating Big Data Workloads to AWS
ABD312_Deep Dive Migrating Big Data Workloads to AWSABD312_Deep Dive Migrating Big Data Workloads to AWS
ABD312_Deep Dive Migrating Big Data Workloads to AWSAmazon Web Services
 
ElastiCache & Redis: Database Week San Francisco
ElastiCache & Redis: Database Week San FranciscoElastiCache & Redis: Database Week San Francisco
ElastiCache & Redis: Database Week San FranciscoAmazon Web Services
 
ElastiCache & Redis: Database Week SF
ElastiCache & Redis: Database Week SFElastiCache & Redis: Database Week SF
ElastiCache & Redis: Database Week SFAmazon Web Services
 
ElastiCache and Redis - Samir Karande
ElastiCache and Redis - Samir KarandeElastiCache and Redis - Samir Karande
ElastiCache and Redis - Samir KarandeAmazon Web Services
 
Connecting the dots - How Amazon Neptune and Graph Databases can transform yo...
Connecting the dots - How Amazon Neptune and Graph Databases can transform yo...Connecting the dots - How Amazon Neptune and Graph Databases can transform yo...
Connecting the dots - How Amazon Neptune and Graph Databases can transform yo...Amazon Web Services
 
DAT310_Which Database to Use When
DAT310_Which Database to Use WhenDAT310_Which Database to Use When
DAT310_Which Database to Use WhenAmazon Web Services
 
BDA306 Building a Modern Data Warehouse: Deep Dive on Amazon Redshift
BDA306 Building a Modern Data Warehouse: Deep Dive on Amazon RedshiftBDA306 Building a Modern Data Warehouse: Deep Dive on Amazon Redshift
BDA306 Building a Modern Data Warehouse: Deep Dive on Amazon RedshiftAmazon Web Services
 
ABD307_Deep Analytics for Global AWS Marketing Organization
ABD307_Deep Analytics for Global AWS Marketing OrganizationABD307_Deep Analytics for Global AWS Marketing Organization
ABD307_Deep Analytics for Global AWS Marketing OrganizationAmazon Web Services
 
A Look Under the Hood – How Amazon.com Uses AWS Services for Analytics at Mas...
A Look Under the Hood – How Amazon.com Uses AWS Services for Analytics at Mas...A Look Under the Hood – How Amazon.com Uses AWS Services for Analytics at Mas...
A Look Under the Hood – How Amazon.com Uses AWS Services for Analytics at Mas...Amazon Web Services
 

Similaire à Building High Performance Apps with In-memory Data (20)

What's New for AWS Purpose Built, Non-relational Databases - DAT204 - re:Inve...
What's New for AWS Purpose Built, Non-relational Databases - DAT204 - re:Inve...What's New for AWS Purpose Built, Non-relational Databases - DAT204 - re:Inve...
What's New for AWS Purpose Built, Non-relational Databases - DAT204 - re:Inve...
 
Building low latency apps with a serverless architecture and in-memory data I...
Building low latency apps with a serverless architecture and in-memory data I...Building low latency apps with a serverless architecture and in-memory data I...
Building low latency apps with a serverless architecture and in-memory data I...
 
RET305-Turbo Charge Your E-Commerce Site wAmazon Cache and Search Solutions.pdf
RET305-Turbo Charge Your E-Commerce Site wAmazon Cache and Search Solutions.pdfRET305-Turbo Charge Your E-Commerce Site wAmazon Cache and Search Solutions.pdf
RET305-Turbo Charge Your E-Commerce Site wAmazon Cache and Search Solutions.pdf
 
FINRA's Managed Data Lake: Next-Gen Analytics in the Cloud - ENT328 - re:Inve...
FINRA's Managed Data Lake: Next-Gen Analytics in the Cloud - ENT328 - re:Inve...FINRA's Managed Data Lake: Next-Gen Analytics in the Cloud - ENT328 - re:Inve...
FINRA's Managed Data Lake: Next-Gen Analytics in the Cloud - ENT328 - re:Inve...
 
Non-Relational Revolution
Non-Relational RevolutionNon-Relational Revolution
Non-Relational Revolution
 
The Non-Relational Revolution
The Non-Relational RevolutionThe Non-Relational Revolution
The Non-Relational Revolution
 
AWS Database and Analytics State of the Union
AWS Database and Analytics State of the UnionAWS Database and Analytics State of the Union
AWS Database and Analytics State of the Union
 
Tinder and DynamoDB: It's a Match! Massive Data Migration, Zero Down Time - D...
Tinder and DynamoDB: It's a Match! Massive Data Migration, Zero Down Time - D...Tinder and DynamoDB: It's a Match! Massive Data Migration, Zero Down Time - D...
Tinder and DynamoDB: It's a Match! Massive Data Migration, Zero Down Time - D...
 
ABD312_Deep Dive Migrating Big Data Workloads to AWS
ABD312_Deep Dive Migrating Big Data Workloads to AWSABD312_Deep Dive Migrating Big Data Workloads to AWS
ABD312_Deep Dive Migrating Big Data Workloads to AWS
 
ElastiCache & Redis: Database Week San Francisco
ElastiCache & Redis: Database Week San FranciscoElastiCache & Redis: Database Week San Francisco
ElastiCache & Redis: Database Week San Francisco
 
ElastiCache & Redis
ElastiCache & RedisElastiCache & Redis
ElastiCache & Redis
 
ElastiCache & Redis: Database Week SF
ElastiCache & Redis: Database Week SFElastiCache & Redis: Database Week SF
ElastiCache & Redis: Database Week SF
 
ElastiCache and Redis - Samir Karande
ElastiCache and Redis - Samir KarandeElastiCache and Redis - Samir Karande
ElastiCache and Redis - Samir Karande
 
Connecting the dots - How Amazon Neptune and Graph Databases can transform yo...
Connecting the dots - How Amazon Neptune and Graph Databases can transform yo...Connecting the dots - How Amazon Neptune and Graph Databases can transform yo...
Connecting the dots - How Amazon Neptune and Graph Databases can transform yo...
 
DAT310_Which Database to Use When
DAT310_Which Database to Use WhenDAT310_Which Database to Use When
DAT310_Which Database to Use When
 
Non-Relational Revolution
Non-Relational RevolutionNon-Relational Revolution
Non-Relational Revolution
 
BDA306 Building a Modern Data Warehouse: Deep Dive on Amazon Redshift
BDA306 Building a Modern Data Warehouse: Deep Dive on Amazon RedshiftBDA306 Building a Modern Data Warehouse: Deep Dive on Amazon Redshift
BDA306 Building a Modern Data Warehouse: Deep Dive on Amazon Redshift
 
ABD307_Deep Analytics for Global AWS Marketing Organization
ABD307_Deep Analytics for Global AWS Marketing OrganizationABD307_Deep Analytics for Global AWS Marketing Organization
ABD307_Deep Analytics for Global AWS Marketing Organization
 
Log Analytics with AWS
Log Analytics with AWSLog Analytics with AWS
Log Analytics with AWS
 
A Look Under the Hood – How Amazon.com Uses AWS Services for Analytics at Mas...
A Look Under the Hood – How Amazon.com Uses AWS Services for Analytics at Mas...A Look Under the Hood – How Amazon.com Uses AWS Services for Analytics at Mas...
A Look Under the Hood – How Amazon.com Uses AWS Services for Analytics at Mas...
 

Plus de Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

Plus de Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Building High Performance Apps with In-memory Data

  • 1. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Pop-up Loft Building High Performance Apps with In-Memory Data Mikhail Prudnikov prudniko@amazon.com Sr Solutions Architect
  • 2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. In-memory key-value store supporting • Redis 3.2.10 • Memcached 1.4.34 High-performance Fully managed; zero admin Highly available and reliable Hardened by Amazon Amazon ElastiCache
  • 3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Powerful ~200 commands + Lua scripting In-memory data structure server Utility data structures Strings, lists, hashes, sets, sorted sets, bitmaps & HyperLogLogs Simple Atomic operations supports transactions Ridiculously fast! <1ms latency for most commands Highly available replication Persistence Open source Redis overview
  • 4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. S5 S1 S2 S4 S3 Client § 16384 hash slots per cluster § Slot for a key is CRC16(key) mod 16384 § Slots are distributed across the cluster into shards § Developers must use a Redis cluster aware client § Clients are redirected to the correct shard § Smart clients store a map Shard S1 = slots 0–3276 Shard S2 = slots 3277–6553 Shard S3 = slots 6554–9829 Shard S4 = slots 9830–13106 Shard S5 = slots 13107–16383 Redis cluster: automatic client-side sharding
  • 5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. reads/ writes reads AZ1 AZ2 reads search reads search clients c a c h e c l u s t e r r e l a t i o n a l d a t a Healthy
  • 6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. reads/ writes reads AZ1 AZ2 reads search reads search clients c a c h e c l u s t e r r e l a t i o n a l d a t a Heavy pressure
  • 7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Lambda 3 Shards … var params = { ApplyImmediately: true, NodeGroupCount: 5, ReplicationGroupId: ‘rep-group-id’, … } elasticache.modifyReplicationGroupShardConfiguration(params, function(err, data) { if (err) console.log(err, err.stack); else console.log(data); }); … 5 Shards MEMORY HIGH! Amazon CloudWatch Cluster Resized AWS SNS Online Re-Sharding—CW alarm triggered
  • 8. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. reads/ writes reads AZ1 AZ2 reads search reads search c a c h e c l u s t e r clients r e l a t i o n a l d a t a Healthy— auto scaled out
  • 9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Session management Database caching APIs (HTTP responses) IOT Streaming data analytics (Filtering/aggregation) Pub/sub Social media (Sentiment analysis) Standalone database (Metadata store) Leaderboards Usage Patterns
  • 10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Caching Clients Amazon ElastiCache Redis Amazon DynamoDB Elastic Load Balancing Amazon EC2 Amazon RDS write-through reads/ writes DDB streams mysql.lambda_async reads/ writes Amazon S3 reads/writes Object data Unstructured data Relational data
  • 11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Caching NoSQL Amazon EC2 reads/ writes reads MongoDB Cluster Cassandra Cluster ü Smaller NoSQL DB clusters needed = lower costs ü Faster data retrieval = better performance Elasticsearch Cluster Clients
  • 12. Amazon EC2 reads/ writes Amazon ElastiCache Redis reads MongoDB Cluster DBObject doc = collection.findOne(); Cache serialized DBObject in Redis (good) Cache rows in Redis hash (faster/more efficient) Cassandra Cluster Amazon ElastiCache Redis Amazon EC2 reads/ writes reads ResultSet rs = session.execute(stmt); Cache serialized ResultSet in Redis (good) Cache rows in Redis hash (faster/more efficient) ü Smaller NoSQL DB clusters needed = lower costs ü Faster data retrieval = better performance Caching NoSQL databases with Amazon ElastiCache
  • 13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Kinesis Analytics Amazon Kinesis Streams Amazon Kinesis Streams Amazon ElastiCache (Redis) cleansed stream Streaming data enrichment/processing Datasources raw stream Subscribers AWS Lambda function 1 Continual data filtering/enrichment Real-time pub/sub AWS Lambda function 2
  • 14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Big data architectures using Redis Amazon Kinesis DataSources AWS Lambda Apache Storm on EMR Spark Streaming on Amazon EMR Amazon Kinesis app Amazon EC2 AWS IoT Amazon ElastiCache Collect Store Process Amazon S3 Apache Kafka AWS Lambda Custom app Spark on Amazon EMR Analyze
  • 15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Rules Engine Amazon ElastiCache Redis AWS Lambda Direct integration LambdaSNS SQS S3 KinesisDDB AWS IoT devices AWS IoT Sensor store IoT powered by ElastiCache
  • 16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Mobile apps powered by ElastiCache Amazon API Gateway AWS Lambda Amazon ElastiCache Redis GEOADD GEORADIUS Search points of interest Update points of interest https://aws.amazon.com/blogs/database/amazon-elasticache-utilizing-redis-geospatial-capabilities/ Amazon DynamoDB DDB streams Amazon EC2
  • 17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Ad tech powered by ElastiCache Clients Advertisers https://aws.amazon.com/caching/database-caching/ Ad network Ad slot Consumer Ad slot publishers Ad placement (websites/apps) Amazon ElastiCache Redis <40 ms Clickstream (shopping events) User visits page Publisher places ad slot for auction Ad network calls for bidsBidders respond with bids Winners bid ad displayed
  • 18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Chat apps powered by ElastiCache https://aws.amazon.com/blogs/database/amazon-elasticache-utilizing-redis-geospatial-capabilities/ Clients Chat apps Application Load Balancer WebSockets Amazon ElastiCache Redis PubSub Serverpersistent connections Elastic Beanstalk SUBSCRIBE chat_channel:114 PUBLISH chat_channel:114 "Hello all" >> ["message", "chat_channel:114", "Hello all"] UNSUBSCRIBE chat_channel:114
  • 19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • Very popular for gaming apps that need uniqueness and 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 Gaming—real-time leaderboards
  • 20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Ex: throttling requests to an API uses Redis counters ELB Externally facing API 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 Rate limiting
  • 21. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What data should I cache?
  • 22. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • R e f e r e n c e d a t a : p r o d u c t c a t e g o r i e s ( u s e r l o n g e r T T L s ) • R e f e r e n c e d a t a : p r o d u c t i m a g e s ( u s e r l o n g e r T T L s ) • R e f e r e n c e d a t a : p r o d u c t d e t a i l s ( u s e r l o n g e r T T L s ) • D y n a m i c : d a t a b a s e r e s u l t s e t s : ( u s e r s h o r t e r T T L s ) • D y n a m i c : A P I r e s p o n s e s ( u s e r s h o r t e r T T L s ) • A n y t h i n g t h a t i s c a c h e a b l e ! What data to cache
  • 23. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. How do I cache my data?
  • 24. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Cache-aside—lazy loading Cache-aside—lazy loading Amazon ElastiCache Applications Amazon RDS 1 2 3 1) Check cache, if HIT return 2) If Cache MISS 3) Update cache
  • 25. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Cache-aside—write-through Cache-aside—write-through Amazon ElastiCache Applications Amazon RDS 1 2 1) Update primary DB 2) Update cache
  • 26. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Cache strategies DB result set Pro When data retrieval logic is abstracted from the code consuming the ResultSet, caching the ROW can be extremely effective and can be implemented against any RDBMS Con Data retrieval still requires extracting values from the ROW and does not further simplify data access, it only reduces data-retrieval latency SELECT * FROM x WHERE y ID First_Name Last_Name City 123 Michael Labib Chicago ResultSet object (ROW) Key: query, value: CRS as byte array
  • 27. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Cache strategies JSON SELECT * FROM x WHERE y ID First_Name Last_Name City 123 Michael Labib Chicago Key: 123, Value: ‘{ “firstname”: “Michael”, “lastname”: “Labib”, “city”: “Chicago” } ‘ String firstName = rs.getString(First_Name) Pro Very easy to implement. Cache any desired database fields and values into a Redis string. For example, store your retrieved data into a JSON object stored in a Redis string. Con Cannot get individual JSON properties
  • 28. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Cache strategies Application objects SELECT * FROM x WHERE y ID First_Name Last_Name City 123 Michael Labib Chicago Key: CUSTOMER_ID:123, Value: Customer object as byte array String firstName = rs.getString(First_Name); customer.setFirstName(firstName); String lastName = rs.getString(Last_Name); customer.setLastName(lastName); Pro Use application objects in their native structure and data state when serialized
  • 29. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Cache strategies Using Redis data structures SELECT * FROM x WHERE y ID First_Name Last_Name City 123 Michael Labib Chicago Key: CUSTOMER_ID:123, Value: rsHash String firstName = rs.getString(First_Name); rsHash.put(“firstName", firstName); String lastName = rs.getString(Last_Name); rsHash.put(“lastName", lastName); jedis.hmset(“CUSTOMER_ID:123", rsHash); Pro In addition to reducing data retrieval latency, cache data into specific data structure that simplifies the data access pattern
  • 30. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • Understand the frequency of change of underlying data • Set appropriate TTLs on keys that match that frequency • Choose appropriate eviction policies that are aligned with application requirements • Isolate your cluster by purpose (for example, cache cluster, queue, standalone database, and so on) • Maintain cache freshness with write-throughs • Performance test and size your cluster appropriately • Monitor Cache HIT/MISS ratio and alarm on poor performance • Use failover API to test application resiliency Caching tips
  • 31. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Cluster sizing best practices • Storage—clusters should have adequate memory • Recommended: memory needed + 25% reserved memory (for Redis) + some room for growth (optional 10%) • Optimize using eviction policies and TTLs • Scale up or out before reaching max-memory using CloudWatch alarms • Use memory optimized nodes for cost effectiveness (R4 support) • Performance—performance should not be compromised • Benchmark operations using Redis Benchmark tool • For more READIOPS—add replicas • For more WRITEIOPS—add shards (scale out) • For more network IO—use network optimized instances and scale out • Use pipelining for bulk reads/writes • Consider Big(O) time complexity for data structure commands • Cluster isolation (apps sharing key space)—choose a strategy that works for your workload • Identify what kind of isolation is needed based on the workload and environment • Isolation: No Isolation $ | Isolation by Purpose $$ | Full Isolation $$$
  • 32. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Redis benchmark tool Open source utility to benchmark performance example: src/redis-benchmark -h r3-xlarge-perf.foio87.0001.use1.cache.amazonaws.com -p 6379 -n -150000 -d 100 Syntax: redis-benchmark -h <host> -p <port> -c 50 -n 1000 -d 500 –q -c <clients>—Specifies the number of parallel connections (default 50). -n <requests>—Specifies the number of requests (default 1000000). -d <size>—Specifies the data size of GET and SET values in bytes. -t <test1,test2>—Comma-separated list of tests to perform. -q—Quiet operation, displays only the result.
  • 33. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Redis max-memory policies Select a max-memory policy based on your workload needs • noeviction: return errors when the memory limit has been reached and the client is trying to execute commands that might result in more memory to be used • allkeys-lru: evict keys trying to remove the less recently used (LRU) keys first • volatile-lru: evict keys trying to remove the less recently used (LRU) keys first, but only among keys that have an expire set • allkeys-random: evict random keys to make space for the new data added • volatile-random: evict random keys to make space for the new data added, but only evict keys with an expire set • volatile-ttl: evict only keys with an expire set, and try to evict keys with a shorter time to live (TTL) first
  • 34. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Key ElastiCache CloudWatch metrics • CPUUtilization • Memcached—up to 90% ok • Redis—divide by cores (ex: 90% / 4 = 22.5%) • SwapUsage low • CacheMisses/CacheHits Ratio low/stable • Evictions near zero • Exception: Russian-doll caching • CurrConnections stable • Setup alarms with CloudWatch metrics
  • 35. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ElastiCache modifiable parameters • Maxclients: 65000 (unchangeable) • Use connection pooling • timeout—closes a connection after it has been idle for a given interval • tcp-keepalive—detects dead peers given an interval • Databases: 16 (default) for non-clustered mode • Logical partition • Reserved-memory: 25% (default) • Recommended § 50% of maxmemory to use before 2.8.22 § 25% after 2.8.22—ElastiCache • Maxmemory-policy: • The eviction policy for keys when maximum memory usage is reached • Possible values: volatile-lru, allkeys-lru, volatile-random, allkeys-random, volatile-ttl, noeviction
  • 36. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What we’re building Availability Zone #1 REINVENT-RDS-SG Test Instance VPC: REINVENT 10.0.0.0/16 Public1: 10.0.0.0/24 Private1: 10.0.2.0/24 REINVENT-EC-SG REINVENT-APP-SG APACHE HTTP SERVER REDIS 3.2 CLIENT JMETER 3.2 JUNIT 4 TEST APP JAVA 1.8.0 Test Instance SSH, HTTP Performance testing lab—infrastructure topology
  • 37. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Workshop: JMeter and JUnit tests overview RDSLoad:testRDSLoad() (This executes only one time) 1. Drops database CustomerDB if it exists, referencing SQL stored in DropCustomerDB 2. Creates database CustomerDB, referencing SQL stored in CreateCustomerDB 3. Creates table customer, referencing SQL stored in CreateCustomerTbl 4. Loads 1000 customer records stored in CUSTOMER.sql RedisLoad:testRedisLoad() (This executes only one time) 1. Flushes all the data in the Redis Cluster to prepare it 2. Queries the customer database table for the total count of customer records, referencing SQL stored in CountCustomerTbl 3. Iterates over the total count and queries for each row, referencing SQL stored in SelectCustomerTbl 4. Stores each SQL ResultSet row into a Redis HashMap with the key name being the SQL statement for that individual customer query Data loading
  • 38. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Workshop: JMeter and JUnit tests overview Stress testing: 20k requests/second RDSBenchmark:testRDS() 1. Randomly selects a customer row to retrieve from customer IDs 1–1000 2. Retrieves the SELECT SQL STATEMENT and appends the random customer ID integer referencing SQL stored in SelectCustomerTbl 3. Executes SQL statement and iterates/displays the fetched row RedisBenchmark:testRedis() 1. Randomly selects a customer hashmap to retrieve from customer IDs 1–1000 2. Retrieves the SELECT SQL STATEMENT and appends the random customer ID integer referencing SQL stored in SelectCustomerTbl 3. Executes Redis HASHMAP HGETALL command to retrieve/display the fetched hash
  • 39. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Workshop: JMeter and JUnit tests overview //Generating a random num 1-1000 representing customer ids randomKey = Integer.toString(rand.nextInt(1000)); //Retrieving Customer Select SQL Statement & appending customer id sql = query + randomKey; stmt = connection.createStatement(); //executing query rs = stmt.executeQuery(sql); //iterating and displaying results while( rs.next() ) { … //Generating a random num 1-1000 representing customer ids randomKey = Integer.toString(rand.nextInt(1000)); //Retrieving Customer Select SQL Statement & appending customer id key = query + randomKey; //executing command map = jedis.hgetAll(key); //iterating and displaying results for (String name : map.keySet() ) { …