sqs, swf, and sns · sqs, swf, and sns chapter 8 references • all informaon in this presentaon...

5
7/24/17 1 SQS, SWF, and SNS Chapter 8 References All informa6on in this presenta6on was obtained from the following sources with all credit due to the listed authors: J. Baron, H. Baz, T. Bixler, B. Gaut, K. E. Kelly, S. Senior, and J. Stamper, AWS Cer(fied Solu(ons Architect official study guide: Associate exam. United States: Sybex, a Wiley brand, 2017. “AWS DocumentaHon,” Amazon Web Services, Inc. [Online]. Available: hOps://aws.amazon.com/documentaHon/. [Accessed: 15- Jul-2017]. Amazon Simple Queue Service(SQS) Amazon SQS Queue- a buffer between the applica6on components that receive data and those that process data within your system. Fully managed message queuing service. Fast, reliable, scalable, simple, and cost effec6ve. Transmits any volume of data without losing messages or requiring other services to be con6nuously available. Ensures message delivery at least once and supports mul1ple readers and writers interac6ng with the same queue. Service is reliable and efficient but does not guarantee first in, first out(FIFO) delivery.

Upload: others

Post on 30-Jun-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SQS, SWF, and SNS · SQS, SWF, and SNS Chapter 8 References • All informaon in this presentaon was obtained from the following sources with all credit due to the listed authors:

7/24/17

1

SQS,SWF,andSNSChapter8

References•  Allinforma6oninthispresenta6onwasobtainedfromthefollowingsourceswithallcreditduetothelistedauthors:

J.Baron,H.Baz,T.Bixler,B.Gaut,K.E.Kelly,S.Senior,andJ.Stamper,AWSCer(fiedSolu(onsArchitectofficialstudyguide:Associateexam.UnitedStates:Sybex,aWileybrand,2017.

“AWSDocumentaHon,”AmazonWebServices,Inc.[Online].Available:hOps://aws.amazon.com/documentaHon/.[Accessed:15-Jul-2017].

AmazonSimpleQueueService(SQS)

•  AmazonSQSQueue-abufferbetweentheapplica6oncomponentsthatreceivedataandthosethatprocessdatawithinyoursystem.

•  Fullymanagedmessagequeuingservice.•  Fast,reliable,scalable,simple,andcosteffec6ve.•  Transmitsanyvolumeofdatawithoutlosingmessagesorrequiringotherservicestobecon6nuouslyavailable.

•  Ensuresmessagedeliveryatleastonceandsupportsmul1plereadersandwritersinterac6ngwiththesamequeue.

•  Serviceisreliableandefficientbutdoesnotguaranteefirstin,firstout(FIFO)delivery.

Page 2: SQS, SWF, and SNS · SQS, SWF, and SNS Chapter 8 References • All informaon in this presentaon was obtained from the following sources with all credit due to the listed authors:

7/24/17

2

MessageLifecycle

DelayQueues&VisibilityTimeouts•  Delayqueuesallowyoutopostponedeliveryofqueuedmessages,whichcanbesetbetween0-900seconds(Upto15minutes).

•  QueuescanbesetbyusingCreateQueueandseUngtheDelaySecondsaVribute(Defaultedat0seconds).

•  VisibilityTimeoutsaresimilartodelayqueues,however,thedelayqueuehidesthemessagewhenitisaddedtothequeue,andvisibility6meoutshidethemessageaXeritispulledfromthequeue(Upto12hours).

•  Amessageisconsidered“inflight”ifneitheroftheaboveareapplied(120,000inflightmax).

QueueOperations,IDs,IdentiHiers,&Attributes

•  Opera6onsonlyavailabletoaccountowneroriden6tywithgrantedpermissions.

•  SQSassignsnewqueueswithaqueueURL.•  EachmessageisassignedauniqueID(100charmax),whichisreturnedwhenthemessageissent.

•  SQSalsosupportsmessageaVributes,whichallowyoutoaVachmetadatatoyourmessages(10aVributespermessage).Metadatacaninclude6mestamps,signatures,etc.

Opera6ons:•  ListQueues•  DeleteQueue•  SendMessage•  SendMessageBatch•  ReceiveMessage•  DeleteMessage•  DeleteMessageBatch•  PurgeQueue•  ChangeMessageVisibility•  ChangeMessageVisibilityBatch•  SetQueueAVributes•  GetQueueAVributes•  GetQueueUrl•  ListDeadLeVerSourceQueues•  AddPermission•  RemovePermission

Page 3: SQS, SWF, and SNS · SQS, SWF, and SNS Chapter 8 References • All informaon in this presentaon was obtained from the following sources with all credit due to the listed authors:

7/24/17

3

LongPolling&DeadLetterQueues

•  LongpollingallowsyoutosendaWaitTimeSecondsargumenttoReceiveMessage(Upto20seconds).

•  Reducestheloadontheclientbyreturningamessageimmediatelyorwai6ngthespecified6methenreturningregardlessofmessage’sexistence.

•  DeadleDerqueuesarequeuesthatsourcequeuescantargettosendmessagesthatcouldnotbeprocessedsuccessfully.

•  Allowsyoutosidelineunsuccessfulmessagesforanalysis.

AmazonSimpleWorkHlowService(SWF)

•  AmazonSWFmakesiteasytobuildapplica6onsthatcoordinateandworkacrossdistributedcomponents.

• Workersperformtasks,whichcanrunonacloudinfrastructureoryourownpremises.

•  SWFstorestasks,assignsthemtoworkerswhentheyareready,monitortheirprogress,andmaintainstheirstate.

• WithSWFyoucanimplement,deploy,scale,andmodifytheseapplica6oncomponentsindependently.

WorkHlows,Domains,&History

• Workflowsareasynchronousapplica6onswithinSWFthatcoordinateandmanagetheexecu6onofac6vi6esthatcanberunacrossmul6plecompu6ngdevicesthatfeatureeithersequen6alofparallelprocessing.

• WorkflowdomainshelptoscopeSWFresourceswithinyourAWSaccount.Domainsmustbespecifiedforallthecomponentsofaworkflow.

•  Youcanhavemorethanoneworkflowinadomain,however,workflowsindifferentdomainscannotinteractwithoneanother.

•  Allworkflowshaveahistory,whichisadetailedcompleteandconsistentrecordofeveryeventthatoccurredsincetheexecu6onoftheworkflow.

Page 4: SQS, SWF, and SNS · SQS, SWF, and SNS Chapter 8 References • All informaon in this presentaon was obtained from the following sources with all credit due to the listed authors:

7/24/17

4

Actors,Tasks,&TaskLists•  SWFconsistsofanumberofprogramma6cfeaturesknownasactors,whichcanbeworkflowstarters,ac6vitystarters,ordeciders.

•  Aworkflowstarterisanyapplica6onthatcanini6ateworkflowexecu6on.EX:Amobileapplica6onwhereacustomerordersfoodortaxiservice.

•  Thelogicthatcoordinatestasksinaworkflow,whichcanberunsequen6ally,inparallel,synchronously,orasynchronously,iscalledadecider.

•  Anac1vityworkerisasinglecomputerprocess(orthread)thatperformstasksinyourworkflow.

•  Tasksareworkassignmentsandcanbeac1vitytasks,AWSLambdatasks,ordecisiontasks

•  Anac6vitytasktellsaworkertoperformit’sfunc6on.AnAWSLambdataskexecutesAWSLambdafunc6onsinsteadofregulartasks.Adecisiontasktellsadeciderthestateoftheworkflowexecu6onhaschangedsothedecidercanevaluatethenextstepstobetaken.

•  Taskscanbeorganizedintotasklists,whichareflexiblemechanismstoroutetaskstoworkers.

MoreonWorkHlows•  Decidersandac6vityworkerscommunicatewithSWFusinglongpolling.•  SWFobjectsareuniquelyiden6fiedbyworkflowtype,ac6vitytype,decision/ac6vitytasks,andworkflowexecu6on.

•  Registeredworkflowandac6vitytypesareiden6fiedbytheirdomain,name,andversion,whichcanbespecifiedusingRegisterWorkflowTypeandRegisterAc1vityType,respeclully.

•  Asingleexecu6onofisiden6fiedbythedomain,workflowID,andrunID.•  AworkflowisopenaXeritisstarted.Anopenworkflowcanbeclosedascompleted,cancelled,failed,or6medout.

LifecycleofaWorkHlowExecution

•  Thereare20stepstoaworkflowexecu6on.

Page 5: SQS, SWF, and SNS · SQS, SWF, and SNS Chapter 8 References • All informaon in this presentaon was obtained from the following sources with all credit due to the listed authors:

7/24/17

5

AmazonSimpleNotiHicationService(SNS)

•  AmazonSNSisawebserviceformobileandenterprisemessagingthatenablesyoutosetup,operate,andsendno6fica6ons.

•  Followsapublish-subscribe(pub-sub)messagingparadigm.•  No6fica6onsaredeliveredtoclientsusingapushmechanism,whicheliminatestheneedtopollfornewinforma6onandupdates.

•  Cansendno6fica6onstoApple,Android,FireOS,&Windowsdevices.•  Twotypesofclients,publishersandsubscribers(producersandconsumers).Publisherscommunicatetosubscribersasynchronouslybysendingamessagetoatopic.

•  Messagessenttotopicsareautoma6callyforwardedtoeachsubscriber.•  MessagescanbesentusingdifferentmethodssuchasAmazonSQS,HTTP,HTTPS,email,SMS,andAWSLambda.

CommonSNSScenarios•  FanoutscenarioshappenwhenanAmazonSNSmessageissentandreplicatedandpushedtomul6pleSQSqueues,HTTPendpoints,oremailaddresses,whichallowsforparallelasynchronousprocessing.

•  Applica1on/SystemalertsareSMSoremailno6fica6onsthataretriggeredbypredefinedthresholds.Youcanreceiveno6fica6onsifeventshappenwithinanAWSservice.

•  PushEmail&TextMessagingcanhelptransmitindividualorgroupmessagesviaemailorSMS.Usefulforpushingrelevanttopicstosubscribers.

•  MobilePushNo1fica1onsallowyoutosendmessagesdirectlytomobileapplica6ons.Usefulforupda6ng.

Recap•  AmazonSQSisauniqueservicedesignedtohelpyoudecoupleyourinfrastructure.

•  SQSallowsyoutostoremessagesonareliableandscalableinfrastructureastheytravelbetweendistributedcomponentsofyourapplica6onsthatperformdifferenttasks.

•  AmazonSWFallowsyoutocreateapplica6onsthatcoordinateworkacrossdistributedcomponents.

•  SWFisdrivenbytasks,whichcanbemanaged,keepinginmind,inter-taskdependencies,scheduling,andconcurrence.

•  Workflowsallowyoutohavefullcontroloverimplemen6ngtaskswithoutworryingaboutunderlyingcomplexi6es.

•  AmazonSNSallowsyoutopushindividualormul6plemessagestoalargenumberofrecipients.

•  SNSsupportsawidevarietyofneeds,includingmonitoringapplica6ons,workflowsystems,6me-sensi6veupdates,andanyotherapplica6onthatgenerateorconsumesno6fica6ons.