DOP-C02 Incident and Event Response Practice Question
A company runs a critical application on Amazon ECS with Fargate launch type. The application uses an Application Load Balancer (ALB) in front. During a load test, the team notices a sudden increase in 5xx errors from the ALB, and some tasks become unhealthy. The task logs show occasional 'OutOfMemoryError' exceptions. The task definition currently has 512 CPU units and 1024 MiB memory. What should the team do to mitigate the issue while maintaining a cost-effective approach?
⚠ Common exam trap
Many candidates assume both CPU and memory must be increased together (Option A) or that a deployment strategy change (Option C) can mitigate resource exhaustion, when in fact the root cause is a memory limit that must be raised independently.
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 task definition memory to 2048 MiB while keeping CPU at 512 units.
The application is experiencing OutOfMemoryError, indicating the current 1024 MiB memory allocation is insufficient. Increasing memory to 2048 MiB while keeping CPU at 512 units directly resolves the memory constraint without unnecessary CPU cost. ECS Fargate allows independent scaling of CPU and memory within valid combinations, and this change maintains a cost-effective approach by only increasing the resource that is actually constrained.
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 task definition CPU to 1024 units and memory to 2048 MiB.
Why it's wrong here
Raising the task from 512 units to 1024 units of CPU while also doubling memory will increase cost and may change the valid Fargate CPU/memory combination, but it does nothing to relieve the memory ceiling that caused the OutOfMemoryError. The container was already killed because its working set exceeded the configured memory limit; additional vCPUs cannot expand the task's cgroup memory cap. Even though 2048 MiB is added in this option, it needlessly pairs that memory increase with extra CPU, making this a more expensive over-provisioned fix than necessary.
- ✓
Increase the task definition memory to 2048 MiB while keeping CPU at 512 units.
Why this is correct
Raising the task memory to 2048 MiB while keeping CPU at 512 units is the minimal change that removes the hard memory limit causing the container's OOM kill. ECS enforces task memory as a cgroup limit, so the kernel terminates the process once the container's resident memory reaches that configured cap. This directly provides the application runtime sufficient headroom, uses the valid Fargate 0.5 vCPU / 2 GiB combination, and avoids wasting spend on CPU that was never the bottleneck.
- ✗
Configure the ECS service to use a rolling update with a longer health check grace period.
Why it's wrong here
Switching to a rolling update with a longer health check grace period only adjusts how ECS handles the transition between old and new tasks during a deployment, specifically how long it waits before deciding a replacement task is healthy. It does not affect steady-state memory consumption and cannot prevent the ECS agent or kernel from killing a task that exceeds its memory hard limit during regular operation. The OutOfMemoryError occurs because the runtime memory ceiling is too low for the workload, not because health checks are evaluating too soon.
- ✗
Decrease the task definition memory to 512 MiB to force garbage collection more frequently.
Why it's wrong here
Lowering the task memory to 512 MiB shrinks the kernel's cgroup limit even further, so the application will hit the maximum resident set size sooner and the OOM killer will act more aggressively. Forcing garbage collection more frequently does not help because the real problem is insufficient total heap capacity, not a rarely triggered GC in an adequately sized heap. This change would turn occasional OOM errors into guaranteed, immediate failures, making the application even less stable.
Visual reference
Go deeper
Related to this question
About these practice questions
One of 1,013 original DOP-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DOP-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 DOP-C02 exam.