DVA-C02 Troubleshooting and Optimization Practice Question
A developer is optimizing a Node.js Lambda function that processes CSV files from S3. The function reads the entire file into memory, processes it, and writes results to DynamoDB. For large files, the function runs out of memory. What is the MOST effective optimization?
⚠ Common exam trap
DVA-C02 often tests the misconception that increasing memory or timeout solves out-of-memory errors, when the real fix is to change the processing pattern to streaming or chunking.
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
✓
Use the AWS SDK's S3 GetObject with a stream and process in chunks.
The core issue is that the Lambda function loads the entire CSV file into memory, causing out-of-memory errors for large files. Streaming the S3 object and processing it in chunks avoids holding the whole file in memory, keeping memory usage low and constant regardless of file size. This directly addresses the root cause—memory exhaustion—rather than just increasing resources or time limits. It also allows the function to start processing immediately as data arrives, improving efficiency.
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 Lambda timeout to allow more processing time.
Why it's wrong here
Increasing the Lambda timeout only extends the maximum execution duration, not the available memory. An 'out of memory' error indicates that the function exhausted its allocated RAM *before* the timeout was reached, meaning more time would not resolve the fundamental resource constraint. This action would not prevent the Node.js process from attempting to load the entire large CSV file into memory, leading to the same memory exhaustion issue.
- ✗
Increase the Lambda function memory to 3008 MB.
Why it's wrong here
Increasing memory to 3008 MB might allow the function to handle larger files, but it does not fix the inefficiency of loading the entire file into memory. Streaming is a more effective optimization that avoids high memory usage.
- ✓
Use the AWS SDK's S3 GetObject with a stream and process in chunks.
Why this is correct
Using the AWS SDK's S3 GetObject with a stream allows the Node.js Lambda function to read the large CSV file incrementally, rather than loading the entire object into memory at once. By processing data in small, manageable chunks as it arrives, the function significantly reduces its peak memory footprint. This approach directly addresses memory exhaustion by avoiding the need to hold the entire file in RAM, making it highly efficient for large file processing.
- ✗
Use S3 Select to retrieve only necessary columns.
Why it's wrong here
S3 Select is used to retrieve only specific columns from S3 objects using SQL queries, which reduces data transfer but still requires the function to load the entire file into memory unless combined with streaming. It does not directly address the memory issue.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
Go deeper
Related to this question
About these practice questions
This DVA-C02 question is part of Courseiva's 1,135-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 →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Amazon Web Services exam blueprint
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.