zoukankan      html  css  js  c++  java
  • [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

    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.

    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.

    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

    • 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.

  • 相关阅读:
    机试笔记1
    ZOJ 3846 GCD Reduce//水啊水啊水啊水
    最短路练习
    CodeForces 632C The Smallest String Concatenation//用string和sort就好了&&string的基础用法
    HDOJ 5667 Sequence//费马小定理 矩阵快速幂
    HDOJ 5666//快速积,推公式
    HDOJ 5672//模拟
    网络流相关知识点以及题目//POJ1273 POJ 3436 POJ2112 POJ 1149
    南理第八届校赛同步赛-C count_prime//容斥原理
    python之shutil模块使用方法
  • 原文地址:https://www.cnblogs.com/Answer1215/p/14728760.html
Copyright © 2011-2022 走看看