Byte Ebi's Logo

Byte Ebi 🍀

A Bit everyday A Byte every week

[AWS Cloud Fundamental Notes] ElastiCache

Introduction to ElastiCache and its usage and operational mechanism

Ray

Cloud caching service with two underlying engines: Redis and Memcached .
It can assist in implementing Shard.

Use cases:

  • Temporary state
  • Data that is frequently read but infrequently written to the database

Terminology

Lazy Loading

Data is only written to the cache when a user first retrieves it from the database.

  • Pros: Only queried data is cached, saving memory space.
  • Cons: Initial access to data may be relatively slow.

Write Through

Data is written to the cache every time it is written to the database.

  • Pros: No need to wait for a query when reading data after it’s been written.
  • Cons: Cache space is occupied by infrequently accessed data.

Redis

Amazon ElastiCache for Redis

In-memory database

Adjust parameters and performance tuning through Parameter Groups.

A Subnet Group must be defined first. Then ElastiCache will open nodes in the subnet group.

Nodes will use multiple shards to store data, distributing shards across multiple nodes to prevent data loss in case of node failure.

Also, has a Snapshot feature.

Subnet Group

A collection of subnets where ElastiCache places nodes.

Node

A server hosting the ElastiCache application, each with its own domain name.

Shard

In cluster mode, Redis divides data into multiple parts, each stored on multiple Redis Nodes called Shards, which can improve read efficiency and availability.

Memcached

Can be clustered, distributing data across multiple nodes.
However, it does not use sharding, so if a node fails, the data is lost.

ElastiCache’s recommendation is to open more nodes so that the amount of lost data is reduced.
Since Memcached’s data is not synchronized across nodes, it is possible to read from the wrong node.

Auto Discovery

To address the issue of Memcached potentially reading from the wrong node, Auto Discovery allows users to automatically discover the correct node when searching for data.

Recent Posts

Categories

Tags