Courseiva
Troubleshooting and OptimizationhardMultiple ChoiceObjective-mapped

DVA-C02 Troubleshooting and Optimization Practice Question

A web application runs on Amazon EC2 instances behind an Application Load Balancer (ALB). During rolling updates of the Auto Scaling group, users intermittently receive HTTP 502 (Bad Gateway) errors. The developer checks the ALB access logs and notices that requests are being routed to instances that are in the 'Draining' state. The ALB has connection draining enabled with a timeout of 30 seconds. The Auto Scaling group terminates instances after they are taken out of service. What is the most likely cause of the 502 errors?

⚠ Common exam trap

A common mix-up: candidates confuse connection draining timeout with health check interval, assuming that a long health check interval causes the ALB to route to unhealthy instances, when in fact the 502 errors are caused by the ALB forcibly terminating connections before in-flight requests complete due to an insufficient draining timeout.

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

The connection draining timeout is too short, causing the ALB to terminate connections before in-flight requests finish.

The 502 errors occur because the ALB's connection draining timeout of 30 seconds is too short to allow all in-flight requests to complete before the Auto Scaling group terminates the instances. When an instance enters the 'Draining' state, the ALB stops sending new requests but waits up to the draining timeout for existing connections to finish. If the timeout expires before requests complete, the ALB forcibly closes connections, resulting in HTTP 502 (Bad Gateway) errors for clients whose requests were still in progress.

Answer analysis

Option-by-option breakdown

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

  • The connection draining timeout is too short, causing the ALB to terminate connections before in-flight requests finish.

    Why this is correct

    When an EC2 instance is deregistered from an Application Load Balancer (ALB) target group, connection draining (also known as deregistration delay) begins. During this period, the ALB stops sending new requests to the instance but attempts to allow existing in-flight requests to complete. If the configured deregistration delay timeout is shorter than the time required for active requests to finish processing, the ALB will forcibly close those connections, leading to 502 Bad Gateway errors for the client, as the backend server did not return a proper response.

  • The health check interval is set too long, causing the ALB to consider unhealthy instances as healthy.

    Why it's wrong here

    An overly long health check interval may delay the detection of unhealthy instances, but the issue described involves instances in 'Draining' state, which are known to be deregistering. Health checks are not the primary cause.

  • Cross-zone load balancing is disabled, so the ALB is routing requests to instances that are already draining.

    Why it's wrong here

    Cross-zone load balancing primarily governs how an Application Load Balancer distributes traffic across different Availability Zones (AZs) to its registered targets. If disabled, each ALB node only sends requests to targets within its own AZ. However, this setting does not dictate whether an ALB sends requests to draining instances; the ALB's deregistration process handles that. A draining instance is marked as such within its target group, and the ALB will cease sending new requests to it, regardless of cross-zone configuration. The 502 errors stem from prematurely terminated existing connections, not from new requests being misrouted.

  • The Auto Scaling group's minimum size is too small, causing the ALB to have no healthy targets.

    Why it's wrong here

    An Auto Scaling group's minimum size ensures a baseline number of healthy instances are available to serve traffic. If this minimum is too low, or if all instances become unhealthy, the Application Load Balancer (ALB) would indeed have no healthy targets. However, this scenario typically results in 503 Service Unavailable errors, indicating that no backend server could process the request. The 502 Bad Gateway error specifically points to an issue where the ALB received an invalid response from the backend or the connection was terminated prematurely, which is distinct from having no available targets at all.

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.