AWS Microservices: Architecture, Use Cases, Scaling & More

  • 8 min read

We’ve all heard the terms crop up in conversation, monoliths & microservices – but what exactly do they mean?  How exactly do we ‘break up the monolith’?

In this post we’ll explore the differences between monolothic and microservices based applications, and highlight some of the benefits of microservices.

We’ll also explore what services AWS have available to help you to build out a microservices architected application on the AWS cloud.

Microservices Basics - What are Microservices?

Microservices, or microservices architecture, is a service oriented architecture – a way of building software applications which are broken down into smaller, independent & composable service units which function together to deliver the overall functionality of the application.

Each microservice, or component, is continuously developed and maintained separately from the other microservices.

Microservices are often connected together via RESTful APIs, so they have access to a broad range of tools and solutions from the extensive web services ecosystem.

Monolith vs Microservices

By contrast, a monolithic application is developed all in one piece – all of the software components of the application are tightly coupled in a single package and run as a single service.

If we use an e-commerce website as an example application, you can imagine the different functions of the site might include the user interface, product catalogue, search functionality, payment gateway and a recommendation engine.  Delivered as a monolithic application, these components would all be in a single package, deployed on a single server.  If the e-commerce site gets busy, say during Black Friday sales, the only way to scale would be to add more servers, regardless of which part of the application is experiencing the most load.

Using the same example, with each component delivered as a microservice, each component could be individually scaled based on which particular part of the application is experiencing the most demand.  For example, at the start of the sale, the user interface would be the first component to be affected, before any stress reaches the payment gateway, so this component could be scaled independently of the other components.

MonolithMicroservices
Single code base for all application components & business functionsEach component is small as it can be, and delivers a specific business function
Slower Service StartupFast Service Startup
Tightly Coupled – changes to one component may affect othersLoosely coupled – changes to one component do not affect others
Faults not isolated – failure of one component can bring entire system down.Faults are isolated – failure of one component does not bring entire system down.
Scaling is challenging and wasteful – lots of over-provisioned resourcesOnly the busy component needs to be scaled, making more efficient use of resources.
Large development team, difficult to manageSmall, focused ‘2 Pizza’ teams able to iterate faster
Centralized data managementdecentralized data management
Single code base for entire applicationDifferent microservices can use different code bases

Microservices Benefits

So now that we understand some of the differences between monoliths and microservices, let’s take a look at some of the key benefits of microservices.

  • Simpler and Faster to Deploy – microservices enable the deployment of individual application components without affecting other services.
  • Simpler to Understand – it is easier for developers to follow microservices code, as the code of the component is isolated and has fewer dependencies on other parts of the application.
  • Developer Independence – smaller (two pizza) teams working on a single application component can iterate faster than a large team working on a monolithic app.
  • Isolation and resilience – if one microservice fails, it is easy to spin up another while the rest of the application continues to function.
  • Scalability – if a particular component of the application is more in demand than other components, it can be scaled independently.
  • Reusability – application components can be shared with and re-used by other applications across the business, speeding up the development process for those apps.
  • Lifecycle Automation – individual components are easier to manage in a Continuous Integration/Continuous Delivery (CI/CD) environment.
  • Minimized Risk – given the flexibility over language and platform selection, microservices help businesses avoid technology vendor or language lock in.

Microservices Use Cases

Now that we’ve looked some of the benefits of microservices, let’s take a look at some of the more compelling use cases for a decoupling an application into a microservices architecture.

  • Extensive Data Pipelines – One example of an extensive data pipeline would be a reporting system on retail store sales.  Every step in the data preparation process could be handled by a microservice – data collection, cleansing, normalization, enrichment, aggregation, reporting and so on.  Because the microservices workflow is easily traceable, it would be easy to figure out which microservice needs to be updated in the event that there are any problems identified with the data.
  • CPU or RAM Intensive Application Components – it is easy to spawn multiple instances of a CPU intensive microservice on demand, without starving the rest of the application of CPU power.  Text analysis tools that consume a lot of RAM can be problematic to redeploy and restart – if they rarely change it makes sense to separate them out.
  • Machine Learning – a microservices based machine learning environment can collect, aggregate and analyze data flow so that the machine learning framework can calculate an outcome.  In such an ML environment, the data has to run through many steps before an outcome is reached.  One advantage of using microservices is that different machine learning models can be applied to the same data to produce a more accurate outcome.

Scaling Microservices

Scaling technology resources to meet peaks in application demand is always challenging. Scaling of microservices environments it not necessarily easier, it just presents a different challenge.

In a traditional monolithic application, scaling is achieved by running multiple copies of the application on multiple servers and load balancing between them. 

In a microservices environment, scaling is achieved by scaling the individual components.  But there is an added level of complexity when scaling microservices, in that they are communicating with other services which may be written in different code bases, or hosted on different platforms.  When demand for the application increases, all components have to be coordinated to scale appropriately to handle the increased demand.

Use of an application proxy or application delivery controller is advisable – this can help to identify performance issues with the application, and can automate scaling of the appropriate components.  

An appropriate Application Performance Management tool should also be deployed to enable end to end tracing of the application, which will help developers to quickly identify which microservice is responsible for any application performance degredation.

AWS Microservices Architecture

AWS offers ‘The Most Complete Platform for Microservices‘. The AWS service portfolio offers a broad range of easily integrated building blocks to enable delivery of any application at any scale.  Let’s take a look at what’s available:

Compute

  • Amazon Elastic Container Service – Containers are widely regarded as the compute platform of choice for delivering microservices.  ECS is a highly scalable, high performance container management system that enables AWS customers to run their applications in Docker containers on a managed Amazon EC2 cluster.
  • AWS Lambda – Lambda is the AWS serverless offering which enables AWS customers to run upload and run application code without provisioning servers.  Users simply upload their code, and Lambda takes care of running, scaling and high availability.  And users only pay for compute while their code is running.  So a website hosted on Lambda with no visitors can effectively be hosted for free!  This is a great commercial model for startups with limited budget and no legacy code to worry about.

Storage & Databases

  • Amazon DynamoDB – DynamoDB is the AWS NoSQL database offering consistent, single digit millisecond latency at any scale.
  • Amazon ElastiCache  – ElastiCache improves microservice performance by enabling customers to retrieve data from fast in-memory caches rather than from slower disk based databases.
  • Amazon S3  – S3 provides durable, highly scalable and secure object storage.
  • Amazon RDS – RDS makes it easy to set up, manage and scale a relational database.  RDS supports Microsoft SQL, MySQL, PostgreSQL, Maria DB and Oracle. 
  • Amazon Aurora – Aurora is AWS’ own database engine which offers the simplicity and cost effectiveness of open source databases, with the performance of high end commercial databases.

Networking

  • AWS App Mesh – App Mesh enables standardized communication between microservices, making it easy to monitor and control microservices running on AWS.
  • Application Load Balancer – ALB is a layer 7 load balancer enabling advanced HTTP and HTTPS request routing to microservices and containers.
  • Network Load Balancer – NLB is a layer 4 load balancer operating at the IP level – NLB can handle massive network traffic while ensuring low latency.
  • Amazon API Gateway – API gateway enables applications to process thousands of concurrent API calls.
  • Amazon Route 53 – Route 53 is Amazon’s highly available and scalable DNS service.

Messaging

  • Amazon Simple Notification Service (SNS) – SNS enables applications to push messages out to subscribers – for example Mobile App notfications.
  • Amazon Simple Queue Service (SQS) – SQS is a fully managed message queue service that enables the decoupling and scaling of microservices.

Logging & Monitoring

  • AWS CloudTrail – CloudTrail continuously logs AWS account and API activity across customer’s entire infrastructure, which simplifies security auditing and analysis.
  • Amazon CloudWatch – Cloudwatch enables application and and resource monitoring via the collection and tracking of key monitoring metrics.
  • AWS X-Ray – X-Ray enables distributed tracing of serverless applications running on AWS Lambda.

DevOps

  • Amazon Elastic Container Registry (ECR) – ECR is a fully managed Docker container image repository which facilitates the storage, management and deployment of containers on AWS.
  • AWS Developer Tools – a set of services enabling Developers and IT operations teams to deliver software quickly and safely.  The services enable secure storage and version control of app source code, and enables customers to build, test and deploy their apps to AWS or on premise infrastructure.
So there you have it – the most comprehensive collection of services enabling customers to build out microservices architectures at any scale.  If you’re interested in learning how to leverage any of these AWS services, take a look at our AWS Migration and AWS Managed Services pages.  Our team of certified AWS specialists is ready to talk to you about how Logicata can help you break down your monolith, or help you to build out your new microservices application on AWS.
nv-author-image

Karl Robinson

Director and Co-Founder of Logicata, an AWS Managed Services Provider. Over 20 years experience in the internet & cloud industry. Closet geek, AWS & Azure certified.