What is Amazon ElastiCache?
The in-memory caching provided by ElastiCache, which can be used to improve latency and throughput for many heavily read application workloads or compute-intensive workloads .For the finest scenarios like where the Database load is based on Online Analytical Processing (OLAP) transactions. AWS ElastiCache is an In-memory key/value store. It is managed service provided by AWS.
Elastic cache provides two ways to configure:
- Memcached
- Redis
Difference between Redis and Memcached as below:
Redis | MemCache |
Redis does not have native clustering yet, but working on developing this feature too. | It does native clustering, hence if you need a robust clustering memcache, for Memcached. |
Redis is a data structure server which do not only caching but you can also do share queue, message solution(pub/sub), sessions and sorted sets. so it is really good for Key-> Some-Object. | Good at doing simple key-value cache. But if you want t use other feature or requirement changes, REDIS is the right way to go. So, it is good for KEY->String. |
You can cache bigger values in Redis cache. Values upto 512MP per key. | Size is limited for the values cached. Values cached upto 1MB/Key. |
It’s powerful data types and powerful commands to leverage them(Hashes, Sorted Sets and many more..) | Good for multi-threaded environments. |
Redis is slower compared to Memcache. | Memcache is faster compared to REDIS. |
Use Cases – In which Scenario we need to think to choose Redis or Memcached:
Use Case | Benefits |
Web Session Store | In cases with load-balanced web-servers, store web session information in Redis so if a server is lost by any means, the session information is not lost and another web server can pick it up from there. |
Database caching | Use Memcached in front of AWS Relational Database(RDS) to cache popular queries to offload work from Relational Database(RDS) and return results faster to users. |
Leaderboards | Use Redis to provide a live leaderboard for millions of users of your mobile applications. |
Streaming data dashboards | Provide a landing spot for streaming sensor data on the factory floor, providing real/live-time dashboard for displays. |
Lab to create Redis cache service.
Step 1: Go to Services and search ElasticCache and click on GetStarted
Step 2: for learning purpose we are choosing Redis along with Cluster Mode enabled (Recommended for Production)
Step 3: Fill the necessary details like name of your cluster and choose t2.micro instance for learning purpose.
Note: kindly keep all settings as defaults and then click on Create
Soon you will see, you get a Redis cluster ready for use.
Note: Provide this cluster endpoint/URL to the developer so that developers can get started taking the leverage of this cluster.