DVA-C02 Development with AWS Services Practice Question
A developer is building a real-time chat application using Amazon API Gateway WebSockets and AWS Lambda. The developer notices that messages are sometimes delivered out of order. What should the developer do to ensure ordered message delivery?
⚠ Common exam trap
Candidates often mistake TCP/WebSocket transport guarantees for application-level processing guarantees. While the network protocol ensures packets arrive at API Gateway in order, the downstream serverless backend (Lambda) processes them concurrently, destroying that order unless a sequencing mechanism like SQS FIFO is introduced.
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 an Amazon SQS FIFO queue to buffer messages before processing
WebSocket connections run over TCP, which guarantees in-order delivery of frames from the client to Amazon API Gateway. However, when API Gateway routes these messages to AWS Lambda, Lambda executes concurrently. This concurrent execution can lead to messages being processed, written to a database, or broadcasted to other clients out of order. To guarantee ordered processing, messages can be buffered using an Amazon SQS FIFO (First-In-First-Out) queue before being processed by Lambda, ensuring they are handled in the exact order they were received.
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 function's memory allocation
Why it's wrong here
Increasing a Lambda function's memory allocation primarily impacts its CPU power, network bandwidth, and overall execution duration, allowing it to process data faster or handle larger payloads. However, memory allocation has no direct bearing on the order in which messages are received or processed by downstream services or concurrent invocations. Message ordering is a system-level concern, typically managed by queuing services or specific protocol implementations, not by the compute resource's individual capacity.
- ✗
Use API Gateway's built-in message ordering feature
Why it's wrong here
Amazon API Gateway, particularly for WebSocket APIs, acts as a managed service for routing messages, handling connection management, authentication, and throttling. While it efficiently manages the bidirectional communication, API Gateway itself does not inherently provide or guarantee message ordering for messages sent through connected clients. It delivers messages as they arrive, and any requirement for strict sequential processing must be implemented by a downstream service or a dedicated queuing mechanism.
- ✗
Set the 'sequenceNumber' property in the WebSocket message
Why it's wrong here
While including a 'sequenceNumber' property within a WebSocket message can help clients identify and potentially reorder messages on the receiving end, it does not enforce processing order on the server-side. The server would still receive messages out of order and process them asynchronously based on arrival. Relying solely on client-side reordering means the server-side logic might still operate on stale or incorrectly ordered data, which is problematic for real-time applications requiring strict sequential processing.
- ✓
Use an Amazon SQS FIFO queue to buffer messages before processing
Why this is correct
An Amazon SQS FIFO (First-In, First-Out) queue is specifically designed to guarantee the exact order in which messages are sent and received. By buffering chat messages in an SQS FIFO queue before they are processed by a Lambda function, the application ensures that messages from a specific message group (e.g., a chat room or user conversation) are delivered to the Lambda function strictly in the order they were sent. This mechanism prevents race conditions and ensures sequential processing, which is crucial for maintaining the integrity of a real-time chat conversation.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
Go deeper
Related to this question
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 →
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.