CMSC389L

Week 7

SQS

March 9, 2018

CloudFront Worksheet

SQS

Message Queues

  • Message Queue: A shared queue that enables asynchronous communication of messages between processes.

Why decouple components?

  • Strongly coupled components form complex systems
    • Hard to maintain/expand/refactor
  • Instead:
    • Encapsulate the inner workings of each component
    • Expose a limited API

Decoupling: Microservices

Why use message queues?

  • What happens if the Service B dies?
  • What happens if Service B can't process requests as quickly as Service A produces them?
    • Load spikes?
  • What if Service B dies while processing a request?

SQS

  • Simple Queue Service (SQS): A managed, distributed message queueing service frequently used to communicate between AWS services.

Guaranteeing Delivery

  • Want to guarantee At-Lease-Once Delivery
    • ​Every message will be delivered
    • But, it may be delivered more than once

You configure a Visibility Timeout on your queue (0s-12h)

Message Ordering

  • Ordering:
    • ​We want high throughput of messages
  • Standard Queues: "Unlimited" TPS
  • FIFO Queues: Max 300 TPS

Polling for Messages

  • How do receivers retrieve messages from the queue?
    • Short Polling: Immediately return if no messages available. Search subset of nodes.
    • Long Polling: Wait until a message is available for processing. Searches all nodes.

Other SQS Concepts

  • Retention Period: Messages are deleted from a queue if not processed within a certain amount of time (up to 14 days)
  • Max Message Size: Up to 256KB per message
  • Dead Letter Queue: Messages can be placed in a DLQ after failing to be deleted after a predefined number of receives

SQS Pricing

  • Requests
    • Standard: 40¢ per 1M requests
    • FIFO: 50¢ per 1M requests
  • Data Transfer between SQS/EC2
    • Free (if within the same region)

 

  • Can return multiple messages per request
  • 1 request = 64KB chunk of a payload

 

  • Free Tier: 1M requests

SQS Demo

SQS Worksheet

Complete the worksheet section on SQS.

Wrapping Up

EC2 + SQS codelab due Thursday midnight (warning: start early!)

 

Feedback form: ter.ps/feedback7

 

Turn in your CloudFront worksheet.

CMSC389L Week 7

By Colin King

CMSC389L Week 7

SQS!

  • 861