ElastiCache
인메모리 캐시로 DB 부하를 걷어내고 지연시간을 낮춤
이게 뭔가요? / What is this?
ElastiCache는 데이터베이스가 아니라, 자주 찾는 정보를 데이터베이스 앞에 미리 꺼내 놓는 관리형 인메모리 임시 저장소입니다. 매번 서류 창고까지 가지 않도록 자주 쓰는 서류를 책상 위 포스트잇에 적어 두는 것과 비슷해서, 같은 질문이 반복될 때 느린 원본 대신 이 빠른 메모를 먼저 보여줍니다.
개요 / Overview
ElastiCache는 Redis 또는 Memcached를 관리형으로 제공합니다. "같은 쿼리가 반복된다", "DB CPU가 포화 상태", "세션 상태를 공유해야 한다"는 문제에서 정답이 됩니다. 두 엔진 중 어느 쪽인지 고르는 문제도 자주 나옵니다.
동작 원리 / How it works
ElastiCache는 Redis 또는 Memcached 노드를 VPC 안에 띄워 줍니다. 캐시는 데이터베이스 앞에 놓여 같은 조회의 반복을 흡수하는데, 이 흡수를 애플리케이션 코드가 직접 구현해야 합니다 — 캐시를 먼저 보고, 없으면 DB에서 읽어 캐시에 채우고(Lazy Loading), TTL로 오래된 항목을 버리는 흐름입니다.
Redis는 단일 스레드로 동작하지만 복제와 자동 장애 조치(Multi-AZ), 영속성(AOF·스냅샷), 정렬 집합 같은 자료구조를 지원합니다. Memcached는 멀티스레드로 단순 캐시를 수평 확장하지만 복제도 영속성도 없어 노드가 죽으면 그 몫의 캐시가 사라집니다.
시험은 무엇을 보는가 / What the exam is testing
시험은 ElastiCache로 두 가지를 봅니다. 하나는 "지연시간 문제의 원인이 반복 조회인지" 진단하는 능력, 다른 하나는 Redis와 Memcached 중 어느 쪽인지 고르는 능력입니다. 고가용성·영속성·리더보드·세션 유지가 나오면 Redis입니다.
시험 포인트 / Exam points
Redis는 영속성, 복제, 자동 장애 조치, 정렬 집합 같은 자료구조를 지원합니다. Memcached는 단순 캐시이며 멀티스레드로 수평 확장만 합니다. "고가용성", "데이터 유지", "리더보드"가 나오면 Redis입니다.
ALB 뒤 여러 EC2가 세션을 공유해야 할 때 ElastiCache Redis에 세션을 두면 무상태 서버가 됩니다. 스티키 세션 대신 권장되는 구조입니다.
Lazy Loading은 미스가 날 때만 채워 메모리를 아끼지만 첫 요청이 느립니다. Write-Through는 쓰기 시 캐시도 갱신해 항상 최신이지만 쓰기가 무거워집니다. TTL로 오래된 데이터를 정리합니다.
자주 틀리는 함정 / Common traps
고가용성이 필요한 세션 저장소에 Memcached를 고르는 것 — 복제가 없어 노드 장애 시 세션이 날아갑니다.
쓰기가 지배적인 워크로드에 캐시를 추가하는 것 — 무효화 비용이 이점을 상쇄합니다.
ElastiCache
In-memory cache that removes database load and cuts latency
이게 뭔가요? / What is this?
ElastiCache is not a database — it is a managed in-memory holding area placed in front of a database for frequently requested data. It is like keeping sticky notes with commonly needed facts on a desk instead of walking to the archive room every time — when the same question comes up again, the fast sticky note is checked before the slow original.
개요 / Overview
ElastiCache offers managed Redis or Memcached. It answers "the same query repeats", "the database CPU is saturated", and "sessions must be shared". Choosing between the two engines is itself a common question.
동작 원리 / How it works
ElastiCache runs Redis or Memcached nodes inside your VPC. A cache sits in front of the database absorbing repeated reads, but the application must implement that absorption: check the cache, on a miss read the database and populate (lazy loading), and let TTLs evict staleness.
Redis is single-threaded yet supports replication with automatic failover (Multi-AZ), persistence (AOF and snapshots), and rich structures such as sorted sets. Memcached is multi-threaded and scales a simple cache horizontally but has neither replication nor persistence, so a dead node loses its share of the cache.
시험은 무엇을 보는가 / What the exam is testing
ElastiCache tests diagnosing whether a latency problem is repeated reads, then choosing Redis or Memcached. High availability, persistence, leaderboards, or session durability all mean Redis.
시험 포인트 / Exam points
Redis supports persistence, replication, automatic failover, and rich data structures. Memcached is a simple multi-threaded cache that only scales out. "High availability", "durability", or "leaderboard" → Redis.
Storing sessions in ElastiCache Redis makes EC2 instances behind an ALB stateless — preferred over sticky sessions.
Lazy loading fills only on a miss, saving memory but slowing first reads. Write-through updates the cache on write, keeping data fresh at the cost of heavier writes. TTLs evict staleness.
자주 틀리는 함정 / Common traps
Choosing Memcached for a session store that needs high availability — without replication, a node failure loses sessions.
Adding a cache to a write-dominated workload — invalidation overhead cancels the benefit.
AWS SAA Hub Pro는 독립 학습 자료이며 Amazon Web Services, Inc.의 공식 서비스가 아닙니다. 시험 정책과 서비스 사양은 AWS 공식 문서를 기준으로 확인하세요.