[AWS DA Guru] SQS

Pull-Based

SQS is pull-based, not pushed-based

256KB

Messages are 256 KB in size.

Text Data

Including XML, JSON, and unformatted text.

Guarantee

Messages will be processed at least once

Up to 14 Days

Messages can be kept in the queue from one minute to 14 days.

Default is Four Days

The default retention period is 4 days.

 

Features

  • Decouple the components of an application so they run independently, easing message management between compoentns.
  • Any component of a distributed application can store messages in the queue. Messages can contain up to 256KB of text in any format
  • Any component can later retrieve the messages programmatically using Amamzon SQS API.

Resole Scheduling Issues

  • The queue resolves issues that arise if the producer is prodcuing work faster than the cuonsumer can process it
  • Or if the producer or consumer are only intermittently connected to the network.

 

Types of SQS

Standared Queues

  • Unlimited Transaction: Nearly-unlimited number of transactions per second
  • Guarantee: Guarantees that a message is delivered at leat once
  • Best-Effort Ordering Messages are generally delivered in the same order as they are sent
  • Occasionly more than one copy of a mesage might be delivered out of order

[AWS DA Guru] SQS

 

FIFO Queues

  • The order in which messages are sent and received is strictly preserved
  • A message is delivered once and remains availabe until a consumer processes and deletes it. Duplicates are not introduced.
  • FIFO Queues are limited to 300 transactions per second. But have all the capabilities of standard queues.

[AWS DA Guru] SQS

 

[AWS DA Guru] SQS

 

Change the Visibility Timeout

  • The default visibility timeout is 30 seconds
  • Increase it if the task takes more than 30 seconds
  • The maximum is 12 hours

 

Short Polling Versus Long Polling

Short Polling: A response is returned immediately even if no messages are in the queue. A cost per reponse.

Long Polling: Periodically polls the queue and only returns a response when a message is in the queue or the timeout is reached. Most cost effective option.

[AWS DA Guru] SQS

 

SQS Delay Queues

Postpone delivery of new message

  • Postpone delivery of new messages to a queue for a number of second
  • Messages sent to the Delay Queue remain invisible to consumers for the duration of the delay period
  • Default delay is 0 seconds, maximum is 900

When should you use a Delay Queue?

  • Large distributed applications which may need to introduce a delay in processing
  • You need to applya delay to an entire queue of messages
  • e.g adding a delay of a few seconds, to allow for updates to your sales and stock control databases before sending a notification to a customer confirming an online transaction

[AWS DA Guru] SQS

[AWS DA Guru] SQS

 

[AWS DA Guru] SQS

  • Visibility timeout: default 30 seconds, up to 12 hours.
  • Long Pulling timeout is 20 seconds

Delay Period

  • Messages in a Delay Queue remain invisible for duration of the delay period 0 second up to 15 mins.

 


 

[AWS DA Guru] SQS

 

[AWS DA Guru] SQS

 

[AWS DA Guru] SQS

 

[AWS DA Guru] SQS

 

[AWS DA Guru] SQS

[AWS DA Guru] SQS

 

[AWS DA Guru] SQS

 

[AWS DA Guru] SQS

 

上一篇:Debuting a Modern C++ API for Apache Kafka


下一篇:隐藏个人设置邮件跟踪选项中的【所有邮件】这个选项的方法