In-memory data stores, such as ElastiCache for Redis, enable applications where response times are measured in microseconds. We’ll look at how to design and deploy high-performance applications using ElastiCache, Aurora, DynamoDB, DAX, and Lambda, then we’ll do a hands-on lab to do it ourselves. You’ll need a laptop with a Firefox or Chrome browser.
Building High Performance Apps with In-Memory Data
1. Amazon ElastiCache Deep Dive:
High Performance Applications
Mike Gillespie,
Solutions Architect
2. What to expect from this session
• Amazon ElastiCache overview
• Amazon ElastiCache security and encryption
• Amazon ElastiCache usage patterns
• Real-time Dashboard Demo
• Hands On Lab
9. Scenario:
• High-Volume E-Commerce Website
• Data Streaming with Amazon Kinesis Streams
• Need insight into the real-time sales analytics
data for the current hour and day
• Very Latency Sensitive
• Current Relational DBs are already maxed out.
Amazon
ElastiCache
10. Metrics:
• Daily Order Count
• Unique Items Sold
• Product Leaderboard
• Recently Orders
• Historical Sales Revenue by Day
Amazon
ElastiCache
15. Daily Order Count
To increment our order count on March 11, 2018, we use the command:
INCR orders:20180311
We can then retrieve the value in integer format as follows:
GET orders:20180311
Computational Complexity O(1)
16. Number of Daily Unique Items Sold
This metric will track the number of order lines per day:
SADD orders:items:20180311 123456789
EXPIRE orders:items:20180311 60*60*24*7
The expire command will manage the purging of data as it ages out.
SCARD orders:items:20180311
Computational Complexity O(1)
17. Leaderboard: Most Popular Products
This metric will track the most popular products on a given day:
ZINCRBY orders:items:popular 2 123456789
To build a report in the most popular items sold on that day:
ZREVRANGE orders:items:popular 0 9
Computational Complexity: O(log(N)) where N is the number of elements
in the sorted set.
18. Latest Products Purchased
This metric will track the orders as they are processed and list the most
recent orders processed in real time:
LPUSH orders:items:latest 123456789
LTRIM orders:items:latest 0 99
The LTRIM handles the purge of list of the 100 most recent orders.
LRANGE orders:items:latest 0 9
Computational Complexity: O(1)
19. Historical Sales Revenue
This metric will track total sales revenue in the last week.
ZADD sales:revenue:days 0 20180311
Now, increment hourly sales revenue:
HINCRBYFLOAT sales:revenue:20180311 10 244.56
To generate the report, get all the keys for the week:
ZREVRANGE sales:revenue:days 0 6
For each day in range: HGETALL sales:revenue:20180311
Computational Complexity: O(n) where n number of keys in the hash