Skip to main content

Microservices

Build highly available microservices to power applications of any size and scale.

Monolithic vs. Microservices Architecture

With monolithic applications, all processes are tightly coupled and run as a single service. This means that if one process of the application experiences a spike in demand, the entire architecture must be scaled. Adding or improving the features of a monolithic application becomes more complex as the code base grows. This complexity limits experimentation and makes it difficult to implement new ideas. Monolithic architectures add risk for application availability because many dependent and tightly coupled processes increase the impact of a single process failure.

With a microservices architecture, an application is built as independent components that run each application process as a service. Multiple services communicate via a well-defined interface using lightweight APIs. Services are built for business capabilities, and each service performs a single function. New features are simple to develop and deploy. Because they are independently run, each service can be updated, deployed, and scaled independently to meet demand for specific functions of an application.

The microservices architecture is a software design pattern that indicates maturity in processes and a reduction in technical debt. This service-oriented architecture offers many benefits for developers and organizations.

Diagram comparing a monolithic node.js API service with users, threads, and posts grouped together, to a microservices architecture with separate services for users, threads, and posts.

Characteristics of Microservices Architectures

Autonomous

Each of the independent services in a microservices architecture can be developed, deployed, operated, and scaled without affecting the functioning of other services. Separate services do not need to share any of their code or implementation with other services. Any communication between individual components in microservice-based applications happens via well-defined APIs.

Specialized

Each service in a microservices architecture is designed for a set of capabilities and focuses on solving a specific problem. If developers contribute more code to a service over time and the service becomes complex, it can be broken into multiple services.

Coordinated Services

Each microservice coordinates with one or more other services to result in a complete application. Between-service communications must be well-defined and reliable to produce a scalable, distributed architectural style. Multiple services must be able to communicate with a single service at once without failure or data reliability issues.

API gateway

The service-oriented architecture requires an API gateway for routing, authentication, traffic solutions, and application observability metrics. This hub is the main point of data entry and exit for different services within the microservices architecture.

Service registry

Each application has a service registry where each of the services in the microservices architecture is listed. Within the registry, each service has associated metadata such as its status, IP address, protocols, and other essential information. Service discovery in the registry queries and updates the status and details of each running service instance.

Benefits of Microservices

Agility

Microservices foster an organization of small, independent teams that take ownership of their services. Teams act within a small and well-understood context, and are empowered to work more independently and more quickly. This shortens development cycle times. You benefit significantly from the aggregate throughput of the organization.

Flexible Scaling

The microservices architecture allows each service to be scaled independently to meet demand for the application feature it supports. This enables teams to right-size infrastructure needs, accurately measure the cost of a feature, and maintain availability if a service experiences a spike in demand.

Easy Deployment

The microservices architecture enables continuous integration and continuous delivery, making it easy to try out new ideas and to roll back if something doesn’t work. The low cost of failure enables experimentation, makes it easier to update code, and accelerates time-to-market for new features. It also reduces operational complexity.

Technological Freedom

Microservices architectures don’t follow a “one size fits all” approach. Teams have the freedom to choose the best tool or different programming languages to solve their specific problems. As a consequence, teams building a microservices architecture can choose the best tool and implementation details for each job.

Reusable Code

Dividing software into small, well-defined modules enables teams to use functions for multiple purposes. A service written for a certain function can be used as a building block for another feature. This allows an application to bootstrap off itself, as developers can create new capabilities without writing code from scratch.

Resilience

Service independence increases an entire application’s resistance to failure. In a monolithic architecture, if a single component fails, it can cause the entire application to fail. With a microservices architecture, applications handle total service failure by degrading functionality and not crashing the entire application.

Developer Specialization

Loosely coupled services within a microservices architecture have their own internal business rules and defined service boundaries. This allows small teams or individual developers to work on single services at once. Developers can become deeply specialized in services such as deep business logic, machine learning applications, or user interface development.

Containers and Microservices

The microservices architecture is a good fit for container technology. Cloud containers are software code packages that contain an application’s code, its libraries, and other dependencies that it needs to run in the cloud.

Microservices-based applications can consist of tens, hundreds, or even thousands of containers. Each container runs its own microservice or bundles multiple related services. Containers are deployed independently, with containers and the application as a whole managed by container orchestration products.

Containerization is a popular deployment strategy in the cloud, as containers can be deployed across multiple instances and regions. Containerization technologies support DevOps infrastructure, such as continuous integration and continuous deployment.

The container stack

The container stack includes a container orchestration solution, a container registry, cloud instances for container deployment, and networking solutions for containers.

Containerization technology stacks allow software developers to produce portable, reusable, scalable, cost-efficient applications. The ability to deploy services independently and test per service leads to safer code.

Microservices architecture design patterns

Database-Per-Service

Within the Database-Per-Service design pattern, each microservice has its own database and controls its own data storage and management. This microservices architecture design pattern allows developers to make decisions about the preferred database and how data management works. Developers must work to maintain data consistency within this design pattern, as different services work with the same data differently.

Asynchronous Messaging

The Asynchronous Messaging design pattern is an event and command-driven architecture, where a message broker sits between services. The message broker handles transaction management. This pattern has loose coupling between services, and a consumer service does not necessarily need to be online to receive a message at a later time. These independently deployable, loosely coupled services result in a fault-tolerant system.

Messaging Bridge

A Messaging Bridge design pattern is required when individual services each have a different type of communication mechanism. The messaging bridge allows different protocols to communicate with one another, translating messages into the format necessary for ingestion.

Chain of Responsibility

The Chain of Responsibility design pattern is a microservices architecture where handoffs between independent services happen in a sequential, repeatable order. This design pattern is easy to implement and ensures conformity in how microservices communicate and how data flows.

Sidecar

Within the Sidecar microservices architecture design pattern, a service has one or more associated microservices. For example, a service may have sidecar service dependencies like logging or monitoring. This pattern deconstructs microservices further to decouple related services from the underlying business logic.

Gateway Aggregation

The Gateway Aggregation design pattern groups together microservice outputs that span multiple services, returning a combined result that increases performance. The intermediary gateway performs this aggregation for each appropriate service.

Gateway Offloading

In the Gateway Offloading pattern, smaller services that are frequently used throughout the application are instead embedded into the gateway. Examples of these services include encryption and the authorization user service. This design pattern results in performance benefits.

Strangler Fig

The Strangler Fig microservices architecture design pattern is a way to rearchitect monolithic applications, one function at a time. Using this strategy, developers create one service at a time, reducing the monolithic architecture until the entire system is comprised of multiple microservices.

The Most Complete Platform for the Microservices Architecture

Containers

Amazon Elastic Container Service A highly scalable, high performance container management service that supports Docker containers and allows you to easily run applications on a managed cluster of Amazon EC2 instances. Learn More

AWS Lambda AWS Lambda lets you run code without provisioning or managing servers. Just upload your code and Lambda manages everything that is required to run and scale your code with high availability. Learn more

Coursera Using Amazon ECS, Coursera can now deploy software changes in minutes instead of hours in a resource-isolated environment. Learn More

Localytics Localytics used AWS Lambda to build microservices that allowed their development teams to build custom analytics without central support. Learn More

Storage & Databases

Amazon ElastiCache Amazon ElastiCache improves service performance by allowing you to retrieve information from fast, managed, in-memory caches, instead of relying entirely on slower disk-based databases. Learn More

Amazon S3 Amazon S3 provides developers and IT teams highly reliable, secure, and scalable object storage for all of their data, large or small. Learn More

Amazon DynamoDB A fully managed, fast, and flexible NoSQL database service for all applications that need consistent, single-digit, millisecond latency at any scale. Learn More

Amazon RDS Easily setup, operate, and scale a relational database in the cloud. Choose from six familiar database engines, including Oracle, Microsoft SQL Server, PostgreSQL, MySQL and MariaDB. Learn More

Amazon Aurora A relational database engine that combines the speed and reliability of high-end commercial databases with the simplicity and cost-effectiveness of open source databases. Deliver up to 5x the throughput of standard MySQL running on the same hardware. Learn more

Remind Remind reduced application response times 200% by building a PaaS for microservices on Amazon ECS. Learn more

Networking

AWS Cloud Map AWS Cloud Map is service discovery for all your cloud resources. With Cloud Map, you can define custom names for your application resources, and it maintains the updated location of these dynamically changing resources. Learn more

AWS App Mesh AWS App Mesh makes it easy to monitor and control microservices running on AWS. App Mesh standardizes how your microservices communicate, giving you end-to-end visibility and helping to ensure high-availability for your applications. Learn more

Application Load Balancer The Application Load Balancer load balances HTTP and HTTPS traffic at the application layer (level 7) providing advanced request routing that is targeted at the delivery of modern application architectures, including microservices and containers. Learn More

Network Load Balancer The Network Load Balancer offers high performance load balancing that operates at the network connection layer (level 4) and allows you to route connections to microservices based on IP protocol data. The Network Load Balancer can handle millions of requests per second while maintaining ultra-low latencies. Learn more

Amazon API Gateway Amazon API Gateway offers a comprehensive platform for API management. Amazon API Gateway allows you to process hundreds of thousands of concurrent API calls and handles traffic management, authorization and access control, monitoring, and API version management. Learn more

Amazon Route 53 Amazon Route 53 is a highly available and scalable cloud Domain Name System (DNS) web service that effectively connects requests to infrastructure that is running in AWS. It can be used for IP health checks and service discovery for microservices. Learn more

Airtime Case Study Airtime provides its social experience to customers faster, more reliably, and with no lag time after redesigning its app as microservices running on AWS. Learn More

Messaging

Amazon Simple Notification Service (Amazon SNS) Amazon SNS is a fully managed pub/sub messaging service that makes it easy to decouple and scale microservices, distributed systems, and serverless applications. Learn more

Amazon Simple Queue Service (Amazon SQS) Amazon SQS is a fully managed message queuing service that makes it easy to decouple and scale microservices, distributed systems, and serverless applications. Learn more

Lyft Case Study Lyft uses AWS to move faster as a company and manage its exponential growth, leveraging AWS products to support more than 100 microservices that enhance every element of its customers’ experience. Learn More

Logging and Monitoring

AWS CloudTrail With CloudTrail, you can log, continuously monitor, and retain account activity related to actions across your infrastructure. CloudTrail event history simplifies security analysis, resource change tracking, and troubleshooting. Learn more

Amazon CloudWatch Use Amazon CloudWatch to collect and track metrics, collect and monitor log files, set alarms, and automatically react to changes across your running services and AWS resources. Learn more

AWS X-Ray Get an end-to-end view of requests as they travel through your application and see a map of your application’s underlying components. As a set of microservices works together to handle a request, AWS X-Ray can provide a centralized view of logs, allowing you to monitor and troubleshoot complex interactions. Learn more

Shippable Case Study By using microservices hosted on Amazon ECS, Shippable has been able to focus on delivering features to its customers and has sped feature deployment times from once a week to multiple per day. Learn More

DevOps

Amazon Elastic Container Registry (Amazon ECR) A fully managed Docker container registry that you can use to store, manage, and deploy Docker container images. Amazon ECR is integrated with Amazon Elastic Container Service (Amazon ECS), simplifying development to production workflow for containers. Learn more

AWS Developer Tools AWS Developer Tools is a set of services that enable developers and IT operations professionals practicing DevOps to rapidly and safely deliver software. Together, these services help you securely store and version control your application's source code, and automatically build, test, and deploy your application to AWS or your on-premises environment. Learn more

Gilt Case Study Gilt moved from an on-premises data center to AWS to leverage the speed and efficiency of a cloud-based microservices infrastructure. Learn More

Browse all cloud computing concepts

Browse all cloud computing concepts content here:

Loading
Loading
Loading
Loading
Loading

Did you find what you were looking for today?

Let us know so we can improve the quality of the content on our pages