top

Search

AWS Tutorials

Before understanding this service, it is essential to know one of the core concepts involved in this- Caching. It can be defined as a technique with the help of which very frequently required/accessed files/data (images, web pages) is stored in a temporary memory location on the server. Caching is used in most of the applications and one of the best use-case for this is applications that are read-intensive.  The ultimate goal of applications and websites is to serve user requests in a quick span of time, by maintaining the speed and performance of the application. This is when Amazon ElastiCache comes into the picture.  What is ElastiCache?It is a web caching service which is offered by Amazon as a part of their web services. It can be visualized as a caching layer, which is used by applications to serve users requests (Most of these responses would be data which is stored in the temporary location since it is very frequently accessed or required).  ElastiCache provides support to run in conjunction with Redis or Memcached based caching. Let us look at both of them.  Redis  This basically stands for REmoteDIctionary Server.  It is a relatively newer technology and is open-source. It provides responses in a very short time since it implements higher order algorithms.  It implements six fine-grained policies to purge old data.  Since it is a dictionary structure, it stores key-value pairs in the memory. These pairs of data which are (in-memory) can be used as objects in database, cache, message broker as well as queues.  Currently, Redis delivers responses within sub millisecond. This means it serves millions of requests every second and used extensively in real-time applications (which includes, but not limited to gaming, healthcare, internet of things, financial services, and AdTech).  Its presence can be seen in (but not limited to) session management, caching, real time analytics, media streaming, messaging, and publishing or subscribing applications.  Redis data stores data in the memory, which means the need to access disk is avoided, which reduces the response time further.  It consists of versatile data structure that is highly available, and comes with cluster support, making it simpler to build real-time scalable applications which are potentially used over the web.  It supports the use of data structures such as String, List, Set, Sorted Set, Hashes, Bitmaps, and Hyperloglogs.  It uses hashmap to store data objects in-memory.  Data in the form of key-value pairs can be stored up to 512 MB.  It comes with an added layer- a persistence layer, which supports complex data structures like hashes, and lists.  Redis can be used to build publish-subscribe models, and Lua scripting.  Lua scripting is done with the intention of improving the performance of the app as well as simplifying it.  Data can be replicated multiple times; hence it comes with automatic back-up and recovery options. This is achieved by taking snapshot of the data which is present in a certain state at a certain point in time.  It comes with programming support of Java, Python, C, C++, JavaScript, Ruby, Go, Node.js, C#, and much more.  Data is sorted or ranked inside the memory based on different criteria.  MemcachedThis basically means memory cached. It stores data in the memory, like Redis does, and implements high-performance caching. It implemented the LRU (Least Recently Used) algorithm. It is open-source and scalable, and delivers responses in sub millisecond of time. The only difference between Memcached and Redis is that Memcached is a distributed cache service, which is used with simple applications, since it is a simple model itself.  It is multi-threaded, meaning it supports processing on multiple cores, thereby handling more operations at every point in time, by scaling the compute capacity upwards. Since it used for simpler applications, Memcached doesn’t support the following features, which are present in Redis: Advanced data structures (String, List, Set, Sorted Set, Hashes, Bitmaps, Hyperloglogs) Data snapshot which could be used to recover or archive data Multiple replica of Redis primary, which can scale the database to provide highly available clusters Execution of a group of commands as a single, isolated and atomic operation. Executing transactional Lua scripts, which help improve performance, and simplify the application. Publisher/subscriber messaging applications, which are implemented with pattern matching and used in social media feeds, server intercommunication, and real-time commenting steams.  Built-in command to work with real-time geospatial data (finding distance between the 2 points, places, people). Every node has an endpoint which is essential since it helps recover data when necessary.Image credit: awas.amazon.comElastiCache is used as a Caching-as-a-service which is an offering from Amazon. Amazon provides support to set-up, manage and scale distributed in-memory environment which is implemented in the cloud (Redis and Memcached). The advantage of using Amazon services is that it helps the user avoid the complications behind deploying and managing such an environment.  ElastiCache improves the performance of applications by providing highly reliable solutions during critical production application deployments. TerminologiesElastiCache Node: Node is the basic block of Amazon ElastiCache Service. They are RAMs which are attached to one another in the network, and they can be uniquely identified with the help of a DNS name and a port.  ElastiCache cluster: Cluster is basically a collection of nodes. The working of a cluster depends on whether it is Memcached or Redis.RedisMemcachedRedis cluster will have a single node.Memcached has multiple nodes.This single node is the master node.Memcached is distributed, hence it has nodes in multiple availability zones.No data partitioning allowed, only replication.Data can be partitioned across every node.Provides back-up and restoration ability because the nodes can be replicated.Nodes can be added or removed when required.It implements publisher-subscriber model, which means client is well aware of the operations going on in the server.Database can be a cache object, and this is handled well by Memcached service.In all, ElastiCache is a service which manages, monitors, and supports operating of clusters and their caching in the cloud. It provides a pay-as-you-go model, which means the user only pays for what they use and there are no extra or hidden costs involved. It is highly recommended for applications that are required to have very less response time.   Conclusion In this post, we understood the meaning and significance of caching and Amazon’s caching service- ElastiCache. We also saw how Redis and Memcached services can be used to work on different requirements.
logo

AWS Tutorials

Caching and Amazon’s caching service - What is the Significance?

Before understanding this service, it is essential to know one of the core concepts involved in this- Caching. It can be defined as a technique with the help of which very frequently required/accessed files/data (images, web pages) is stored in a temporary memory location on the server. Caching is used in most of the applications and one of the best use-case for this is applications that are read-intensive.  

The ultimate goal of applications and websites is to serve user requests in a quick span of time, by maintaining the speed and performance of the application. This is when Amazon ElastiCache comes into the picture.  

What is ElastiCache?

It is a web caching service which is offered by Amazon as a part of their web services. It can be visualized as a caching layer, which is used by applications to serve users requests (Most of these responses would be data which is stored in the temporary location since it is very frequently accessed or required).  

ElastiCache provides support to run in conjunction with Redis or Memcached based caching. Let us look at both of them.  

Redis  

  • This basically stands for REmoteDIctionary Server.  
  • It is a relatively newer technology and is open-source. 
  • It provides responses in a very short time since it implements higher order algorithms.  
  • It implements six fine-grained policies to purge old data.  
  • Since it is a dictionary structure, it stores key-value pairs in the memory. 
  • These pairs of data which are (in-memory) can be used as objects in database, cache, message broker as well as queues.  
  • Currently, Redis delivers responses within sub millisecond. This means it serves millions of requests every second and used extensively in real-time applications (which includes, but not limited to gaming, healthcare, internet of things, financial services, and AdTech).  
  • Its presence can be seen in (but not limited to) session management, caching, real time analytics, media streaming, messaging, and publishing or subscribing applications.  
  • Redis data stores data in the memory, which means the need to access disk is avoided, which reduces the response time further.  
  • It consists of versatile data structure that is highly available, and comes with cluster support, making it simpler to build real-time scalable applications which are potentially used over the web.  
  • It supports the use of data structures such as String, List, Set, Sorted Set, Hashes, Bitmaps, and Hyperloglogs.  
  • It uses hashmap to store data objects in-memory.  
  • Data in the form of key-value pairs can be stored up to 512 MB.  
  • It comes with an added layer- a persistence layer, which supports complex data structures like hashes, and lists.  
  • Redis can be used to build publish-subscribe models, and Lua scripting.  
  • Lua scripting is done with the intention of improving the performance of the app as well as simplifying it.  
  • Data can be replicated multiple times; hence it comes with automatic back-up and recovery options. This is achieved by taking snapshot of the data which is present in a certain state at a certain point in time.  
  • It comes with programming support of Java, Python, C, C++, JavaScript, Ruby, Go, Node.js, C#, and much more.  
  • Data is sorted or ranked inside the memory based on different criteria.  

Memcached

This basically means memory cached. It stores data in the memory, like Redis does, and implements high-performance caching. It implemented the LRU (Least Recently Used) algorithm. It is open-source and scalable, and delivers responses in sub millisecond of time. The only difference between Memcached and Redis is that Memcached is a distributed cache service, which is used with simple applications, since it is a simple model itself.  

It is multi-threaded, meaning it supports processing on multiple cores, thereby handling more operations at every point in time, by scaling the compute capacity upwards. Since it used for simpler applications, Memcached doesn’t support the following features, which are present in Redis: 

  1. Advanced data structures (String, List, Set, Sorted Set, Hashes, Bitmaps, Hyperloglogs) 
  2. Data snapshot which could be used to recover or archive data 
  3. Multiple replica of Redis primary, which can scale the database to provide highly available clusters 
  4. Execution of a group of commands as a single, isolated and atomic operation. 
  5. Executing transactional Lua scripts, which help improve performance, and simplify the application. 
  6. Publisher/subscriber messaging applications, which are implemented with pattern matching and used in social media feeds, server intercommunication, and real-time commenting steams.  
  7. Built-in command to work with real-time geospatial data (finding distance between the 2 points, places, people). 

Every node has an endpoint which is essential since it helps recover data when necessary.

Amazon ElastiCache Engines | AWS TutorialImage credit: awas.amazon.com

ElastiCache is used as a Caching-as-a-service which is an offering from Amazon. Amazon provides support to set-up, manage and scale distributed in-memory environment which is implemented in the cloud (Redis and Memcached). The advantage of using Amazon services is that it helps the user avoid the complications behind deploying and managing such an environment.  

ElastiCache improves the performance of applications by providing highly reliable solutions during critical production application deployments. 

Terminologies

  • ElastiCache Node: Node is the basic block of Amazon ElastiCache Service. They are RAMs which are attached to one another in the network, and they can be uniquely identified with the help of a DNS name and a port.  
  • ElastiCache cluster: Cluster is basically a collection of nodes. The working of a cluster depends on whether it is Memcached or Redis.
RedisMemcached
Redis cluster will have a single node.Memcached has multiple nodes.
This single node is the master node.Memcached is distributed, hence it has nodes in multiple availability zones.
No data partitioning allowed, only replication.Data can be partitioned across every node.
Provides back-up and restoration ability because the nodes can be replicated.Nodes can be added or removed when required.
It implements publisher-subscriber model, which means client is well aware of the operations going on in the server.Database can be a cache object, and this is handled well by Memcached service.

In all, ElastiCache is a service which manages, monitors, and supports operating of clusters and their caching in the cloud. It provides a pay-as-you-go model, which means the user only pays for what they use and there are no extra or hidden costs involved. It is highly recommended for applications that are required to have very less response time.   

Conclusion 

In this post, we understood the meaning and significance of caching and Amazon’s caching service- ElastiCache. We also saw how Redis and Memcached services can be used to work on different requirements.

Leave a Reply

Your email address will not be published. Required fields are marked *