SQS Flashcards

1
Q

What is SQS?

A

Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications

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

What can you use to decouple applications?

A

SQS, SNS, Kinesis

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

How does SQS work?

A

SQS provides an API endpoint to submit messages and another endpoint to read messages from a queue. Each message can only be retrieved once, and you can have many clients submitting messages to and reading messages from a queue at the same time.

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

Which are the SQS types?

A

Standard Queue
Delay Queue
Dead Letter Queue
FIFO Queue

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

What is the message retention period in Standard SQSs?

A

Message retention: default 4 days, up to 14 days or until a consumer deletes it

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

What is the max retention time in Standard SQSs?

A

14 days

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

How many messages are allowed in Standard SQSs?

A

Unlimited throughput, unlimited number of messages in queue

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

Due to the high throughput accepted by Standard SQS what could happen?

A

Can have duplicate messages (at least once delivery, occasionally)

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

What standard SQS does related to ordering?

A

Can have out of order messages (best effort ordering)

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

Can you send any message in Standard SQS?

A

No, just Strings limited to 256 KB

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

What is the max delay time in Delay SQS?

A

up to 15 minutes

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

What is the default delay time in Delay SQS?

A

0

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

At what level is SQS delay time defined?

A

At queue level but you can override the default at a message level using the DelaySeconds parameter

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

What is returned by SQS to the producers?

A

a msg id and MD5 hash of the body

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

How many messages can poll an SQS consumer at a time?

A

up to 10

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

What should the SQS consumer do after processing a msg?

A

To tell SQS to delete the message

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

In what time needs SQS consumers to process a message?

A

within the visibility timeout

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

What is SQS visibility timeout?

A

It is a defined time a message is invisible to other consumers

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

What is default value of SQS visibility timeout?

A

30 seconds

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

What is the range of SQS visibility timeout?

A

0 - 12 hours

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

How can you change the SQS visibility timeout of a message that is being processed?

A

Using the ChangeMessageVisibility API

22
Q

What is used to tell SQS that a message was successfully processed?

A

DeleteMessage API

23
Q

What is Dead Letter Queue?

A

let you isolate problematic messages to determine why their processing doesn’t succeed

24
Q

How SQS knows that needs to send the message to a Dead Letter Queue?

A

After the threshold is exceeded

25
Q

What is SQS redrive policy?

A

A threshold of how many times a message can go back to the queue

26
Q

When you should process the messages in a Dead Letter Queue?

A

Before they expire

27
Q

What is SQS Long Polling?

A

When a consumer requests message from the queue, it can optionally “wait” for messages to arrive if there are none in the queue

28
Q

What is the advantage of using SQS Long Polling?

A

LongPolling decreases the number of API calls made to SQS while increasing the efficiency and latency of your application

29
Q

At what level can you enable SQS Long Polling?

A

at the queue level or at the Consumer API level using WaitTimeSeconds

30
Q

What is FIFO Queue

A

designed to enhance messaging between applications when the order of operations and events is critical, or where duplicates can’t be tolerated

31
Q

What must contain the name of the SQS FIFO?

A

must end in .fifo

32
Q

How is the throughput of SQS FIFO?

A

lower than standard queue, it is not unlimited.

300 msg/s without batching, 3000 msg/s with

33
Q

What other SQS queue accepts delay but it has a small difference?

A

SQS FIFO but it only accepts queue level delay

34
Q

How many times are messages sent in SQS FIFO?

A

Exactly-once send capability (by removing duplicates)

35
Q

What features help SQS FIFO to order the message?

A

content based de-duplication

36
Q

How can you group better messages in a SQS FIFO?

A

Providing Message Group Ids extra tag on the message

37
Q

What are the SQS FIFO deduplication methods?

A

o Content-based deduplication: The MessageDuplicationId is generated as the SHA-256 of the message body
o Explicitly provide a MessageDeduplicationID

38
Q

What is the SQS FIFO de-duplication interval?

A

5 minutes

39
Q

What is SQS FIFO meessageGroupId?

A

The message group ID is the tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are always processed one by one, in a strict order relative to the message group (however, messages that belong to different message groups might be processed out of order)

40
Q

How can you use an SQS to scale?

A

Integrated with an ASG of instances who is polling messages. The ASG sends metrics to CloudWatch, who triggers alarms that activate ASG policies to scale.
All this based in the amount of messages

41
Q

What can you use to produce messages to SQS from SDK?

A

using the SDK (SendMessage API)

42
Q

What are possible SQS consumers that you can define?

A
  • EC2 instances
  • on-prem servers
  • AWS Lambda
43
Q

How is data encrypted in SQS?

A

o In-flight encryption using HTTPS API (enabled by default)
o At-rest encryption using KMS keys (disabled by default)
o Client-side encryption if the client wants to perform encryption/decryption itself

44
Q

How is SQS access regulated?

A

Using IAM policies and SQS Access Policies (similar to Bucket policies)

45
Q

What is useful for SQS Access Policies?

A

o Useful for cross-account access to SQS queues

o Useful for allowing other services (SNS, S3…) to write to an SQS queue

46
Q

What is the range of how many times a message can go back to the queue?

A

1 <= T <= 1000

47
Q

What is the wait times that you can define for SQS Long Polling?

A

1 sec to 20 sec (20 is preferable)

48
Q

How can you send large messages to SQS?

A

Using the SQS Extended Client (Java Library). It uses a S3 bucket and SQS just receives small metadata message, then the consumer reads the metadata and uses the bucket

49
Q

What SQS APIs allows batch operations?

A

Batch APIs for SendMessage, DeleteMessage, ChangeMessageVisibility helps decrease your costs

50
Q

Do Amazon SQS FIFO queues support multiple consumers?

A

By design, Amazon SQS FIFO queues don’t serve messages from the same message group to more than one consumer at a time. However, if your FIFO queue has multiple message groups, you can take advantage of parallel consumers, allowing Amazon SQS to serve messages from different message groups to different consumers

51
Q

How does work ordering in SQS FIFO?

A

To get ordering at the level of a subset of messages, specify different values for MessageGroupID
o Messages that share a common Message Group ID will be in order within the group
o Each Group ID can have a different consumer (parallel processing!)
o Ordering across groups is not guaranteed

52
Q

What is used by the SQS consumer to delete the message?

A

the message ID and receipt handle