DVA-C02 domain - 18% of the exam

Troubleshooting and Optimization

Troubleshooting and Optimization is 18% of the DVA-C02 exam. These are the objectives it covers, each with practice questions, with every answer explained.

The domain in numbers

66
Practice questions
6
Objectives
56
Medium
10
Hard

Where people go wrong

  • Treating X-Ray metadata and annotations as interchangeable

    The wrong answers swap the two constructs. Metadata is offered as the way to filter traces by customer tier, and annotations are offered as the place for a large nested request object. Annotations are indexed key value pairs limited to simple scalar values, so they work in filter expressions and for grouping traces. Metadata holds arbitrary nested objects for reading on an individual trace but is never indexed, so a filter expression cannot use it. A searchable tier is an annotation; a debug payload is metadata.

    See it in a sample question
  • Confusing the CloudWatch Logs features

    The wrong answers pick a neighbouring feature that sounds close. A metric filter turns matching lines into a numeric metric and discards the event content, so it cannot list requestId values or feed an analytics platform. A subscription filter streams new events continuously to Kinesis or Lambda, which is heavy for a one hour query. Export to S3 copies data without deleting it, and only a log group retention policy expires old events. Logs Insights queries in place but does not raise alarms.

    See it in a sample question
  • Treating reserved and provisioned concurrency as the same control

    The wrong answers give each setting the other's job. Reserved concurrency caps and guarantees how many instances a function may run, carving a slice out of the shared account pool, but it does not pre-initialise any environment, so cold starts remain. Provisioned concurrency keeps environments initialised and warm, yet it still counts against the account quota and does not isolate a busy function from the others. Isolation needs reserved concurrency; removing cold starts, including on a schedule through Application Auto Scaling, needs provisioned concurrency.

    See it in a sample question
  • Mixing up X-Ray faults, errors and throttles

    The wrong answers merge categories that X-Ray keeps apart. Faults are 5xx server-side responses and show as a red node, so a high fault rate points at the dependency failing internally. Errors are 4xx responses, so rising edge errors beside a healthy node point at the caller sending requests the service rejects. Throttles, such as a 429, form their own category and are not rolled into the fault rate. Latency is not a status flag: a slow 200 is recorded as successful.

    See it in a sample question
  • Using PutMetricData or a metric filter where the embedded metric format fits

    The wrong answers reach for an API call or a log filter instead of the embedded metric format. PutMetricData, even batched, leaves a call to manage in the handler, and a metric filter needs a separate filter per metric and dimension. The embedded metric format writes one structured log line and CloudWatch extracts the metric asynchronously. The directive lives in a top-level _aws node holding a CloudWatchMetrics block with the namespace, dimension sets and metrics; a bare Dimensions array or StatisticValues is not that directive.

    See it in a sample question

Objectives in this domain

What to study

The official documents this domain's practice questions cite most.

Sample questions from this domain

Free sampleTroubleshooting and Optimizationmedium

A developer uses the AWS X-Ray SDK inside a Lambda function and wants to attach the customer tier to each trace so that traces can later be filtered and grouped by tier in the X-Ray console. The value must be indexed so it can be used in a filter expression. Which X-Ray feature should the developer add to the segment?

  • AAdd the customer tier as segment metadata, because metadata fields are indexed by X-Ray and become available as keys in trace filter expressions.
  • BAdd the customer tier to the structured log line, because X-Ray reads CloudWatch log fields and exposes them as indexed keys in filter expressions.
  • CAdd the customer tier as a subsegment name, because X-Ray indexes subsegment names and lets you filter traces using the recorded name value.
  • DAdd the customer tier as a segment annotation, because annotations are indexed by X-Ray and can be used directly in trace filter expressions. Correct
Use indexed X-Ray annotations, not metadata, when a trace value must be searchable in filter expressions. X-Ray annotations are key value pairs that the service indexes, which makes them usable in filter expressions to search and group traces, whereas metadata is recorded but never indexed and so cannot drive filtering.

Why A is wrong: Metadata is stored with the trace for context but is not indexed, so it cannot be used in a filter expression to search or group traces by tier.

Why B is wrong: X-Ray does not index CloudWatch log fields into trace filter expressions, so writing the tier only to logs leaves traces unsearchable by that value.

Why C is wrong: Subsegment names describe units of work and are not a place for variable business keys, and renaming them per tier would break the timing view rather than enable filtering.

Why D is correct: Annotations are key value pairs that X-Ray indexes, so the tier becomes searchable and can group traces through a filter expression on that annotation key.

Free sampleTroubleshooting and Optimizationmedium

A developer is investigating intermittent failures in a Lambda function whose JSON logs go to Amazon CloudWatch Logs. Each log event includes a level field and a requestId field. The developer needs to list, for the past hour, every event where level is ERROR together with its requestId, sorted with the most recent first, without exporting the logs anywhere. Which approach should the developer use?

  • ACreate a metric filter on the log group that matches the ERROR pattern, then read the resulting metric data points to see the failing requestId values for the hour.
  • BCreate a subscription filter on the log group that streams ERROR events to Amazon Kinesis Data Firehose, then inspect the delivered objects to find the requestId values.
  • CRun a CloudWatch Logs Insights query over the log group that filters on level equals ERROR, displays the requestId field, and sorts by timestamp descending for the last hour. Correct
  • DEnable CloudWatch Contributor Insights on the log group with a rule keyed on requestId, then read the top contributor report to list the failing requests for the hour.
Use CloudWatch Logs Insights to filter on a field, display chosen fields, and sort by time when diagnosing application errors in place. CloudWatch Logs Insights runs queries directly against a log group, so filtering on the parsed level field, projecting the requestId field, and sorting by timestamp returns the exact failing events in time order without exporting the data or building any pipeline.

Why A is wrong: A metric filter only emits a numeric count to a CloudWatch metric and cannot return the requestId field values, so it shows how many errors occurred but not which requests failed.

Why B is wrong: A subscription filter is built for continuous delivery to another service, so it adds a Firehose and storage hop and is far heavier than an ad hoc query for a one-hour investigation.

Why C is correct: Logs Insights queries the log group in place, so a filter on level with a fields and sort by timestamp returns the matching ERROR events and their requestId values newest first without any export.

Why D is wrong: Contributor Insights ranks the top contributors by a key rather than listing every matching event with its fields, so it cannot return the full time ordered set of ERROR events.

Free sampleTroubleshooting and Optimizationmedium

During a marketing event, one Lambda function begins returning TooManyRequestsException with a Throttles metric climbing in CloudWatch, while several other functions in the same account also slow down. No reserved concurrency is set on any function, and the account is near its regional concurrent execution quota. The developer must stop this one function from starving the others while still letting it serve as many requests as the account allows it. Which action resolves the throttling correctly?

  • ASet provisioned concurrency on the busy function equal to its peak demand, since pre-warmed environments are billed separately and therefore do not draw from the shared account concurrency pool during the event.
  • BIncrease the busy function's memory allocation so each invocation completes faster, freeing concurrency sooner and indirectly giving the other functions more room within the same account quota.
  • CRequest that the unreserved concurrency floor be lowered for the account so the busy function is forced to share, which automatically rebalances capacity toward the functions that are being throttled.
  • DSet reserved concurrency on the busy function to a defined share of the account quota, which caps that function and leaves the remaining unreserved pool available to the other functions. Correct
Use per-function reserved concurrency to isolate a high-traffic Lambda function and protect other functions sharing the account concurrency quota. All functions without reserved concurrency draw from one shared account pool, so a single busy function can exhaust it and throttle others. Setting reserved concurrency on that function both caps its maximum and reserves that capacity away from the pool, guaranteeing the remaining functions keep concurrency while the busy one still scales up to its reserved limit.

Why A is wrong: Provisioned concurrency still counts against the account concurrency quota and only addresses cold starts, so it does not stop the function from contending for the shared pool and starving others.

Why B is wrong: Faster invocations may release slots a little sooner but offer no guaranteed isolation, so under sustained event traffic the function can still monopolise the shared pool and throttle the others.

Why C is wrong: There is no setting that lowers an unreserved floor to rebalance per function, and the real control for isolating one function is its own reserved concurrency rather than an account-wide change.

Why D is correct: Reserved concurrency carves a fixed slice for the busy function and removes it from the shared pool, so the function cannot consume all account concurrency and the other functions keep their own capacity.

Free sampleTroubleshooting and Optimizationmedium

A developer reviews an AWS X-Ray service map for a checkout service and sees a downstream node coloured red, with the edge statistics reporting a high fault rate. The developer must decide what category of problem this red node and fault rate represent before opening individual traces. Which interpretation is correct?

  • AFaults indicate client errors in the 4xx range, so the calling service is sending malformed requests that the downstream node is correctly rejecting before any processing.
  • BFaults indicate throttling responses, so the downstream node is rejecting requests for exceeding a rate limit and the developer should raise the provisioned capacity on it.
  • CFaults indicate successful but slow responses, so the node is returning 2xx results that simply breach the latency target and need a performance tuning pass rather than error handling.
  • DFaults indicate server errors in the 5xx range, so the downstream node is failing to fulfil requests and the developer should inspect that dependency for internal failures. Correct
X-Ray classifies 5xx responses as faults, 4xx as errors, and rate limits as throttles, so a high fault rate points at server-side failures. On the X-Ray service map, errors map to 4xx client responses, faults map to 5xx server responses, and throttles are counted separately. A red node with a high fault rate therefore signals that the downstream dependency is failing internally, directing the root cause analysis to that service rather than to the caller.

Why A is wrong: This is tempting because 4xx responses do signal caller mistakes, but X-Ray classes 4xx as errors rather than faults, so a high fault rate does not point at malformed client requests.

Why B is wrong: Throttling is a separate X-Ray category tracked apart from faults, so a high fault rate is not by itself evidence of rate limiting and raising capacity may not address it.

Why C is wrong: Slow successful responses are 2xx and are reflected in latency, not in the fault rate, so treating a fault as a latency issue would send the developer to the wrong remedy.

Why D is correct: X-Ray defines faults as 5xx server-side errors, so a red node with a high fault rate means the dependency itself is failing internally, which is exactly where the developer should focus the investigation.

Free sampleTroubleshooting and Optimizationmedium

A developer wants a high-traffic Lambda function to publish a custom metric for the size of each order it processes. Calling the metrics API once per invocation has started to add latency and cost at scale, and the team wants the metric to appear in CloudWatch without managing batched API requests in the handler. Which approach should the developer use?

  • ALog a structured JSON object in the embedded metric format so CloudWatch parses the log entry and publishes the custom metric without a separate metrics API call. Correct
  • BCall PutMetricData on a schedule from the function, batching the metric values together so the application avoids the cost of one API request per invocation.
  • CWrite the metric only to the function log stream as plain text and build a CloudWatch Logs metric filter later to extract the numbers into a custom metric.
  • DSend each metric to a CloudWatch dashboard widget directly from the handler, relying on the dashboard to retain the values as a queryable custom metric over time.
Use the CloudWatch embedded metric format to emit custom metrics through structured logs instead of per-invocation PutMetricData calls. The embedded metric format encodes metric values and their metadata as structured JSON inside the function's CloudWatch Logs output, and CloudWatch asynchronously parses those log events to create the custom metric, so the application avoids synchronous PutMetricData calls and the latency and cost of one metrics request per invocation.

Why A is correct: The embedded metric format lets the function write structured JSON to its logs, and CloudWatch automatically extracts the values as custom metrics, removing any direct PutMetricData call from the request path.

Why B is wrong: Batching PutMetricData still requires the developer to buffer values, manage the call and handle its failures, which is exactly the in-handler API management the team wants to avoid.

Why C is wrong: A metric filter on unstructured text can count log patterns but does not natively capture a numeric value as a dimensioned metric the way the embedded metric format does, so it fits poorly here.

Why D is wrong: Dashboards only visualise metrics that already exist and cannot ingest values pushed from a handler, so they neither store nor create a custom metric from the order size.

Other domains in this exam

See also the DVA-C02 cert hub, the study guide, and the cheat sheet.

Examworthy is not affiliated with or endorsed by Amazon Web Services. Original, blueprint-aligned practice material only.