Implementing Microservices on AWS AWS Whitepaper Using protocols and caching Managing chattiness in microservices communication Chattiness refers to excessive communication between microservices, which can cause inefficiency due to increased network latency. It's essential to manage chattiness effectively for a well-functioning system. Some key tools for managing chattiness are REST APIs, HTTP APIs and gRPC APIs. REST APIs offer a range of advanced features such as API keys, per-client throttling, request validation, AWS WAF integration, or private API endpoints. HTTP APIs are designed with minimal features and hence come at a lower price. For more details on this topic and a list of core features that are available in REST APIs and HTTP APIs, see Choosing between REST APIs and HTTP APIs Often, microservices use REST over HTTP for communication due to its widespread use. But in high- volume situations, REST's overhead can cause performance issues. It’s because the communication uses TCP handshake which is required for every new request. In such cases, gRPC API is a better choice. gRPC reduces the latency as it allows multiple requests over a single TCP connection. gRPC also supports bi- directional streaming, allowing clients and servers to send and receive messages at the same time. This leads to more efficient communication, especially for large or real-time data transfers. If chattiness persists despite choosing the right API type, it may be necessary to reevaluate your microservices architecture. Consolidating services or revising your domain model could reduce chattiness and improve efficiency. Using protocols and caching Microservices often use protocols like gRPC and REST for communication (see the previous discussion on Communication mechanisms (p. 16) . ) gRPC uses HTTP/2 for transport, while REST typically uses HTTP/1.1. gRPC employs protocol buffers for serialization, while REST usually uses JSON or XML. To reduce latency and communication overhead, caching can be applied. Services like Amazon ElastiCache or the caching layer in API Gateway can help reduce the number of calls between microservices. 26
Implementing Microservices on AWS AWS Whitepaper Resource inventory and change management Auditing In a microservices architecture, it's crucial to have visibility into user actions across all services. AWS provides tools like AWS CloudTrail, which logs all API calls made in AWS, and AWS CloudWatch, which is used to capture application logs. This allows you to track changes and analyze behavior across your microservices. Amazon EventBridge can react to system changes quickly, notifying the right people or even automatically starting workflows to resolve issues. Figure 17: Auditing and remediation across your microservicesResource inventory and change management In an agile development environment with rapidly evolving infrastructure configurations, automated auditing and control are vital. AWS Config Rules provide a managed approach to monitoring these changes across microservices. They enable the definition of specific security policies that automatically detect, track, and send alerts on policy violations. For instance, if an API Gateway configuration in a microservice is altered to accept inbound HTTP traffic instead of only HTTPS requests, a predefined AWS Config rule can detect this security violation. It logs the change for auditing and triggers an SNS notification, restoring the compliant state. 27
Implementing Microservices on AWS AWS Whitepaper Resource inventory and change management Figure 18: Detecting security violations with AWS Config 28
Implementing Microservices on AWS AWS Whitepaper Conclusion Microservices architecture, a versatile design approach that provides an alternative to traditional monolithic systems, assists in scaling applications, boosting development speed, and fostering organizational growth. With its adaptability, it can be implemented using containers, serverless approaches, or a blend of the two, tailoring to specific needs. However, it's not a one-size-fits-all solution. Each use case requires meticulous evaluation given the potential increase in architectural complexity and operational demands. But when approached strategically, the benefits of microservices can significantly outweigh these challenges. The key is in proactive planning, especially in areas of observability, security, and change management. It's also important to note that beyond microservices, there are entirely different architectural frameworks like Generative AI architectures such as Retrieval Augmented Generation (RAG) , providing a range of options to best fit your needs. AWS, with its robust suite of managed services, empowers teams to build efficient microservices architectures and effectively minimize complexity. This whitepaper has aimed to guide you through the relevant AWS services and the implementation of key patterns. The goal is to equip you with the knowledge to harness the power of microservices on AWS, enabling you to capitalize on their benefits and transform your application development journey. 29
Implementing Microservices on AWS AWS Whitepaper Contributors The following individuals and organizations contributed to this document: • Sascha Möllering, Solutions Architecture, Amazon Web Services• Christian Müller, Solutions Architecture, Amazon Web Services • Matthias Jung, Solutions Architecture, Amazon Web Services • Peter Dalbhanjan, Solutions Architecture, Amazon Web Services • Peter Chapman, Solutions Architecture, Amazon Web Services • Christoph Kassen, Solutions Architecture, Amazon Web Services • Umair Ishaq, Solutions Architecture, Amazon Web Services • Rajiv Kumar, Solutions Architecture, Amazon Web Services • Ramesh Dwarakanath, Solutions Architecture, Amazon Web Services • Andrew Watkins, Solutions Architecture, Amazon Web Services • Yann Stoneman, Solutions Architecture, Amazon Web Services • Mainak Chaudhuri, Solutions Architecture, Amazon Web Services 30
Implementing Microservices on AWS AWS Whitepaper Document history To be notified about updates to this whitepaper, subscribe to the RSS feed. Change Description Date Major update (p. 31) Added information about AWS Customer Carbon Footprint Tool, Amazon EventBridge, AWS AppSync (GraphQL), AWS Lambda Layers, Lambda SnapStart, Large Language Models (LLMs), Amazon Managed Streaming for Apache Kafka (MSK), Amazon Managed Workflows for Apache Airflow (MWAA), Amazon VPC Lattice, AWS AppConfig. Added separate section on cost optimization and sustainability. July 31, 2023 Minor updates (p. 31) Added Well-Architected to abstract. April 13, 2022 Whitepaper updated (p. 31) Integration of Amazon EventBridge, AWS OpenTelemetry, AMP, AMG, Container Insights, minor text changes. November 9, 2021 Minor updates (p. 31) Adjusted page layout April 30, 2021 Minor updates (p. 31) Minor text changes. August 1, 2019 Whitepaper updated (p. 31) Integration of Amazon EKS, AWS Fargate, Amazon MQ, AWS PrivateLink, AWS App Mesh, AWS Cloud Map June 1, 2019 Whitepaper updated (p. 31) Integration of AWS Step Functions, AWS X-Ray, and ECS event streams. September 1, 2017 Initial publication (p. 31) Implementing Microservices on AWS published. December 1, 2016 NoteTo subscribe to RSS updates, you must have an RSS plug-in enabled for the browser you are using. 31
Implementing Microservices on AWS AWS Whitepaper Notices Customers are responsible for making their own independent assessment of the information in this document. This document: (a) is for informational purposes only, (b) represents current AWS product offerings and practices, which are subject to change without notice, and (c) does not create any commitments or assurances from AWS and its affiliates, suppliers or licensors. AWS products or services are provided “as is” without warranties, representations, or conditions of any kind, whether express or implied. The responsibilities and liabilities of AWS to its customers are controlled by AWS agreements, and this document is not part of, nor does it modify, any agreement between AWS and its customers. Copyright © 2023 Amazon Web Services, Inc. or its affiliates. 32
Implementing Microservices on AWS AWS Whitepaper AWS Glossary For the latest AWS terminology, see the AWS glossary in the AWS Glossary Reference. 33
Share with your friends: |