![AWS] What is SQS?](https://aws.darcy-it.com/wp-content/uploads/2021/03/2021-05-12_11h24_20.png)
目次
What is Amazon_SQS?
SQS Overview
Amazon SQS is used for system isolation.
It stores requests to process video handled by worker processes, allowing for reliable processing execution through asynchronous processing.
Multiple "worker" processes can run competing for messages in a queue. Each message is consumed only once.
SQS queuing can be used to increase worker process reliability by ensuring reliable messaging processing and improving processing performance through distributed parallel processing.
Amazon SQS is a message queue service used by distributed applications.
It can be used to exchange messages through the polling model and to decouple the sending and receiving of components.
FIFO settings allow messages to be processed in sequence.
Amazon SQS is AWS' own fully managed message queue service.
By setting up an SQS queue for an EC2 instance, it is possible to distribute the processing with a high load by parallel processing. (e.g. machine learning).
You can build a solution for parallel processing of read queries to the database using EC2 instances.
Because a large number of queries are expected to be processed, it is necessary to ensure that a large number of EC2 instances can be processed at high speed.
Concerned about temporary load growth, set up Auto Scaling and configure spot instances to be temporarily allocated.
In such cases, settings must be made to prevent a particular queue's processing from being used by multiple instances.
Using SQS
Visibility Timeout
to set the
SQS is used for polling processing and should be used for distributed processing such as parallel processing, while SNS is used for message notification linked to events.
SQS is a reliable and scalable managed message queue service for storing messages transferred between application components.
FIFO queues provide high throughput, best-effort sequencing, and at least one delivery.
FIFO queues have essentially the same functionality as standard queues, but offer the added advantage of supporting sequencing and one-time processing.
SQS can be designed to prevent duplicate messages by using message deduplication IDs.
The message deduplication ID is a token used to deduplicate sent messages.
If a message with a particular message deduplication ID is successfully sent, outgoing messages with the same message deduplication ID will be successfully accepted but will not be delivered during the 5-minute deduplication interval.
Amazon SNS uses cross-availability zone message storage to provide superior message durability. Messaging is the primary role, and SQS is used for worker processes.
SQS Features
SQS automatically deletes messages remaining in the queue that exceed the maximum message retention period.
The default message retention period is 4 days
The default message retention period is 4 days.
Therefore, when using SQS queuing for inter-component coordination, the default is fine without any changes to retain queues that have not been processed for up to 4 days.
dead-letter queue
A dead letter queue is a queue that another (source) queue can use as a destination for messages that cannot be successfully processed (consumed).
The SQS dead letter queue is not a data retention period setting.
visibility timeout
Immediately after a message is received, the message remains in the queue.
To prevent other consumers from processing the same message again, Amazon SQS will set a
Visibility Timeout
to prevent other consumers from processing the same message again.
Reference Site
Why use SQS?
The reasons for using SQS are
To distribute system processing
and to distribute the AWS resource's
Horizontal scaling
and horizontal scaling of AWS resources.
This allows multiple worker processes on the EC2 instance side to be processed in parallel, achieving load balancing and processing process optimization through queuing.
About Cues
Unlimited number of messages can be stored in an Amazon SQS queue
Intended Use
Amazon SQS is used for system isolation.
It handles by worker processes
Stores requests to process video
and
asynchronous processing to ensure reliable execution.
asynchronous processing.
Multiple "worker" processes can run competing for messages in a queue.
Each message is consumed only once; SQS queuing can be used to increase worker process reliability by ensuring reliable messaging processing and improving processing performance through distributed concurrency
When used with SQS
SQS queues allow for asynchronous processing of pending database write requests by storing them in a queue.
SQS allows you to send, store, and receive messages between any amount of software components. Messages are never lost and there is no need to keep other services available.
It meets the requirements as a response to ensure that write operations are not lost under any circumstances.
When is it useful?
Use Case 1
A company uses an RDS-based database system for business processing.
Recently, the number of write operations has increased, causing load processing delays and processing failures, and the user department has requested improvements.
When you, as a solution architect, are required to take action to ensure that write operations are not lost under any circumstances.
Use Case 2
B The company is a member of AWS and on-premise servers and has multiple resources.
As a solution architect, you have been asked to build a distributed architecture for an application that uses resources in both environments.
Mechanisms of services that should be used to meet this requirement
- Apply to on-premise servers and EC2 instances using SWF
- Apply to on-premise servers and EC2 instances using SQS
This scenario calls for a distributed architecture for applications that utilize resources in both AWS and on-premise environments, and requires the selection of AWS services applicable to both environments.
Distributed architecture is a type of computing architecture that allows computing components or layers to run independently while interconnecting with each other Among the AWS services, SQS and SWF can be used to create a distributed architecture in AWS Services.
Amazon SQS provides a reliable and highly scalable hosted queue for storing messages as they travel between applications or microservices. You can use Amazon SQS to route, move data between distributed application components or isolate these components.
Amazon SWF
Amazon SWF is a web service that facilitates coordination of work among distributed application components.
microservice
If the question is how to implement a distributed architecture where processing is handed off between microservices whose components are partitioned between EC2 instances.
This kind of
Polling process using SQS is the best way to coordinate processing among microserviced components
SQS is a service that allows for the use of a single SQS server.
Amazon Simple Queue Service (SQS) is a fully managed message queuing service that can be decoupled and scaled for microservices, distributed systems, and serverless applications.
SQS allows you to send, store, and receive messages between any quantity of software components.