ladderlore
  • S3 や IAM などのサービス名を入力してください。

サービス · アプリケーション統合

Amazon Simple Queue Service (Amazon SQS)

A fully managed message queue, so the parts of an application can work at their own pace without losing messages.

このレッスンはまだ翻訳されていないため、英語で表示しています。

Online shop (producer)
SQS
Order workers (consumers)
Dead-letter queue
Message deleted
keeps failing
  1. 1The shop puts each new order into the queue as a message, then answers the customer straight away.
  2. 2When a worker is free, it asks the queue for the next message. You can add workers when the queue grows.
  3. 3When the order is handled, the worker deletes the message. A message that keeps failing moves to a dead-letter queue.
A queue between an online shop and the workers that handle its orders.

流れ

  1. 1The shop puts each new order into the queue as a message, then answers the customer straight away.
  2. 2When a worker is free, it asks the queue for the next message. You can add workers when the queue grows.
  3. 3When the order is handled, the worker deletes the message. A message that keeps failing moves to a dead-letter queue.
  • Order of messages

    Standard queue
    Best effort. Messages can arrive out of order.
    FIFO queue
    First in, first out: the exact order they were sent
  • Duplicates

    Standard queue
    At-least-once delivery: a message can arrive twice
    FIFO queue
    Exactly-once processing: no duplicates
  • Throughput

    Standard queue
    Nearly unlimited
    FIFO queue
    High, but lower than standard
  • Choose it when

    Standard queue
    Speed matters most, such as resizing uploaded photos
    FIFO queue
    Order matters, such as price changes that must apply in sequence
The two types of SQS queue.

1 / 2

  • Order of messages

    Standard queue
    Best effort. Messages can arrive out of order.
    FIFO queue
    First in, first out: the exact order they were sent
  • Duplicates

    Standard queue
    At-least-once delivery: a message can arrive twice
    FIFO queue
    Exactly-once processing: no duplicates

2 / 2

  • Throughput

    Standard queue
    Nearly unlimited
    FIFO queue
    High, but lower than standard
  • Choose it when

    Standard queue
    Speed matters most, such as resizing uploaded photos
    FIFO queue
    Order matters, such as price changes that must apply in sequence
The two types of SQS queue.

概要

Amazon Simple Queue Service (Amazon SQS) is a fully managed message queue. One part of an application, the producer, puts messages into a queue. Another part, the consumer, takes them out when it is ready. The two parts no longer have to work at the same speed, or even at the same time. This is called decoupling.

概要

Messages wait in the queue until a consumer processes and deletes them. SQS keeps copies of each message in more than one Availability Zone, so a message is not lost if a server fails. When traffic jumps, the queue grows, and you can add more consumers to catch up. A message that keeps failing can move to a dead-letter queue, where someone can look at it later.

There are two types of queue. Standard queues give nearly unlimited throughput, but a message can arrive more than once or out of order. FIFO (first-in, first-out) queues keep the exact order and process each message only once.

覚えること

  • Pull model: consumers ask the queue for messages when they are ready.
  • Each message is processed by one consumer, then deleted from the queue.
  • Decoupling: if a consumer fails, its messages wait in the queue instead of being lost.
  • Buffering: a queue absorbs sudden peaks, such as orders during a flash sale.

覚えること

  • FIFO queues keep the order and avoid duplicates. Standard queues give the most throughput.
  • Fully managed and serverless: no servers to run, and you pay per request.

試験では

  • “Decouple application components” or “make sure no orders are lost if the processing servers fail” points to Amazon SQS.
  • “Process messages in the exact order they were sent, with no duplicates” points to an SQS FIFO queue.
  • “Send one message to many subscribers at once” points to Amazon SNS, not SQS.