To get the high performance, we generally cache the most frequent data in memory, Application developers can improve the performance of the application response when the most frequent data is saved in memory.
This features is provided by Amazon with the help of Amazon ElastiCache service.
It is the Web service that setup management of distributed in-memory caching environment for cloud based application. With the use of Amazon ElastiCache in your application, it helps to speed the deployment of cache clusters.
With the use of Amazon ElastiCache, large number of caching pattern can be implemented. The most common pattern is the cache-aside pattern shown in figure:
In this app servers check the cache first to check if the data available is in cache or not , and if required data is not in cache node , then it query to the database and write the query results to cache , now when next user want to read the data , they directly access form cache instead of querying database.
There are two types of Amazon ElastiCache which allow you to quickly deploy clusters: Memcached and Redis.
It allow you to write and read object into in-memory Key/value data stores. With this you can elastically grow and shrink a cluster of Memcached nodes to meet your demands. Memcached data can be referenced as object and these objects can be accessed by a unique key. There are following version of Memcached starts from 1.4.5 to 1.4.24 which Amazon Elasticache supports.
Amazon ElastiCache supports to deploy Redis Clusters from version 2.8.24 to older versions. Redis supports rich set of data type’s likes strings, Lists, and sets. Redis has ability to persist in-memory data on to disk, which further helps to create snapshots that backup your data and then recover or replicate from backups. Redis clusters supports up to 5 read replicas to offload read requests. In case of failure of primary node, read replica can be promoted and become new master using Multi-AZ replication groups.