Introduction to Messaging for Modern Cloud Architecture
AWS Architecture BlogIntroduction to Messaging for Modern Cloud Architectureby Sam Dengler | on03 MAR 2020| inAdvanced (300),Amazon EventBridge,Amazon Kinesis,Amazon MQ,Amazon Simple Notification Service (SNS),Application Integration,Architecture,AWS Serverless Application Model,Best Practices,Customer Solutions,Intermediate (200),Messaging,Top Posts|Permalink|ShareWe hope you’ve enjoyed reading our posts onbest practices for your serverless applications. The posts in the following series will focus on best practices when introducing messaging patterns into your applications. Let’s review some core messaging concepts and see how they can be used to address challenges when designing modern cloud architectures.IntroductionApplications can communicate information with each other using messages, a mechanism for packaging a data payload and associated metadata. The application that sends a message is called the producer and the application that receives the message is called the consumer. Producers and consumers exchange messages using a variety of transportation channels, for example point-to-point requests, message queues, subscription topics, or event buses. These transportation channels have different characteristics that make them useful when implementing message communication patterns. Dependencies emerge when producers and consumers exchange messages, which is called coupling.Synchronous CommunicationMessage communication is called synchronous when the producer sends a message to the consumer and waits for a response before the producer continues its processing logic. An example of synchronous communication over a point-to-point channel is when a HTTP client makes a request to a HTTP service, waits for the service to process the request, and then applies logic to the HTTP response to determine how to proceed.Synchronous communication patterns are more straightforward to implement, however they create tight coupling between producers and consumers. Tight coupling can cause problems due to traffic spikes and failures propagating directly throughout the application. For example, in a three-tier architecture, when the application experiences a spike in client traffic, the web tier directly translates the traffic spike as pressure on downstream resources (the logic and data tiers), which may not scale to meet the sudden demand. Likewise, downstream resource failure in the logic or data tier directly impacts the web tier from responding to client requests. Applications can mimic a synchronous experience, for example a status spinner, using asynchronous communication with a polling or push notification strategy.Asynchronous CommunicationMessage communication is called asynchronous when the producer sends a message to the consumer and proceeds without waiting for the response. An example of asynchronous communication over a message queue channel is when a client publishes a message to a queue, and after the queue acknowledges receipt of the message, the publisher proceeds without waiting for the consumer to process the message.Asynchronous communication patterns are implemented using transportation channels such as queues, topics, and event buses to create loose coupling between producers and consumers. Loose coupling increases an architecture’s resiliency to failure and ability to handle traffic spikes because it creates an indirection between producer and consumer communication, enabling them to operate independently of each other. Using the three-tier architecture example, a message queue can be introduced between the web, logic, and data tiers to enable each to scale independently of each other. When the application experiences a spike in client traffic, the web tier translates the traffic spike as more messages to the queue for processing, however the logic tier may continue to process messages off the queue without being directly impacted.Considerations and Next StepsAlthough asynchronous communication patterns can benefit modern cloud architectures, there are tradeoffs to consider. Asynchronous messaging adds latency to end-to-end processing time due to the addition of middleware. Producers and consumers take a dependency on the middleware stack, which must also scale to meet demand and be resilient to failure. Care must be taken to appropriately configure producers, consumers, and middleware to handle errors so that messages are not lost, more monitoring is required to ensure proper operations, and multiple logs must be correlated to troubleshoot and diagnose problems.Amazon MQ,Amazon Kinesis,Amazon Simple Queue Service(SQS), Amazon Simple Notification Service(SNS), andAmazon EventBridgeare highly available, large scale, failure resistant managed services that can be used to implement asynchronous messaging patterns. You can explore these services at theAWS Messagingpage and their integration into Serverless Architectures in the free new digital course,Architecting Serverless Solutions. You can also visit theAWS Event-Driven Architecturepage to learn how to apply messaging patterns to build event-driven solutions. The upcoming posts in this series will explore these AWS services to help ensure message patterns are implemented using best practices when applied to modern cloud architecture.In this messaging seriesNow that you have an understanding of some core messaging concepts, be sure to read the next posts in this series:Event-Based Processing for Asynchronous CommunicationApplication Integration Using Queues and MessagesServerless Stream-based Processing for Real-time InsightsTAGS:Amazon EventBridge,communication,messaging,serverless architecturesSam DenglerSam Dengler is a Principal Solutions Architect for AWS, focused on Integration and event-driven architectures. Sam is responsible for helping customers design and operate Serverless applications and event-driven solutions using services like EventBridge and Step Functions. He is a regular speaker at AWS Summits, re:Invent, and various tech events. Sam holds a Bachelor of Science and Masters of Computer Science from NC State University.
We hope you’ve enjoyed reading our posts on best practices for your serverless applications. The posts in the following series will focus on best practices when introducing messaging patterns into your applications. Let’s review some core messaging concepts and see how they can be used to address challenges when designing modern cloud architectures. Introduction Applications […]
Sam Dengler
Advanced (300) Amazon EventBridge Amazon Kinesis Amazon MQ Amazon Simple Notification Service (SNS) Application Integration Architecture AWS Serverless Application Model Best Practices Customer Solutions Intermediate (200) Messaging Top Posts