(ARC206) Architecting Reactive Applications on AWS | AWS re:Invent 2014

Download (ARC206) Architecting Reactive Applications on AWS | AWS re:Invent 2014

Post on 27-Jun-2015




5 download

Embed Size (px)


Application requirements have changed dramatically in recent years, requiring millisecond or even microsecond response times and 100 percent uptime. This change has led to a new wave of andquot;reactive applicationsandquot; with architectures that are event-driven, scalable, resilient, and responsive. In this session, we present the blueprint for building reactive applications on AWS. We compare reactive architecture to the classic n-tier architecture and discuss how it is cost-efficient and easy to implement using AWS. Next, we walk through how to design, build, deploy, and run reactive applications in the AWS cloud, delivering highly responsive user experiences with a real-time feel. This architecture uses Amazon EC2 instances to implement server push to broadcast events to application clients; AWS messaging (Amazon SQS/SNS); Amazon SWF to decouple system components; Amazon DynamoDB to minimize contention; and Elastic Load Balancing, Auto Scaling, Availability Zones, Amazon VPC, and Amazon Route 53 to make reactive applications scalable and resilient.


<ul><li> 1. 2014 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified, or distributed in whole or in partwithout the express consent of Amazon.com, Inc.November 13, 2014 | Las Vegas, NVARC 206ArchitectingReactive Applications on AWSAtul Shukla, USEReadyRevanth Talari, USEReady </li></ul> <p> 2. AgendaN-tier architecture and its limitationsWhat is a Reactive ApplicationReactive Application architectureAWS for Reactive ApplicationsBuild a Reactive Application 3. DemoN-Tier AppPopEvent 4. N-tier architectureFront-end serverInternal APIInternal APIAPIPollPollDatabaseStorageQueriesSynchronousUser waits for update 5. N-tier architectureSynchronous communicationBlockingLower throughputHardware under-utilization and higher costsTightly coupledLocation dependentDifficult to extend and maintainBlockingPull-based 6. Application requirements have changed 7. Application requirements have changedPetabytes of data 8. Application requirements have changedPetabytes of data100% uptime 9. Application requirements have changedSub secondsresponse timePetabytes of data100% uptime 10. Change is inevitableUsersDemands richer experiencesExpects super fast response timeApplicationsNeed to scale-on-demandAlways-OnReal-timeBusinessNeed to react to these changing requirements 11. Traditional Style of applications cannot deliver on these requirements any longer 12. ResponsiveElasticResilientMessage-drivenReactive Applications 13. DemoReactive Apphttp://popevent.elasticbeanstalk.comPopEvent 14. ResponsiveApplication pushes updates to client in real timeResponsiveElasticResilientMessage-driven 15. ElasticScales out and inas demand variesResponsiveElasticResilientMessage-driven 16. ElasticScales out and inas demand variesResponsiveElasticResilientMessage-driven 17. ResponsiveElasticResilientMessage-drivenResilientSurvives failure of individual components 18. ResponsiveElasticResilientMessage-drivenResilientSurvives failure of individual components 19. ResponsiveElasticResilientMessage-drivenResilientSurvives failure of individual components 20. MessagedrivenLoosely coupled, message-driven componentsResponsiveElasticResilientMessage-driven 21. ResponsiveElasticResilientMessage-drivenTransitionSynchronousTightly coupledBlockingPull-basedN-TierReactiveN-tier to Reactive 22. N-tier to ReactiveInternal APIInternal APIAPIPollPollDatabaseStorageQueriesSynchronousUser waits for updateFront-end server 23. N-tier to ReactiveFront-end serverInternal APIInternal APIAPIDatabaseStorageQueriesSynchronousUser waits for updatePushPush/Broadcast 24. N-tier to ReactiveFront-end serverInternal APIInternal APIDatabaseStorageQueriesSynchronousUser waits for updatePushPush/BroadcastMessage handlers 25. N-tier to ReactiveFront-end serverInternal APIInternal APIDatabaseStorageQueriesSynchronousUser waits for updatePushPush/BroadcastMessage handlersQueuemessages 26. N-tier to ReactiveFront-end serverInternal APIInternal APIDatabaseStorageQueriesAsynchronousUser waits for updatePushPush/BroadcastMessage handlersQueuemessages 27. Reactive architectureAsynchronous message passingNon-blockingHigher throughputEffective hardware utilization and lower costsLoosely coupledLocation independentEasy to extend and maintainPush-based 28. AWS for Reactive ApplicationsResponsiveAmazon EC2 (Websocket Server)Amazon SNSElasticElastic Load BalancingAuto ScalingElastic BeanstalkAmazon DynamoDBResilientAvailability ZonesAmazon Route 53Auto ScalingAmazon VPCDynamoDBMessage DrivenAmazon SQSAmazon SWF 29. Let's build a reactive applicationGoalsReact to UsersReact to RequestsReact to LoadReact to FailuresPopEvent 30. Reacting to usersResponsiveElasticResilientMessage-driven 31. messageTopicWebSocketServer (EC2)Subscribe/NotifyHTML5 ClientsSNSResponsiveElasticResilientMessage-driven 32. messageTopicWebSocketServer (EC2)HTML5 ClientsWebSocketServer (EC2)Subscribe/NotifySNSResponsiveElasticResilientMessage-driven 33. Amazon SNS -OverviewPublish-subscribe modelScalable, robust way to implement pushTopicsBroadcast messagesResponsiveElasticResilientMessage-driven 34. WebSocket -overviewHTML5 TechnologyFull-duplex communication over TCPResponsiveElasticResilientMessage-driven 35. SockJS -overviewWrapper library over WebSocketAvailable for both clients and serverSockJS library -https://github.com/sockjsClient side sockjs-clientServer Side sockjs-nodeResponsiveElasticResilientMessage-driven 36. Server Subscribe to Amazon SNS topic 37. Server Define endpoints 38. Server Create SockJS server 39. Client Connect to SockJS server 40. Server handle client connection 41. ClientSend Message to SockJS serverhttp://popevent.elasticbeanstalk.com 42. Server -Broadcast to clients 43. ResponsiveElasticResilientMessage-drivenmessageTopicWebSocketServer (EC2)Subscribe/NotifyHTML5 ClientsSNSDone!! 44. ResponsiveElasticResilientMessage-driven 45. Reacting to requestsResponsiveElasticResilientMessage-driven 46. Amazon SQS -overviewResponsiveElasticResilientMessage-drivenEnables loose couplingEnables location independent componentsDesigned to provide high durabilityAt least once deliveryTimeouts to manage failure 47. Message to Tasks Amazon SWFResponsiveElasticResilientMessage-drivenTask based programming modelsRun application workflowsAsynchronous invocationCoordinate distributed application processingOrdered execution of application stepsAt most once deliveryReliable and auditable 48. DynamoDB-overviewResponsiveElasticResilientMessage-drivenFully managed cloud NoSQLdatabaseSeamless ScalingHighly AvailableFlexible data models( key-value/document ) 49. messageTopicWebSocketServer (EC2)Subscribe/NotifyHTML5 ClientsMessageWorker1. ReceiveMessageDynamoDBsaveMessagecomputePopularcalcPopWorker4.QueueMessage1. Get MessageSQSSQSSNSResponsiveElasticResilientMessage-driven 50. Data ModelResponsiveElasticResilientMessage-drivenTablesMessagemessageId(String) Primary Hash KeytimeCreated(Number) Primary Range KeylikeCountermessageId(String) Primary Hash KeydislikeCount(Number)likeCount(Number) 51. Key 1Key 2Key 3Server 1Server 2Server 3Server4Server 5Use unique keys to increase throughput 52. Hotkey -likeCounter 53. ResponsiveElasticResilientMessage-driven 54. Elastic Beanstalk -overviewFast and Simple way to deploy appsMakes development process productiveProvides Auto Scaling and Elastic Load Balancing out of the boxComplete resource controlFree!! Pay only for resources used 55. DemoDeploying with Elastic BeanstalkPopEvent 56. Making WebSocket workSelect TCP 57. Making WebSocket workSelect None 58. Reacting to loadelasticResponsiveElasticResilientMessage-driven 59. Auto Scaling -OverviewScale-out and scale-inWorks seamlessly with Amazon CloudWatchDefine Auto Scaling groupsEnables fault toleranceEnables high availability 60. Elastic Load Balancing -OverviewDistribute the load automaticallyWorks seamlessly with Auto Scaling groupsCross-zone load balancingPerform health checks 61. Reacting to loadelasticAuto ScalingElastic Load BalancingConfigure in Elastic Beanstalk 62. Auto Scaling 63. Auto Scaling contd. 64. Elastic Load Balancing -Config 65. Elastic Load Balancing -Config 66. Elastic Load BalancingUsersLoad BalancerEC2 Instances with Auto Scaling 67. messageTopicWebSocketServers(EC2)Subscribe/NotifyMessageWorker1. ReceiveMessageDynamoDBsaveMessagecomputePopular4.QueueMessage1. Get MessageSQSSQSSNScalcPopWorkerLoad BalancerUsers 68. Reacting to failuresresilientResponsiveElasticResilientMessage-driven 69. Reacting to failuresLevel 1Avoiding single points of failuresAuto Scaling and Elastic Load Balancing in a single Availability Zone.Configure minimum number of instancesResponsiveElasticResilientMessage-driven 70. UsersLoad BalancerEC2 Instances with Auto ScalingReacting to failuresLevel 1 71. Reacting to failuresLevel 2UsersLoad BalancerEC2 Instances with Auto Scaling.Secured with Amazon VPC 72. Reacting to failuresLevel 3Auto Scaling and Elastic Load Balancing across regionsConfigure minimum number of instances in each zone in each regionConfigure DNS entries in Amazon Route 53ResponsiveElasticResilientMessage-driven 73. Amazon Route 53 74. Across regions Amazon Route 53Region 1Region 2Based on a routing policyAmazon Route 53 75. Multi AZ and Multi regionmessageTopicWebSocketServers(EC2)Subscribe/NotifyMessageWorker1. ReceiveMessageDynamoDBsaveMessagecomputePopular4.QueueMessage1. Get MessageSQSSQSSNScalcPopWorkerLoad BalancerUsers 76. Multi AZ and Multi regionUsersAZ1AZ2AZ1AZ2Region 1Region 2 77. DemoReacting to failuresresilient 78. ResponsiveElasticResilientMessage-driven 79. ResponsiveElasticResilientMessage-drivenReactive Applications 80. Thank You! 81. Please give us your feedback on this session.Complete session evaluations and earn re:Invent swag.ARC206 http://bit.ly/awsevals </p>