All guides
Practice now
D3 · High performance

Caching: ElastiCache, DAX and CloudFront

Caching is fundamental to high-performance architectures. The exam tests when to use each type: ElastiCache for applications, DAX for DynamoDB, CloudFront for web content. It also tests caching patterns like lazy loading and write-through.

Icon-Architecture/48/Arch_Amazon-ElastiCache_48

Why use caching

Caching reduces by storing frequently accessed data in memory — orders of magnitude faster than disk or a database. It also reduces load on the database, letting you serve more traffic with the same infrastructure.

~10 ms

Database (HDD)

~1 ms

Database (SSD)

~0.1 ms

In-memory (Redis)

Icon-Architecture/48/Arch_Amazon-ElastiCache_48

ElastiCache Redis vs Memcached

FeatureRedisMemcached
PersistenceYes (RDB + AOF snapshots)No (memory only)
Replication / Multi-AZYes — read replicas + failoverNo
Clustering / ShardingCluster Mode (horizontal sharding)Native multi-thread per node
Data structuresStrings, hashes, sets, sorted sets, lists, HyperLogLogSimple strings only
Pub/SubYesNo
Backup / RestoreYesNo
ThreadsSingle-thread per core (Cluster Mode = multi-node)Native multi-thread
Use caseSessions, leaderboards, pub/sub, cache with HASimple object cache, multi-thread

Choose Redis when...

  • →You need data persistence (data survives a restart)
  • →You require with Multi-AZ
  • →User sessions that must NOT be lost
  • →Leaderboards with sorted sets
  • →Pub/Sub messaging between services
  • →Data with TTL and automatic expiration

Choose Memcached when...

  • →A pure object cache with no HA requirement
  • →You need maximum multi-thread throughput
  • →Simple data (key-value with no complex structures)
  • →It's fine to lose the cache (it rebuilds from the DB)
  • →You need to in a simple way

Practical rule for the exam

If the question mentions any of these words → Redis: "sessions", "persistence", "Multi-AZ", "replication", "pub/sub", "sorted sets", "leaderboards". If it says "simple cache", "objects", "multi-thread", "no HA requirement" → Memcached.

Icon-Architecture/48/Arch_Amazon-DynamoDB_48

DynamoDB DAX

DAX (DynamoDB Accelerator) is a fully managed in-memory cache cluster, purpose-built for . It reduces read latency from milliseconds to microseconds.

How it works

1

Your app uses the DAX SDK instead of the DynamoDB SDK

2

DAX first checks its in-memory cache

3

Cache hit: response in microseconds

4

Cache miss: DAX queries DynamoDB and caches the result

5

Your application code doesn't change — same DynamoDB API

DAX vs ElastiCache for DynamoDB

DAX

DynamoDB-specific cache. Transparent to the app. Understands the DynamoDB data model.

ElastiCache (Redis)

General-purpose cache. Requires app-level logic to manage the cache. Can cache results from multiple sources.

DAX signal in the exam

"Microsecond latency for DynamoDB" or "thousands of reads per second on DynamoDB" → DAX. DAX does not help with write operations.

Icon-Architecture/48/Arch_Amazon-CloudFront_48

as a content cache

CloudFront isn't just a CDN for static content — it also caches dynamic API responses and can dramatically reduce latency for global users.

Cache TTL

How long CloudFront caches an object. Set via Cache-Control or Expires headers from the origin, or via a CloudFront Cache Policy.

EXAM: TTL 0 = no caching (for dynamic APIs). High TTL = for static assets with a hash in the filename.

Cache Key

Which elements of the request make up the cache key. By default just the URL. Can include headers, cookies, or query strings.

EXAM: Include the query string in the cache key for: ?lang=es → cached separately from the Spanish version.

Origin Shield

An extra caching layer between Edge Locations and the origin. Reduces origin requests by up to 60%.

EXAM: "Reduce load on the origin server" with CloudFront → enable Origin Shield.

Invalidations

Forces CloudFront to discard cached objects. Useful after deploying new versions of code/assets.

EXAM: Invalidate /index.html and /app.*.js after a deploy. First 1,000 paths/month are free.
Icon-Architecture/48/Arch_Amazon-ElastiCache_48

Caching patterns

Lazy Loading (Cache-Aside)

You only cache on a cache miss. The app first checks the cache; if it's not there, it queries the DB and writes it into the cache.

Pros

+Only caches data that is actually used

+The cache can fail without breaking the app

Cons

-First access is slow (cache miss)

-Data can become stale

Write-Through

Every write to the DB also updates the cache. Cached data is always fresh.

Pros

+No stale data

+Cache is always warm for written data

Cons

-Slower writes (2 operations)

-May cache data that is never read

TTL — Time To Live

Every caching pattern should include a TTL to avoid stale data indefinitely. The ideal TTL depends on how often the data changes: user sessions (30 min), search results (5 min), user profile (1 hour), product catalog (24 hours).

Did you get this topic?

Test what you just learned

A web application has an RDS database with slow read queries that are hurting the user experience. The product catalog data rarely changes (1-2 times a day). Which caching pattern and service are most appropriate?

Ready to test "Caching: ElastiCache, DAX and CloudFront"?

Put what you learned to the test with original SAA-C03 exam questions.

Start SAA-C03 mock exam

Unlimited mock exams with the Pro plan

Log in to track your progress.