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

2,926 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.

Published in: Technology
  • Be the first to comment

Getting Started with Amazon ElastiCache

  1. 1. Getting Started with Amazon ElastiCache Faster is Better! 1 Dan Zamansky, Senior Product Manager September 14, 2016
  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 8
  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. 12 Fully managed service = Automated Operations Redis datastore hosted on Amazon EC2 Amazon ElastiCache for Redis
  12. 12. ElastiCache - Customer Value Extreme Performance Sub-millisecond access latencies Engineered for Cloud Scale Open Source Compatible Compatible with Redis and Memcached Existing code will work when you update node end points Fully Managed Automates tasks such as failed node replacement, software patching, upgrades and backups CloudWatch enables you to monitor cache performance metrics Secure and Hardened Supports Amazon VPC and IAM for secure and fine grained access. Monitors your nodes and applies security patches when necessary Highly Available and Scalable Multi-AZ with automatic failover to a read replica, no human intervention required. Easily scale your Redis (vertically) and Memcached (horizontally) environments Cost Effective Pay as low as 17 cents per hour. Get started with 750 free hours per month of a micro node for a year. No cross availability zone data transfer costs.
  13. 13. 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. 15
  14. 14. 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
  15. 15. ElastiCache with Redis Multi-AZ Region Availability Zone A Availability Zone B Auto Scaling group ElastiCache cluster
  16. 16. ElastiCache with Redis Multi-AZ Region Availability Zone A Availability Zone B Auto Scaling group ElastiCache cluster
  17. 17. ElastiCache with Redis Multi-AZ Region Availability Zone A Availability Zone B Auto Scaling group ElastiCache cluster
  18. 18. ElastiCache with Redis Multi-AZ Region Availability Zone A Availability Zone B Auto Scaling group ElastiCache cluster
  19. 19. Faster to Develop Production-Ready in 5 Minutes
  20. 20. 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
  21. 21. Some Data Type Examples Source: http://www.slideshare.net/FedericoDanielColomb/redis-introduction-54750742 23
  22. 22. 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)
  23. 23. Things to Do Faster some cool stuff with ElastiCache
  24. 24. Demanding Real-Time Workloads Thousands of Customers Implementing Large Scale Caching, Leaderboards, Session Management, Messaging, Queuing and more Gaming AdTech Media Mobile Other
  25. 25. Use Case #1 - Caching Elastic Load Balancing EC2 App Instances RDS MySQL DB Instance ElastiCache Database Writes App Reads Clients Cache Updates Database Reads
  26. 26. 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
  27. 27. 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
  28. 28. 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
  29. 29. 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.
  30. 30. 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
  31. 31. • 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 4 - Rate Limiting
  32. 32. Use Pattern 5 - Streaming Data Amazon ElastiCache Amazon EC2 Data Sources AWS Lambda (Dashboard) 1 34 Amazon Kinesis Streams Amazon DynamoDB Hot Data Longer Retention
  33. 33. 36 In-Memory Key-Value Store High-performance Redis and Memcached Fully managed; Zero admin Highly Available and Reliable Hardened by Amazon

×