ladderlore
请求新指南
  • 输入服务名称,例如 S3 或 IAM。

服务 · Application Integration · 基于 CLF-C02

Amazon Simple Queue Service (Amazon SQS)

The settings that decide behavior: visibility timeout, long polling, delay, retention, DLQs, and scaling on queue depth.

本课尚未翻译,暂以英文显示。

你在云从业者中已学过

  • A queue holds messages until a consumer processes and deletes them. Consumers pull.
  • It decouples and buffers: peaks wait in the queue, and messages survive a consumer failure.
  • Standard queues give the most throughput. FIFO queues keep order and avoid duplicates.
  • A dead-letter queue collects messages that keep failing.
阅读云从业者课程
Producer
SQS
Consumer
Dead-letter queue
  1. 1The producer sends a message. It waits in the queue for up to 14 days.
  2. 2A consumer receives it, and the message is hidden for the visibility timeout. The consumer deletes it when done. If it does not, the message reappears.
  3. 3After too many failed receives, the message moves to the dead-letter queue.
The life of a message, with a visibility timeout and a dead-letter queue.

分步说明

  1. 1The producer sends a message. It waits in the queue for up to 14 days.
  2. 2A consumer receives it, and the message is hidden for the visibility timeout. The consumer deletes it when done. If it does not, the message reappears.
  3. 3After too many failed receives, the message moves to the dead-letter queue.
  • Throughput

    Standard
    Nearly unlimited
    FIFO
    Limited, high-throughput mode raises it
  • Order

    Standard
    Best effort
    FIFO
    Kept within a message group
  • Duplicates

    Standard
    Possible
    FIFO
    Removed for 5 minutes
  • Queue name

    Standard
    Any
    FIFO
    Ends in .fifo
  • Use for

    Standard
    Most workloads
    FIFO
    Order matters, no duplicates
Standard is the default. Choose FIFO only when order or duplicates matter.

1 / 2

  • Throughput

    Standard
    Nearly unlimited
    FIFO
    Limited, high-throughput mode raises it
  • Order

    Standard
    Best effort
    FIFO
    Kept within a message group
  • Duplicates

    Standard
    Possible
    FIFO
    Removed for 5 minutes

2 / 2

  • Queue name

    Standard
    Any
    FIFO
    Ends in .fifo
  • Use for

    Standard
    Most workloads
    FIFO
    Order matters, no duplicates
Standard is the default. Choose FIFO only when order or duplicates matter.

是什么

When a consumer receives a message, the message stays in the queue but is hidden for the visibility timeout (30 seconds by default, up to 12 hours). If the consumer deletes the message in time, it is gone. If not, it reappears and another consumer gets it. Set the timeout longer than the processing time. This is also why a standard queue can deliver a message twice, and why consumers must be idempotent.

是什么

Short polling returns at once, often empty. Long polling waits up to 20 seconds for a message, which cuts empty responses and cost. A delay queue hides new messages for up to 15 minutes. Retention is 4 days by default and up to 14 days. A message can be up to 1 MiB (older guides say 256 KB). After a set number of failed receives (maxReceiveCount), a message moves to a dead-letter queue. Keep the DLQ retention longer than the source queue, and use redrive to send messages back after you fix the bug.

是什么

Standard queues have nearly unlimited throughput. FIFO queues keep order within a message group ID and drop duplicates sent within 5 minutes. A FIFO queue handles 300 calls per second per action, 3,000 messages per second with batching, and more in high-throughput mode. To scale consumers, use an Auto Scaling group on the backlog per instance, not on CPU.

要记住

  • Visibility timeout: 30 seconds by default, up to 12 hours. Set it above the processing time.
  • Long polling (up to 20 seconds) cuts empty receives and cost.
  • Delay queue: up to 15 minutes. Retention: 4 days by default, up to 14 days. Message size: up to 1 MiB.
  • DLQ: used after maxReceiveCount failures. Redrive moves messages back.

要记住

  • Standard: at-least-once, best-effort order. FIFO: exactly-once processing, order per message group.
  • Scale consumers on backlog per instance.

考试中

  • “Two workers process the same message” points to a visibility timeout shorter than the processing time.
  • “Failed messages must be kept for analysis” points to a dead-letter queue.
  • “Scale worker instances with the number of waiting jobs” points to an Auto Scaling policy on queue depth per instance.
  • “Process orders in order, per customer” points to a FIFO queue with the customer as message group ID.