Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Getting Started
with
Amazon ElastiCache
Faster is Better!
1
2
In-Memory Key-Value Store
High-performance
Redis and Memcached
Fully managed; Zero admin
Highly Available and Reliable
H...
Amazon ElastiCache
AGENDA
• Faster to Run
• Faster to Deploy
• Faster to Develop
• Things to Do Faster
3
Faster to Run
microsecond performance
Modern Applications Require Fast Performance
• We live in a connected world
• Phones, Tablets, Cars, Air Conditioners, Toa...
Amazon
RDS
Amazon S3
Request Rate
High Low
Latency
Low High
Data Volume
Low High
Amazon
Glacier
Amazon
CloudSearch & Elast...
Redis – the fast in-memory database
Powerful
~200 commands + Lua scripting
In-memory database
Utility data structures
stri...
Memcached – fast caching
Slab allocator
In-memory key-value datastore
Supports strings, objects
Multi-threaded
Insanely fa...
One Simple Example ….
+
on-demand c3.8xlarge
3,000,000 objects
+
100 bytes each
memtier benchmark
50 read : 50 write
1,228...
Faster to Deploy
Production-Ready in 5 Minutes
11
Fully managed service = Automated Operations
Redis datastore hosted on Amazon EC2 Amazon ElastiCache for Redis
Amazon
ElastiCache
Redis Multi-AZ
Easy Monitoring via CloudWatch
Fully Managed
Enhanced Redis Engine
Easy to Deploy & Use
...
Amazon
ElastiCache
Enhanced Redis Engine – Hardened by Amazon
RDB Without Fork
• Mitigate the risk of increased swap
usage...
Amazon
ElastiCache
Enhanced Redis Engine – Hardened by Amazon
Optimized Swap Memory
• Mitigate the risk of increased swap
...
Primary
Availability Zone A Availability Zone B
Replica
Replica
writes
Use Primary Endpoint
reads
Use Read Replicas
Auto-F...
Faster to Develop
Production-Ready in 5 Minutes
Data Types for Rapid Development
Redis Data Type Contains Read/write ability
String
Binary-safe strings (up to 512 MB), In...
Some Data Type Examples
Source: http://www.slideshare.net/FedericoDanielColomb/redis-introduction-54750742
18
Redis – Read/Write Connections
# Ruby example
redis_write = Redis.new(
'mygame-dev.z2vq55.ng.0001.usw2.cache.amazonaws.com...
Things to Do Faster
some cool stuff with ElastiCache
Demanding Real-Time Workloads
Thousands of Customers Implementing Large Scale Caching, Leaderboards,
Session Management, M...
Use Case #1 - Caching
Elastic Load
Balancing
EC2 App
Instances
RDS MySQL
DB Instance
ElastiCache
Database Writes
App
Reads...
IGA Works Uses ElastiCache to Power Real-Time App Monetization
By using RDS we saved on operations
cost for our relational...
Expedia’s Real-time Analytics Application Uses Amazon ElastiCache
Expedia is a leader in the $1 trillion travel industry, ...
Not if I
destroy
it first!
It’s
mine!
• Very popular for gaming apps
• Need uniqueness + ordering
• Easy with Redis Sorted...
TV Globo (Media)
• Rede Globo is the second largest TV network in the
world.
• TV Globo used ElastiCache Redis for second ...
Use Case 3 - Chat and Messaging
• PUBLISH and SUBSCRIBE Redis commands
• Game or Mobile chat, real-time comment streams
• ...
• Popular for recommendation engines and message board ranking
• Redis counters – increment likes/dislikes
• Redis hashes ...
• Throttling requests to an API
• Leverages Redis Counters
ELB
Externally
Facing A
PI
Reference: http://redis.io/commands/...
30
In-Memory Key-Value Store
High-performance
Redis and Memcached
Fully managed; Zero admin
Highly Available and Reliable
...
Upcoming SlideShare
Loading in …5
×

Getting started with Amazon ElastiCache

2,849 views

Published on

An overview of the Amazon ElastiCache managed service, with examples of how it can be used to increase performance, lower costs and augment other database services and databases to make things faster, easier and less expensive.

Getting started with Amazon ElastiCache

  1. 1. Getting Started with Amazon ElastiCache Faster is Better! 1
  2. 2. 2 In-Memory Key-Value Store High-performance Redis and Memcached Fully managed; Zero admin Highly Available and Reliable Hardened by Amazon
  3. 3. Amazon ElastiCache AGENDA • Faster to Run • Faster to Deploy • Faster to Develop • Things to Do Faster 3
  4. 4. Faster to Run microsecond performance
  5. 5. Modern Applications Require Fast Performance • We live in a connected world • Phones, Tablets, Cars, Air Conditioners, Toasters, Drones … • Experiences are increasingly contextual • Analytics everywhere, for everything • Apps need to provide real-time responses • Database performance is frequently the bottleneck • Loads are variable and unpredictable
  6. 6. Amazon RDS Amazon S3 Request Rate High Low Latency Low High Data Volume Low High Amazon Glacier Amazon CloudSearch & Elasticsearch Structure Low High Amazon DynamoDB Amazon ElastiCache HDFS
  7. 7. Redis – the fast in-memory database Powerful ~200 commands + Lua scripting In-memory database Utility data structures strings, lists, hashes, sets, sorted sets, bitmaps & HyperLogLogs Simple Atomic operations supports transactions has ACID properties Ridiculously fast! <500microsecond latency for most commands Highly Available replication Persistent snapshots or append-only log Open Source 7
  8. 8. Memcached – fast caching Slab allocator In-memory key-value datastore Supports strings, objects Multi-threaded Insanely fast! Very established No persistence Patterns for sharding
  9. 9. One Simple Example …. + on-demand c3.8xlarge 3,000,000 objects + 100 bytes each memtier benchmark 50 read : 50 write 1,228,432 TPS Source: http://highscalability.com/blog/2014/8/27/the-12m-opssec -redis-cloud-cluster-single-server-unbenchmar.html
  10. 10. Faster to Deploy Production-Ready in 5 Minutes
  11. 11. 11 Fully managed service = Automated Operations Redis datastore hosted on Amazon EC2 Amazon ElastiCache for Redis
  12. 12. Amazon ElastiCache Redis Multi-AZ Easy Monitoring via CloudWatch Fully Managed Enhanced Redis Engine Easy to Deploy & Use ElastiCache vs. Self-Managed Redis No Cross-AZ Data Transfer Costs Engineered For Cloud Scale
  13. 13. Amazon ElastiCache Enhanced Redis Engine – Hardened by Amazon RDB Without Fork • Mitigate the risk of increased swap usage during syncs and snapshots. Dynamic write throttling • To improve output buffer management when the node’s memory is close to being exhausted Smoother failovers • Clusters recover faster as replicas will avoid flushing their data to do a full re-sync with the primary.
  14. 14. Amazon ElastiCache Enhanced Redis Engine – Hardened by Amazon Optimized Swap Memory • Mitigate the risk of increased swap usage during syncs and snapshots. Dynamic write throttling • Improved output buffer management when the node’s memory is close to being exhausted. Smoother failovers • Clusters recover faster as replicas avoid flushing their data to do a full re-sync with the primary. 14
  15. 15. Primary Availability Zone A Availability Zone B Replica Replica writes Use Primary Endpoint reads Use Read Replicas Auto-Failover  Chooses replica with lowest replication lag  DNS endpoint is same ElastiCache for Redis Multi-AZ ElastiCache for Redis ElastiCache for Redis ElastiCache for Redis Automatic Failover to a read replica in case of primary node failure ElastiCache Automates snapshots for persistence
  16. 16. Faster to Develop Production-Ready in 5 Minutes
  17. 17. Data Types for Rapid Development Redis Data Type Contains Read/write ability String Binary-safe strings (up to 512 MB), Integers or floating point values, Bitmaps. Operate on the whole string, parts, increment/decrement the integers and floats, get/set bits by position. Hash Unordered hash table of keys to string values Add, fetch, or remove individual ítems by key, fetch the w hole hash. List Doubly linked list of strings Push or pop items from both ends, trim based on offsets, read individual or multiple items, find or remove items by value. Set Unordered collection of unique strings Add, fetch, or remove individual items, check membership , intersect, union, difference, fetch random items. Sorted Set Ordered mapping of string members to floating-point scores, ordered by score Add, fetch, or remove individual items, fetch items based on score ranges or member value. Geospatial index Sorted set implementation using geospatial information as the score Add, fetch or remove individual items, search by coordina tes and radius, calculate distance. HyperLogLog Probabilistic data structure to count unique things using 12Kb of memory Add individual or multiple items, get the cardinality. Value1Key1 Value2Key2 Lon.: -103.55328 Lat.: 20.63373 Value 10000110 ...10 I m a string! ...0000110 ACBD CBCA C: 250A: 250D: 0.3B: 0.1 Source:: https://cs.brown.edu/courses/cs227/archives/2011/slides/mar07-redis.pdf
  18. 18. Some Data Type Examples Source: http://www.slideshare.net/FedericoDanielColomb/redis-introduction-54750742 18
  19. 19. Redis – Read/Write Connections # Ruby example redis_write = Redis.new( 'mygame-dev.z2vq55.ng.0001.usw2.cache.amazonaws.com') redis_read = Redis::Distributed.new([ 'mygame-dev-002.z2vq55.ng.0001.usw2.cache.amazonaws.com', 'mygame-dev-003.z2vq55.ng.0001.usw2.cache.amazonaws.com' ]) redis_write.zset("leaderboard", "nateware", 1976) top_10 = redis_read.zrevrange("leaderboard", 0, -1)
  20. 20. Things to Do Faster some cool stuff with ElastiCache
  21. 21. Demanding Real-Time Workloads Thousands of Customers Implementing Large Scale Caching, Leaderboards, Session Management, Messaging, Queuing and more Gaming AdTech Media Mobile Other
  22. 22. Use Case #1 - Caching Elastic Load Balancing EC2 App Instances RDS MySQL DB Instance ElastiCache Database Writes App Reads Clients Cache Updates Database Reads
  23. 23. IGA Works Uses ElastiCache to Power Real-Time App Monetization 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 ” “ • 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
  24. 24. Expedia’s Real-time Analytics Application Uses Amazon 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. 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 ” “ • Expedia’s real-time analytics application collects data for its “test & learn” experiments on Expedia sites. • The analytics application processes ~200 million messages daily. • Re:invent talk: https://www.youtube.com/watch?v=ie4dWGT76LM
  25. 25. Not if I destroy it first! It’s mine! • Very popular for gaming apps • Need uniqueness + 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 Use Case 2 - Real-time Leaderboard
  26. 26. TV Globo (Media) • Rede Globo is the second largest TV network in the world. • TV Globo used ElastiCache Redis for second screen application during the World Cup and Olympics in Brazil • ElastiCache was used for caching and leaderboards. • Massive spikes in usage during games and peak events.
  27. 27. Use Case 3 - Chat and Messaging • PUBLISH and SUBSCRIBE Redis commands • Game or Mobile chat, real-time comment streams • Server intercommunication SUBSCRIBE chat_channel:114 PUBLISH chat_channel:114 "Hello all" >> ["message", "chat_channel:114", "Hello all"] UNSUBSCRIBE chat_channel:114
  28. 28. • Popular for recommendation engines and message board ranking • Redis counters – increment likes/dislikes • Redis hashes – list of everyone’s ratings • Process with algorithm like Slope One or Jaccardian similarity • Ruby example - https://github.com/davidcelis/recommendable Use Case 4 – Ratings INCR item:38927:likes HSET item:38927:ratings "Susan" 1 INCR item:38927:dislikes HSET item:38927:ratings "Tommy" -1
  29. 29. • Throttling requests to an API • Leverages Redis Counters ELB Externally Facing A PI 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 Use Case 5 - Rate Limiting
  30. 30. 30 In-Memory Key-Value Store High-performance Redis and Memcached Fully managed; Zero admin Highly Available and Reliable Hardened by Amazon

×