[ AWS ElastiCache ]

- 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

- Write Scaling using sharding (파편화)

- Read Scaling using Read Replicas

- Multi AZ with Failover Capability

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

 

[ ElastiCache Solution Architecture - DB Cache ]

app 은 elasticache 에 우선적으로 쿼리한 후 존재하지 않을 경우(miss) RDS 에서 SELECT, cache 에 write

다음번 동일한 데이터를 읽을 땐 캐시에 존재 (hit)]

 

[ ElastiCache Solution Architecture - User Session Store ]

앱에 로그인을 한 후 session data 를 Elasticache 에 저장.

유저가 다른 인스턴스에서 접속 할 경우 elasticache 에서 세션정보를 가져와 로그인 유지상태로 만듬. 

매번 인증이 필요없음.

 

[ Redis vs Memcached ]

* Redis (RDS와 비슷) 

 - Multi AZ with Auto-Failover

 - Read Replicas to scale reads and have high availability

 - Data Durability using AOF persistence

 - Backup and restore features

 

* Memcached

 - Multi-node for partitioning of data (sharding)

 - Non persistent

 - No backup and restore

 - Multi-threaded architecture

 

[ ElastiCache - Cache Security ]

1. All caches in ElastiCache :

  - Support SSL in flight encryption

  - Do not support IAM authentication *** 

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

2. Redis AUTH

  - You can set a pw/token when you create a Redis cluster

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

3. Memcached

  - Supports SASL-based authentication (advanced)

 

[ # ElastiCache for Solutions Architects ] 

캐시데이터를 읽는 경우 캐시에 저장된 데이터는 방금 꺼내온 데이터가 아니므로 stale 함. (Lazy Loading)

DB에서 데이터를 쓸 경우 cache 에도 추가 및 수정을 한다 (Write Through)

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)

 

 

 

반응형

'infra & cloud > AWS' 카테고리의 다른 글

[AWS] 6. Beanstalk  (0) 2021.03.29
[AWS] 5-1. Route 53  (0) 2021.03.24
[AWS] 4-2. Aurora  (0) 2021.03.23
[AWS] 4-1. RDS, Read Replicas, DR  (0) 2021.03.22
[AWS] 3-2. EBS Snapshots, EFS, Instance Storage  (0) 2021.03.20

+ Recent posts