by Mike Gillespie, Solutions Architect, AWS
Database Week at the AWS Loft is an opportunity to learn about Amazon’s broad and deep family of managed database services. These services provide easy, scalable, reliable, and cost-effective ways to manage your data in the cloud. We explain the fundamentals and take a technical deep dive into Amazon RDS and Amazon Aurora relational databases, Amazon DynamoDB non-relational databases, Amazon Neptune graph databases, and Amazon ElastiCache managed Redis, along with options for database migration, caching, search and more. You'll will learn how to get started, how to support applications, and how to scale.
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