Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
AWS · DVA-C03

Caching and performance bottlenecks

DVA-C03 · Lesson 24 of 24 · 3:17:11

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the DVA-C03 exam (AWS Certified Developer – Associate). In this lesson: finding bottlenecks with percentiles, latency metrics, trace maps, and DynamoDB Contributor Insights, cache hit rates and evictions, caching with ElastiCache, DAX, CloudFront, and the API Gateway stage cache, and AI-assisted performance analysis with Kiro. Includes three original practice questions.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

Two seconds per page

During the presale, the event page of AnyCompany Tickets took two seconds to load for the slowest requests. The function itself was fast: most of the time went to reading the same venue data again and again. This lesson covers finding bottlenecks, caching with ElastiCache, DAX and edge caches, and AI tools that point to optimizations.

Finding bottlenecks

A bottleneck is where the time goes, so start with CloudWatch percentiles, not averages: the ninety-ninth percentile latency shows the slow requests that an average hides. Then split the time: API Gateway latency against integration latency, the X-Ray trace map or the Application Signals service map for each dependency, and Lambda Insights for the CPU, the memory, and the cold starts of each function. For DynamoDB, throttled requests and consumed capacity show a table at its limit, and Contributor Insights lists the most accessed and the most throttled items, which reveals a hot partition. For a cache, the hit rate and the evictions show whether it works: below about eighty percent, many keys are evicted, expired, or never cached. And measure again after each change, under the same load, so that you know which change helped.

ElastiCache

When the same data is read again and again, cache it. With ElastiCache, the code reads the cache first, and on a miss, it reads the database, then writes the result with a TTL: the lazy loading of lesson eight. Name each key after what identifies the data, like venue, a colon, and its ID, and give hot data that changes, like the seats left, a TTL of a few seconds. A cache in a VPC is reached from the functions attached to that VPC, like the database. And for generative AI apps, ElastiCache for Valkey can also hold a semantic cache, which returns a stored answer for a question with the same meaning, instead of calling the model again.

DAX and edge caches

DAX is a write-through cache in front of DynamoDB, with the same API, so the code switches to the DAX client, and reads drop to microseconds. It keeps an item cache for GetItem and BatchGetItem, and a separate query cache for the results of Query and Scan, which updates to single items do not refresh until their TTL expires. Strongly consistent reads pass through to DynamoDB, without being cached, so DAX helps read-heavy workloads that accept eventually consistent reads. At the edge, CloudFront caches responses close to the fans: a cache policy keeps the cache key small, with only the query strings, headers, and cookies that change the response, and a Cache-Control max-age header from the origin sets how long objects stay cached. And API Gateway can cache the responses of a REST API stage, for three hundred seconds by default, and up to an hour.

AI tools

AI tools help find optimization opportunities. Kiro can read a function, together with its REPORT lines or a slow trace, and point out inefficient code, like a client created on every call, reads made one at a time that could be batched, or a scan where a query would do, then propose a change. A steering file, like the performance guide of the team, can be included in the chat, and a hook can review each saved file against it. A CloudWatch investigation can also start from a latency alarm, and suggest causes, like a recent deployment. And every suggestion is checked like any other change: with tests, and with the same metrics before and after.

Recap

Let's recap. Bottlenecks show up in percentiles, in the split between API Gateway and integration latency, in traces, and in Lambda Insights. Contributor Insights finds hot keys in DynamoDB, and the hit rate and evictions show whether a cache works. ElastiCache caches repeated reads with keys and TTLs, and DAX gives DynamoDB reads in microseconds. CloudFront and API Gateway cache responses, with small cache keys and the right TTLs. And Kiro, with steering files and hooks, suggests code optimizations that you test and measure.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. A DynamoDB table throttles reads during the presale, although its total capacity is far from used. The developer thinks that a few event IDs receive most of the reads. What should the developer use to confirm it?

    • The average latency of the table
    • A larger batch size on the table stream
    • Contributor Insights on the table
    • Point-in-time recovery on the table
    Show the answer

    Contributor Insights on the table

    Contributor Insights lists the most accessed and the most throttled items, which shows the hot event IDs. “The average latency of the table” would average the latency, which hides the hot keys. “A larger batch size on the table stream” would change how a stream is read, without showing which keys are hot. And “Point-in-time recovery on the table” would protect the table with backups, without any view of its traffic.

  2. The seat map of each event is read thousands of times per second from DynamoDB, with eventually consistent reads. The team wants reads in microseconds, with very few code changes. What should the developer add?

    • Strongly consistent reads on the table
    • A CloudFront distribution in front of the table
    • More read capacity for the table
    • A DAX cluster, with the DAX client
    Show the answer

    A DAX cluster, with the DAX client

    DAX caches the items in memory, with the same API, so reads drop to microseconds. “Strongly consistent reads on the table” would bypass any cache, and use more capacity. “A CloudFront distribution in front of the table” would cache HTTP responses, not reads from a DynamoDB table. And “More read capacity for the table” would absorb more reads, still in milliseconds.

  3. A developer wants an AI assistant to review a slow function and suggest code changes, like batched reads and reused clients, guided by the performance rules of the team. What should the developer use?

    • A composite alarm on the latency
    • Kiro, with a steering file of performance rules
    • DAX in front of every table
    • Provisioned concurrency on an alias
    Show the answer

    Kiro, with a steering file of performance rules

    Kiro reviews the code, and a steering file brings the performance rules of the team into its suggestions. “A composite alarm on the latency” would alert people when latency is high, without looking at the code. “DAX in front of every table” would cache table reads, without fixing the slow code. And “Provisioned concurrency on an alias” would remove cold starts, while the code stays just as slow.