Courseiva
Development with AWS ServicesmediumMultiple ChoiceObjective-mapped

DVA-C02 Development with AWS Services Practice Question

A developer is building a serverless application using AWS Lambda to process events from an Amazon SQS queue. The Lambda function is CPU-bound and currently experiences timeouts. What is the MOST cost-effective way to reduce execution time?

⚠ Common exam trap

Test-takers frequently assume increasing memory only helps memory-bound workloads, but AWS Lambda's CPU allocation scales with memory, making it the primary lever for CPU-bound performance improvements.

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

Increase the Lambda function's memory allocation

Increasing the Lambda function's memory allocation is the most cost-effective way to reduce execution time for a CPU-bound function because Lambda allocates CPU proportionally to memory. More memory means more vCPU capacity, which directly speeds up CPU-bound processing. This reduces the function's duration, and since Lambda billing is based on compute time (GB-seconds), the total cost can decrease even if the per-GB-second rate is higher.

Answer analysis

Option-by-option breakdown

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

  • Increase the SQS batch window size

    Why it's wrong here

    Increasing the SQS batch window size primarily affects how long Lambda waits to accumulate messages before invoking the function, up to a maximum of 300 seconds. This setting optimizes cost and throughput by reducing the number of Lambda invocations for a given volume of messages. However, it has no direct impact on the CPU performance or execution speed of an individual Lambda function once it has been invoked and is processing its batch of messages.

  • Switch the Lambda runtime from Python to Node.js

    Why it's wrong here

    Switching runtimes from Python to Node.js does not inherently guarantee improved performance for CPU-bound tasks. While different runtimes have varying performance characteristics, the core issue of a CPU-bound workload is the computational intensity, not typically the language's interpreter overhead in this context. Optimizing the algorithm or providing more computational resources is generally more effective than a mere runtime swap for such scenarios.

  • Increase the Lambda function's memory allocation

    Why this is correct

    Increasing a Lambda function's memory allocation is the most direct and effective way to improve performance for CPU-bound tasks. AWS Lambda provisions CPU power proportionally to the configured memory. Therefore, allocating more memory provides the function with a larger share of CPU resources, enabling it to complete computationally intensive operations faster and reduce overall execution time.

  • Enable Provisioned Concurrency for the function

    Why it's wrong here

    Enabling Provisioned Concurrency for a Lambda function ensures that a specified number of execution environments are pre-initialized and ready to respond immediately. This feature significantly reduces cold start latencies, improving the responsiveness of applications, especially those with infrequent invocations. However, Provisioned Concurrency does not enhance the CPU performance or reduce the execution duration of an *already running* Lambda invocation; it only affects the startup time.

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

This DVA-C02 question is part of Courseiva's 724-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.