Courseiva

DVA-C02 Troubleshooting and Optimization Practice Question

A developer is optimizing an API Gateway REST API that uses Lambda integration. The response times are high, and CloudWatch logs show that the Lambda function has cold starts frequently. The function is written in Java and uses a large library. What is the MOST effective optimization?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Enable provisioned concurrency on the Lambda function.

The most effective optimization is C: enabling provisioned concurrency on the Lambda function, because it pre-initializes execution environments so that invocations are served by already-warm instances, eliminating the cold starts that CloudWatch logs show are frequent. This directly addresses the Java runtime's heavy initialization cost caused by the large library, without changing application code. Option A is a major rewrite that may reduce cold start duration but does not guarantee elimination and changes the technology stack. Option B increases memory and can proportionally speed initialization, but cold starts would still occur. Option D may modestly improve Java initialization, but it does not prevent cold starts the way provisioned concurrency does.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Rewrite the function in Node.js to reduce cold start time.

    Why it's wrong here

    While Node.js runtimes generally have smaller footprints and faster initialization compared to Java, leading to potentially quicker cold starts, rewriting an existing function is a substantial development undertaking. This effort involves significant refactoring, testing, and potential introduction of new bugs, making it a costly and time-consuming optimization. Furthermore, even with a faster runtime, cold starts are not entirely eliminated, only potentially reduced in duration, and this approach does not guarantee consistent low latency for every invocation.

  • ✗

    Increase the Lambda function's memory allocation to 3008 MB.

    Why it's wrong here

    Increasing a Lambda function's memory allocation directly provides more CPU and network bandwidth to the execution environment, which can significantly reduce the function's execution duration for compute-bound or I/O-intensive tasks. This improves overall response time once the function is running. However, memory allocation does not influence the initial cold start phase, which involves downloading the code, initializing the runtime, and executing global code; a cold start will still occur, regardless of the allocated memory.

  • ✓

    Enable provisioned concurrency on the Lambda function.

    Why this is correct

    Enabling provisioned concurrency on a Lambda function explicitly pre-initializes a specified number of execution environments, keeping them warm and ready to process invocations immediately. This mechanism directly bypasses the cold start process, as the runtime and function code are already loaded and initialized before an invocation arrives. For API Gateway integrations, this ensures consistent, low-latency responses by eliminating the variable startup time associated with cold starts, which is critical for user-facing applications.

  • ✗

    Use the AWS SDK for Java 2.x to reduce initialization time.

    Why it's wrong here

    The AWS SDK for Java 2.x is designed with a modular architecture and non-blocking I/O, which can lead to a smaller memory footprint and faster startup times compared to the older 1.x version. While upgrading to SDK 2.x might marginally reduce the initialization phase during a cold start, it is an optimization within the cold start process itself. This change does not prevent the cold start event from occurring; the underlying Java Virtual Machine (JVM) still needs to spin up and load the application code and dependencies.

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

About these practice questions

Courseiva writes every DVA-C02 question from scratch — 1,135 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DVA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DVA-C02 exam.