Skip to main content

Command Palette

Search for a command to run...

AWS Service - ElastiCache

Published
•2 min read•View as Markdown
B

I currently work

ElastiCache:

  • Overview

    • The same way RDS is to get managed Relational Databases

    • ElastiCache is to get managed Redis or Memcached

    • Caches are in-memory databases with really high performance, low latency

    • Helps reduce load off of databases for read intensive workloads

    • Helps make your application stateless

    • AWS takes care of OS maintenance / patching, optimizations, setup, configuration, monitoring, failure recovery and backups

    • Note: Using ElastiCache involves heavy application code changes

  • Solution Architecture - DB Cache

    • Applications queries ElastiCache, if not available, get from RDS and store in ElastiCache

    • Helps relieve load in RDS

    • Cache must have an invalidation strategy to make sure only the most current data is used in there

  • Solution Architecture – User Session Store

    • User logs into any of the application

    • The application writes the session data into ElastiCache

    • The user hits another instance of our application

    • The instance retrieves the data and the user is already logged in

  • ElastiCache - Redis

    • Multi AZ with Auto-Failover

    • Read Replicas to scale reads and have high availability

    • Data Durability using AOF persistence

    • Backup and restore features

    • Supports Sets and Sorted Sets

  • ElastiCache - Memcached

    • Multi-node for partitioning of data (sharding)

    • No high availability (replication)

    • Non persistent

    • No backup and restore

    • Multi-threaded architecture

  • Cache Security

    • ElastiCache supports IAM Authentication for Redis

    • IAM policies on ElastiCache are only used for AWS API-level security

    • Redis AUTH

      • You can set a “password/token” when you create a Redis cluster

      • This is an extra level of security for your cache (on top of security groups)

      • Support SSL in flight encryption

    • Memcached

      • Supports SASL-based authentication
  • Patterns for ElastiCache

    • Lazy Loading: all the read data is cached, data can become stale in cache

    • Write Through: Adds or update data in the cache when written to a DB (no stale data)

    • Session Store: store temporary session data in a cache (using TTL features)

  • Redis Use Case

    • Gaming Leaderboards are computationally complex

    • Redis Sorted sets guarantee both uniqueness and element ordering

    • Each time a new element added, it’s ranked in real time, then added in correct order

Relevant Doc:

https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/WhatIs.html

https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/WhatIs.html

Disclaimer: This is a personal blog that might come in handy when I suffer from Dementia in future.

More from this blog