Thursday, 27 August 2020

SQS,SWF,SNS

 SQS(Simple Queue Service)

Is a webservice that gives an access to a message queue that can be used to store messages while waiting for a computer to process them.

A queue is a temporary repository for messages that are awaiting for processing.

For ex: 
User is buying an online order in a website and there are millions of users are placing the orders in the same time by using a single web app.So each user request will become a queue to the web app.
Each order will be processes one by one. In between sometimes the server which contains web app may become down but the user orders will be maintained in a queue. By using auto scaling technique we will bring up the server back to functioning and process the orders which are in queue. so, that we won't lose the orders to be placed and processing the orders.


Using SQS , you can decouple the application components , so that each component can communicate easily with messaging.

Any component of a distributed application can store messages in a fail safe queue, it will store a message in a 256 KBsize.

Any component can later retrieve the messages pro grammatically using SQS API.

The queue acts as a buffer that producer produces the data and consumer consuming the data.

SQS is pull based not push based and messages can be kept 1-14 days and default retention period: 4 days.

There are two types of queues.

Standard queue:

This will guarantee that the message is delivered and processed at least once and it allows unlimited transactions per sec. Occasionally more than one copy of the messages are delivered out of ordered.

In this queue , the messages are delivered in an order that which they come in and in the same way they will go out.

FIFO queue

It will process the messages only once and it won't allow the duplicate messages to process.
Also if any message has to process it again , it has to wait until it get a chance.

It also supports multiple ordered message groups with in a single queue.
FIFO queues are limited to 300 transactions per second, but have all the capabilities of Standard queue.

Visibility time out: is maximum amount of time that the message is invisible after reader picks out a message. this is max 12 hours.

Simple Work Flow(SWF) service

is a web service that makes the tasks process in a coordinated way in a distributed components, it means that in a distributed environment applications may deals with different flows and use cases as below
  • media processing
  • business analytics
  • web app back ends
  • business process workflow
All the tasks which are defined in above flows will be executed in a coordinated way.

Mainly we can use this feature when there is human interaction or tasks are involved , we can choose this service.

SWF Vs SQS

SQSSWF
Rention Period:14 DaysLasts for 1 year
Message oriented APIBased on task oriented API
Duplicate messages will be processed andwe need to take to process message only onceTask will be executed only once
We need to implement Message
tracking and check if any multiple messages are processing
Provides task level tracking 


SWF actors: An application that could be an initiation to the workflow, just like placing an order in your e-commerce website or booking a movie ticket in your web application.

Deciders:
Controls the flow of activity task in a workflow execution, like something is finished/failed in a workflow ,decider can decide what to do next.

Activity Workers:
Carryout the activity tasks.

SNS: Simple notification service

is a web service , that allows you to send notifications, messages from the cloud.
It provides developers with a highly scalable, flexible and cost effective capability to send messages and notifications to the subscribers or to your other app when and what you want or to 
 
SNS allows you to group the subscribers based on a topic and deliver when its needed,A topic is an access point for allowing recipients to dynamically subscribe for identical copies of the same notification.

To prevent messages being lost , messages will be stored redundantly across multiple AZs based on your configuration.

Benefits:
  • Push based delivery
  • Simple API and easy integration
  • Flexible messages delivery over multiple transport protocols
  • Inexpensive and Pay as you go model.

SNS Vs SQS

Both are messaging services
SNS :Push based, SQS :Poll pased(Pulls)

Elastic Trans coder

It will just trans codes source(videos) to target(videos) in different formats which we can play in mobiles,PCs or tablets.

API gateway

Is a fully managed service that makes easy for developers to publish,maintain,monitor and secure APIs at any scale.

How it works: it acts as a front door and trasfer the action to respective AWS service based onyour requirement


What API gateway can do:
  • Expose HTTPs endpoints to define RESTful API
  • Servelessly connect to endpoints like lambda and DynamoDB
  • Send each endpoint to a different target
  • Run effeciently with low cost.

API gateway caching:

this gateway will cache the endpoint response and execute the task when its needed instead of transferring the request to endpoint, it will check the cache and if any suitable existed it will process the request.So that we can reduce the load and increase the latency for requests processing.

Kinesis

Is easy to store and analyse the streaming data and also providing the ability for you to build your own custom apps for your business needs.


Producers:
Produce the data continuously from mobile or laptop or any source 
Consumers: Consumes the data which is coming from kinesis streaming
Once it consumes , data will be analysed by EC2 and store it in to the database like S3 , RDS or redshift.

Shards can receive data for 24 hrs and retention period is 7 Days.

There are 3 types of Kinesis
  1. Kinesis Streams
  2. Kinesis Firehose
  3. Kinesis Analytics

Amazon cognito:

Provides the following features 
  • Sign in and sign up into your apps
  • Access for your guest users
  • Acts as a Identity broker to your app and web ID providers
  • Synchronizes your app data to multiple devices
  • Recommend for all mobile apps
Cognito has two ways of use cases
1.Identity pool
2. Userpool
 

Thank you for reading 👍👍👍👍
%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22%22%20style%3D%22rounded%3D0%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%2250%22%20y%3D%2240%22%20width%3D%22730%22%20height%3D%22320%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E
%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22%22%20style%3D%22rounded%3D0%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%2250%22%20y%3D%2240%22%20width%3D%22730%22%20height%3D%22320%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E

No comments:

Post a Comment