Learning/AWS SQS/29 — Hands-on Labs/Lab 07 — Long polling vs short polling
Intermediate outline
This chapter is an outline. The curriculum, learning objectives and structure are settled; the prose, diagrams and code are still being written. What is below is the plan for the chapter, not the chapter.

Lab 07 — Long polling vs short polling

Goal

Count the API calls both ways and watch empty receives disappear.

Setup

To be written — CLI commands and an IaC equivalent for every resource, all prefixed sqs-course-.

Steps

  1. Run a consumer with WaitTimeSeconds = 0 against an empty queue for 5 minutes
  2. Record NumberOfEmptyReceives from CloudWatch
  3. Run the same consumer with WaitTimeSeconds = 20 for 5 minutes
  4. Compare the two metric values
  5. Send a message during the long-polling run and measure how quickly it is returned
  6. Set the SDK read timeout below 20 s and observe the client-side failure

What you should observe

  • Empty receives drop by orders of magnitude
  • Long polling returns immediately on arrival — latency goes down, not up
  • A client timeout shorter than the wait breaks every call

Why it happened

To be written — ties each observation back to the mechanism in 12 — Long Polling.

Experiments to try

To be written — deliberate variations that change the outcome.

Teardown

To be written — every resource created above, in dependency order.


Back to: 29 — Hands-on Labs