Chapter 8: SQS, SWF, and SNS

Chapter 8: SQS, SWF, and SNS

  1. D. Amazon DynamoDB is not a supported Amazon SNS protocol.
  • SNS的订阅者(即 Web 服务器、电子邮件地址、Amazon SQS 队列、AWS Lambda 函数)在其订阅主题后通过受支持协议(即 Amazon SQS、HTTP/S、电子邮件、SMS、Lambda)中的一种使用或接收消息或通知。
  1. A. When you create a new Amazon SNS topic, an Amazon ARN is created automatically.
  • 创建SNS topic的输出交付物就是ARN,供订阅提醒的时候填写;
  1. A, C, D. Publishers, subscribers, and topics are the correct answers. You have subscribers to an Amazon SNS topic, not readers.
  • SNS的特性主要是创建topic,然后创建订阅者来订阅。通过publish发布提醒;
  1. A. The default time for an Amazon SQS visibility timeout is 30 seconds.
  • SQS的默认 visibility time是30S(0-12小时)
  • SQS的默认 消息保留周期4天(1分钟-14天)
  • SQS的最大消息 256K(1k-256k之间)
  • SQS的默认交付延迟时间0s(0-15分钟)
  • SQS的默认 接收消息等待时间0s(0-20s)
  • SQS的死信队列最大接收次数1-1000之间
  • SQS支持SSE、CMK进行加密
  1. D. The maximum time for an Amazon SQS visibility timeout is 12 hours.
  2. B, D. The valid properties of an SQS message are Message ID and Body. Each message receives a system-assigned Message ID that Amazon SQS returns to you in the SendMessage response. The Message Body is composed of name/value pairs and the unstructured, uninterpreted content.
  • SQS的message的有效属性就是 messageid和body,这个和普通的MQ server(如activemq)的消息没啥区别;
  1. B. Use a single domain with multiple workflows. Workflows within separate domains cannot interact.
  • 使用AWS的工作流的时候都需要先创建domain,在同一个domain下的工作流可以交互,跨domain的工作流无法交互;
  1. A, B, C. In Amazon SWF, actors can be activity workers, workflow starters, or deciders.
  • Amazon SWF 在其运行过程中,会与很多不同类型的程序参与者actor 交互。参与者可以是 [工作流程启动程序]、[决策程序]或[活动工作程序]
  1. B. Amazon SWF would best serve your purpose in this scenario because it helps developers build, run, and scale background jobs that have parallel or sequential steps. You can think of Amazon SWF as a fully-managed state tracker and task coordinator in the Cloud.
  • SWF 可以满足这种并行或者顺序执行的场景。Amazon Simple Workflow Service (Amazon SWF) 提供编程模型和基础设施来协作分布式组件并采用可靠方法来维护其执行状态,可使分布式异步应用程序的开发更简单。借助 Amazon SWF,您可以自由关注与其有区别的应用程序方面的构建。
  1. D. Amazon SQS does not guarantee in what order your messages will be delivered.
  • SQS提供的主要是异步响应能力,因为是集群方式接收消息,所以无法保证消息的顺序性;
  1. A. Multiple queues can subscribe to an Amazon SNS topic, which can enable parallel asynchronous processing.
  • 多个SQS队列是可以订阅一个SNS topic的
  1. D. Long polling allows your application to poll the queue, and, if nothing is there, Amazon Elastic Compute Cloud (Amazon EC2) waits for an amount of time you specify (between 1 and 20 seconds). If a message arrives in that time, it is delivered to your application as soon as possible. If a message does not arrive in that time, you need to execute the ReceiveMessage function again.
  • 为了降低调用SQS的成本,需要设置长轮询(long polling)的等待时间来降低访问频次,进而降低调用成本,默认是0,可以设置成0-20s之间
  1. B. The maximum time for an Amazon SQS long polling timeout is 20 seconds.
  • SQS的长轮询最大时间是20S
  1. D. The longest configurable message retention period for Amazon SQS is 14 days.
  • SQS消息的最长保留时间是14天
  1. B. The default message retention period that can be set in Amazon SQS is four days.
  • SQS消息默认保留时间是4天
  1. D. With Amazon SNS, you send individual or multiple messages to large numbers of recipients using publisher and subscriber client types.
  • SNS的客户端有publisher和subscriber
  • SQS的客户端应该是producer和consumer
  1. B. The decider schedules the activity tasks and provides input data to the activity workers. The decider also processes events that arrive while the workflow is in progress and closes the workflow when the objective has been completed.
  • decider定义了活动的执行路径。决策程序是工作流程写作逻辑的执行。决策程序控制工作流程执行中的活动任务流程。只要工作流程执行过程中发生更改 (如任务完成),都会向决策程序传递包含整个工作流程历史记录的决策任务。当决策程序从 Amazon SWF 接收决策任务时,它会分析工作流程执行历史,以确定工作流程执行中接下来的相应步骤。决策程序会使用决策 将上述步骤反馈给 Amazon SWF。
  1. C. Topic names should typically be available for reuse approximately 30–60 seconds after the previous topic with the same name has been deleted. The exact time will depend on the number of subscriptions active on the topic; topics with a few subscribers will be available instantly for reuse, while topics with larger subscriber lists may take longer.
  • SNS的topic删除后30-60S内就可以重新使用了,可用时间取决于订阅者,因为订阅者也要被删除掉;
  1. C. The main difference between Amazon SQS policies and IAM policies is that an Amazon SQS policy enables you to grant a different AWS account permission to your Amazon SQS queues, but an IAM policy does not.
  • SQS policy与IAM policies最大的不同是,SQS policy允许你给不同的AWS账户授权你的SQS队列。
  1. C. No. After a message has been successfully published to a topic, it cannot be recalled.
  • 当一个消息被成功的发布到SNS的topic上,是没法被重新调用了,被订阅取走;

知识点总结

  • Know how to use Amazon SQS. Amazon SQS is a unique service designed by Amazon to help you to decouple your infrastructure. Using Amazon SQS, you can store messages on reliable and scalable infrastructure as they travel between your servers. This allows you to move data between distributed components of your applications that perform different tasks without losing messages or requiring each component always to be available.

  • 了解如何去使用SQS。SQS是AWS唯一的一个用来进行架构解耦的服务。使用SQS你能将消息以可信可扩展的方式在不同server之间传递。这个允许你将数据在不同的应用组件间执行不同的任务,同时保证消息不丢失,进而保证每个组件可用。

  • Understand Amazon SQS visibility timeouts. Visibility timeout is a period of time during which Amazon SQS prevents other components from receiving and processing a message because another component is already processing it. By default, the message visibility timeout is set to 30 seconds, and the maximum that it can be is 12 hours.

  • 理解SQS的visibility timeouts。这个是一个阻止其他组件接收处理消息的设置,被用于消息已经被另一个组件处理的场景。message的visibility的默认值是30秒,最大值是12小时。

  • Know how to use Amazon SQS long polling. Long polling allows your Amazon SQS client to poll an Amazon SQS queue. If nothing is there, ReceiveMessage waits between 1 and 20 seconds. If a message arrives in that time, it is returned to the caller as soon as possible. If a message does not arrive in that time, you need to execute the ReceiveMessage function again. This helps you avoid polling in tight loops and prevents you from burning through CPU cycles, keeping costs low.

  • 了解SQS的long polling。Long polling允许你从SQS的客户端去拉取SQS queue.如果没有消息,ReceiveMessage 将会等待1-20秒。如果消息到达,他就会立即进行调用。如果一个消息没有到达,你需要在等待结束后重新调用ReceiveMessage。这样帮助你轻量级的进行轮询,防止你消耗CPU,降低了成本;

  • Know how to use Amazon SWF. Amazon SWF allows you to make applications that coordinate work across distributed components. Amazon SWF is driven by tasks, which are logical units of work that part of your application performs. To manage tasks across your application, you need to be aware of inter-task dependencies, scheduling of tasks, and using tasks concurrently. This is where Amazon SWF can help you. It gives you full control over implementing tasks and coordinating them without worrying about underlying complexities such as tracking their progress and maintaining their state.

  • 了解如何使用SWF。SWF允许你将因公在不同的分布式组件之间写作。SWF被任务驱动,这个是你应用的逻辑工作单元。为了管理跨应用的任务,你需要了解任务的依赖关系,定时任务以及并行任务。SWF可以覆盖如上场景。SWF让你可以完全控制实现任务的交互,而不用担心逻辑的复杂度,例如跟踪流程及维护状态等。

  • Know the basics of an Amazon SWF workflow. A workflow is a collection of activities (coordinated by logic) that carry out a specific goal. For example, a workflow receives a customer order and takes whatever actions are necessary to fulfill it. Each workflow runs in an AWS resource called a domain, which controls the scope of the workflow. An AWS account can have multiple domains, each of which can contain multiple workflows, but workflows in different domains cannot interact.

  • 了解SWF工作流的基本信息。一个工作是一系列有逻辑写作的任务组成,为了完成一个特定的目标。例如,一个工作流接收客户订单和任务,当动作需要的时候。每个工作流都在AWS的domain中运行,这个是工作流的边界。一个AWS账户可以有多个domain,每个可以包含多个工作流。但是在不同domain下的工作流是不能交互的。

  • Understand the different Amazon SWF actors. Amazon SWF interacts with a number of different types of programmatic actors. Actors can be activity workers, workflow starters, or deciders.
    -理解SWF的actors的不同。Amazon的SWF不同类型的程序类型交互。actors可以是activity workers,workflow starters或者deciders。

  • Understand Amazon SNS basics. Amazon SNS is a push notification service that lets you send individual or multiple messages to large numbers of recipients. Amazon SNS consists of two types of clients: publishers and subscribers (sometimes known as producers and consumers). Publishers communicate to subscribers asynchronously by sending a message to a topic.

  • 理解SNS的基本知识。Amazon SNS是一个推送消息的服务,允许你将个人或者多个消息推送到大量的接收者。Amazon SNS由两种类型的客户端组成。发布者和订阅者,也可以称作生产者和消费者。发布者与订阅者通过一个topic进行异步消息发送。

  • Know the different protocols used with Amazon SNS. You can use the following protocols with Amazon SNS: HTTP, HTTPS, SMS, email, email-JSON, Amazon SQS, and AWS Lambda.

  • 了解SNS的不同协议,你可以使用HTTP,HTTPS,SMS,EMAIL,EMAIL-JSON,SQS,Lambda进行消息传递。

你可能感兴趣的:(Chapter 8: SQS, SWF, and SNS)