Chpater 11 Refactor to Microservices Flashcards
Explain AWS SQS at a high level
Simple Queue Service. It temporarily stores messages from a provider while it waits for a message producer to process the message.
Messages are stored passively (no notification)
What are the limits to the number of producers and consumers for SQS?
There are no limits. SQS is a distributed cluster of servers.
List states of SQS message
- Sent to queue by a producer
- Received from queue from a consumer
- Deleted from queue
What is an ‘in-flight’ state for an SQS message?
When a message is b/t states of received and deleted. There are a finite number of in-flight messages that can be processed.
What is ‘Long-Polling’ in SQS and how do you implement it?
Method to reduce operational cost of SQS by eliminating empty responses.
Achieved by setting longer time intervals for the ‘ReceiveMessage’ action (max is 20 seconds, min is 1 second)
What is the ‘VisibilityTimeout’?
SQS actions which is the duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ‘ReceiveMessage’ request.
If you find yourself setting the VisibilityTimeout action in SQS to longer than 12 hours, what should you consider doing instead?
Use AWS Step Functions
What is a ‘Dead Letter Queue’?
A queue/dump where failed messages are stored. For example, a user order item with a deleted product ID. Associated message can be sent to the dead letter queue.
Useful for:
- configuring alarm for any messages received in DLQ
- analyze contents of problematic messages
- determineif you gave consumer sufficient processing time
- DLQ must be FIFO when used w/ SQS FIFO queue
- DLQ must be standard when used w/ SQS Standard Queue
SQS Standard Queues ensure scalability and throughput by having what two tradeoffs?
- order is not guaranteed
- messages can appear twice
What is alternative to SQS Standard Queues?
SQS FIFO queues:
- provide ordered messages
- delete any duplicates that appear in queue
With Kinesis Data Streams, how/when are messages/records deleted?
Via a retention interval expiration, which you configure
How to support high throughput in Kinesis Data Streams?
Increase number of shards in Kinesis Data Stream system
Difference b/t Kinesis Firehose and Kinesis Data Streams?
Higher level. Firehose does not require you to write a consumer application.
Also Firehose handles dynamic scaling of underlying shards and automatically delivers data to services like S3, Redshift, etc.
AWS Kinesis Data Analytics
Allows you to process and analyze streaming data with SQL. Good for performing time series analytics, feed real time dashboards, create real time metrics.
For Kinesis Streams, what is data made of?
- ‘data blobs’ of up to 1MB attached to a…
- ‘record key’ (metadata to tell which shard to go to)
- sequence #
DynamoDB Streams
Event pool which receives dynamoDB events from CRUD actions. Often integrated with Lambda via ‘triggers’
At any given time, each partition in an Amazon DynamoDB table maps to a single ______ which captures all updates to that partition.
shard
What is connector b/t IOT devices and AWS Services?
Rules Engine
*no retry or delivery guarantees for messages
What protocols can devices use to communicate w/ AWS IOT?
- MQTT Message Queuing Telemetry Transport
2. HTTP
AWS IOT Message Broker
pub/sub broker service for messages to and from IOT devices. No cross region / cross account capabilities
How to represent and communicate with offline device in AWS?
via AWS IOT device shadow
What is AWS’s managed message broker service which is compatible with many popular message brokers?
Amazon MQ
With Step functions, built in 1. _____, 2.____, and 3.____ capabilities deal with errors and exceptions automatically
- try/catch
- retry
- rollback
Step functions implement basic primitives such as ____, ___, and ___.
branching, parallel execution, timeouts
What is language used to control step functions?
Amazon States Language
List all functions for step functions
Task state: Performs work in your state machine
Choice state: Makes a choice between branches of execution
Fail or Succeed state: Stops an execution with a failure or success
Pass state: Passes inputs to outputs or inject corrected data
Wait state: Provides a delay for a certain amount of time or until a specified time/date
Parallel state: Begins parallel branches of execution
If a parallel branch in a step function fails, can you stop a running Lambda function?
no
How to stop long running activities in parallelized step function?
check heartbeat to detect whether step functions has stopped its branch
In step functions each step defines either a ____ or a ____.
- next state
2. end state
In the Amazon States Language, three components filter and control the flow of JSON from state to state: 1.____, 2._____, and 3._____.
- InputPath
- OutputPath
- ResultPath
Size of SQS message?
256kb
Size of SNS message?
256kb
You have an Amazon Kinesis data stream with one shard and one producer. How many consumer applications can you consume from the stream?
Limitless number of consumers as long as all consumers consume fewer than 2 MB and five transactions per second