What are microservices?

Microservices is a software architectural style that compartmentalizes an application into a collection of independent services. It uses a principle called domain driven design to achieve this. 

Essentially, developers use the domain model as the main source for software design and development. The domain model then creates a web of interconnected objects, which are required for business purposes.

Let's say you're creating a sales platform. In this case, your application could have customer, transaction, and vendor classes within it. This set of classes and the relationships between them would form your domain model.

You would then go and create individual services for specific business functions. In our example, you would break the platform into smaller applications. There would be individual software systems that handle sales analytics, revenue lifecycle management, and partner relationship management.

Companies traditionally used a monolithic architecture to build their applications. However, the challenge with a monolith architecture is that not everything scales in parallel. 

Modules in a monolithic architecture cannot be executed independently. Development teams that work on overlapping areas would find it difficult to make changes without affecting other teams. 

If a team wanted to use a distributed system, they would have to use a solution such as COBRA to make the monolith work how they wanted.

AWS, Azure, and Google Cloud Platform have made it possible for businesses to scale systems to sizes that were not previously possible. As a result of this, companies that previously used a monolithic architecture have shifted their attention to microservices.  

What are the benefits of microservices?

Microservices are used by large businesses because they allow different components of an application to run as an independent service. These functions are deployed in an independent container and communicate with other containers over APIs.

This software architecture is language-agnostic and framework-independent. Components can be scaled independently and teams can iterate at will through a DevOps pipeline that reduces risks. 

Microservices are ideal for building multiplatform applications that serve users across several platforms such as mobile devices, smart TVs, and gaming consoles.

Amazon, Coca-Cola, Etsy, Netflix, Spotify, Uber, and Zalando are examples of businesses that utilize microservices across their back-end systems to ensure an excellent customer experience on the front end.

Why does this matter?

In many cases, software applications represent the entire customer experience.  These applications provide a communication channel between customers and a business. 

An introduction to the different types of microservices

Software architects who build and operate large-scale applications want a flexible back-end that can be modified to their needs. These commonly used microservice design patterns satisfy the need for flexibility. The design patterns are called: 

  • API gateway
  • Backend for frontend
  • Circuit breaker
  • Command and query responsibility segregation
  • Consumer-driven contract tracing
  • Database per microservices
  • Event sourcing
  • Externalized configuration
  • SAGA
  • Strangler pattern

These design patterns have been tested repeatedly and provide solutions to common issues developers face when working with microservices. Exploring each design pattern is beyond the scope of this post, but we encourage you to research these patterns because doing so will provide insight into how microservices handle performance, scalability, and maintainability.

How microservices communicate with each other

There are several approaches to implementing interprocess communication (ICP) in microservices, and they come with their own advantages and disadvantages. ICP communication methods can be synchronous or asynchronous.

When using a synchronous protocol, the client sends a request and waits for a response. Examples of synchronous protocols include HTTP, REST API, and Google gRPC. You need to be aware of where you are sending your request when using a synchronous protocol. 

Asynchronous protocols send requests to a broker like RabbitMQ, which queues the request and then sends it on to the relevant microservice. This protocol works well for businesses that have customers who can send millions of requests, which can then cause bottlenecks and downtime. 

These businesses tend to have multiple receivers that are handling requests from consumers. Another advantage of this protocol is that it reduces dependencies between microservices. Examples of asynchronous protocols include AMQP, MQTT, and STOMP.

Clare Hopping
Freelance writer

Clare is the founder of Blue Cactus Digital, a digital marketing company that helps ethical and sustainability-focused businesses grow their customer base.

Prior to becoming a marketer, Clare was a journalist, working at a range of mobile device-focused outlets including Know Your Mobile before moving into freelance life.

As a freelance writer, she drew on her expertise in mobility to write features and guides for ITPro, as well as regularly writing news stories on a wide range of topics.