Serverless Applications Flashcards

1
Q

What is Amazon SNS

A

Amazon Simple Notification Service is a fully managed messaging service.

It’s a Publisher Subscriber System

Event producer sends a message to one SNS topic

Topic Endpoints:
- Amazon SQS Queue
- Amazon Lambda
- Http/s Webhooks
- Mobile push
- SMS
- EMail

A pattern that comes a lot in exam questions:
- you can subscribe one or more Amazon SQS queues to an Amazon SNS topic
-> Amazon SQS manages the subscription and any necessary permissions
- When you publish a message to a topic, Amazon SNS sends the message to every subscribed queue.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is SQS

A
  • Pull based
    Direct integration vs decoupled integration:
  • Decoupling with SQS Queues, instead of sending message directly to the consumer, we send message to a queue and the consumer poll the queue for messages
  • Standard Queue
    • Best effort ordering
  • FIFO Queue
    • First In, First-out
  • FIFO queues require the Message Groups ID and Message Deduplication ID parameters to be added to messages
  • Dead Letter Queue
    • Is not a different Queue Type, it is a standard or

FIFO queue that has been specified as a dead letter queue in the configuration of another standard or

FIFO queue.
- It is used for Messages that are not processed successfully! The Messages that couldn’t be processed will be moved to the Dead Letter Queue.
- The main task of a dead letter queue is handling message failures.
When a message in a standard SQS queue fails to be processed successfully, it is normally returned to the queue for further processing, potentially causing an endless loop of failures. The Dead Letter Queue provides a solution to this problem by allowing you to redirect failed messages to a separate queue for analysis and troubleshooting.

  • SQS Long Polling vs Short Polling
    Amazon Simple Queue Service (SQS) offers two methods for retrieving messages from queues: Long Polling and Short Polling. These two polling methods serve different purposes and have distinct characteristics:

Short polling is the default behavior for SQS.
Short polling returns immediately with any available messages in the queue, up to the maximum number of messages specified in the MaxNumberOfMessages parameter.
Long polling is achieved by specifying a WaitTimeSeconds parameter when calling ReceiveMessage. The value of WaitTimeSeconds determines the maximum time the call can wait for a message to become available.

Short Polling is suitable for high-throughput applications or when you need low-latency message retrieval.

Long Polling is more efficient and cost-effective for low-traffic queues and can help reduce the request rate and empty responses.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly