Brandon Holz.

What are microservices and what are the benefits of using them?

Cover Image for What are microservices and what are the benefits of using them?

Microservices are a hot topic in the industry today, but what exactly are they? What is all the fuss about? In this article we’ll dive into what microservices are and how they can benefit your organisation.

The term “microservice” was first used by Peter Rogers at his presentation at the @Scale engineering conference in 2014. Although its first use is somewhat recent, microservices are not a new concept and can be traced back to the software design patterns of Robert Martin.

Let’s dive a little deeper into the topic and how this approach differs from other architectural patterns.

Microservices are typically characterised as small, independent, self-contained applications that can be deployed independently of each other, but when put together form a larger more integrated piece of software. The most popular use cases include complex web applications and online platforms where many different tools and services are required to achieve a common goal. Each tool or service is developed as its own independent application, with diverse technologies and languages used based on the most appropriate fit for solving the problem at hand.

A request to a traditional monolithic architecture may (at a very high level) look something like this:

monolith.png

With the request being routed to one of many services within the same application and codebase, and all services within the application accessing the same database. In other words, one monolithic application will contain all middleware, routing, business logic and database access to implement all services within the application. This codebase is deployed as one, monolithic unit.

The issues with the above approach are that any disruption to the functioning of the application will impact the whole application. Additionally it will quickly become difficult to maintain and will be less efficient to deploy, and it is therefore not very scalable.

Microservices, on the other hand, look a little more like this:

microservice.png

Here, each service is entirely self contained and is managed and developed as a separate unit. In this case, a service will contain all middleware, routing, business logic and database access to implement that particular service only.

Microservices provide a way to achieve better scalability since each service will operate independently from other components within your system architecture, and can be managed and maintained separately. This means that if one component fails or gets overloaded then there won't be any impact on your overall system performance because only one service has failed instead of all of them failing simultaneously, as might be the case in a monolith.

As opposed to a monolithic architecture where all parts of an application are created at once and must be released together, microservices can be released and updated independently. This allows multiple teams to work in parallel and deploy their changes without having to wait for other teams to finish their work. When you have many different applications interdependent on one another this facilitates faster development, testing and delivery cycles where agile methodologies can truly flourish.

Microservices also allow for greater flexibility as they enable developers to build on top of multiple software platforms and use platforms that best serve the needs of a particular service. This can make it easier for your company’s engineers who may not have experience with certain technologies or toolsets from day one but still want them integrated into their systems quickly.

It is, of course, not all sunshine and rainbows. As you can imagine from looking at the diagrams above, the microservice architecture does provide some challenges, particularly around data storage and management, given that each service has its own database. Despite the many benefits if microservices, this does present quite a challenge, and a number of approaches have been developed to tackle this issue. We will save the exploration of these approaches for a future article, though I think it will suffice to say that when it comes to microservices, the benefits outweigh the challenges.