An Introduction to Microservices

In this article, I will explain in simple words what microservices are and some of the main advantages of using this architecture approach.

Sebastián Pérez Etchandy
Nowports Tech and Product
4 min readAug 9, 2021

--

What are microservices?

Let’s start by finding a way to define microservices, a frequently used term to describe approaches in companies like Netflix, Uber, Amazon, and eBay. In one sentence:

Microservices are small, strictly delimited and autonomous pieces of code that work together.

This small definition is simple to understand, but it hides its potential and benefits. So, in the following sections, we will be covering some of the main characteristics and advantages of working with microservices.

How small should a microservice be?

According to the previous definition, a single microservice should be “small,” but how small?. There is no strict way to measure this, but we can consider one of the SOLID principles: the Single-responsibility principle.

If we apply this principle to microservices instead of classes, it should be in charge of one single functionality in your system. Of course, as we know, this principle is not always worth it. If a functionality is too small, it can lead very fast into an unmaintainable system with too many modules (or, in this case, too many microservices).

In short, just like when we talk about classes responsibilities, there is no magic formula or “silver bullet” for determining the size of a microservice. It will depend on the complexity of your functionality, the team structure and size, the budget, the schedule, and many other factors.

Architecture

To explain microservices architecture, let’s start by describing a well-known and typical architecture in a simple way. In a monolithic architecture, all the implemented features live in one single physical environment. All the business logic resides in one place. All the systems store and consume data generally from a single location. With this approach, there is a high level of coupling.

On the other hand, we have a microservices architecture, where each feature resides inside a strictly isolated service, with its related data only accessed by itself. With this approach, the level of coupling is almost inexistent.

Resilience

One of the crucial requirements for a microservices-driven implementation is the disposability of your services. You should guarantee that the entire application will not crash or stop working well if one service is down. These errors can be generated by network problems, internal services errors, and many others. To avoid these problems, you can apply practices like degrading functionalities, timeouts, circuit breakers, or architecture techniques.

Scalability

In microservices, scalability is relatively easier and more performant than in a monolithic system. In a monolithic service, if one of your functionalities has many requests compared to the others, you need to scale your complete service because of its coupled nature. With microservices, if we need more capabilities for one feature, we only need to replicate that microservice and not the whole system.

Adding new features

When we want to add new features, microservices are one of the best approaches. Because of its autonomous nature, you can add new microservices to your system without putting the rest of your services at risk. Also, you can be sure that there will not be coupling problems due to the strict limits that each microservices has by nature.

An interesting advantage is that you can try new technologies in new services without impacting your ecosystem.

In terms of technology heterogeneity, microservices are helpful if you want to build a system with many functionalities related to very different needs for your business. This architecture will allow you to use the most convenient tool for each implementation without turning your system into a multi-language and unmaintainable monster.

Organizational advantages

When you are working with a microservices approach, after some time, your ecosystem may be large enough to consider creating new teams. At this stage, your ambitious teammates have a chance to keep growing inside your business with the ownership of one specific part of your business logic. Microservices facilitate the creation of new associated roles, positions, and organizational structures.

Summary

By using microservices, you can get a reliable and scalable application, which is great for startups. I hope that this article would help you understand a bit more about what microservices are and why many companies worldwide use them.

--

--

Sebastián Pérez Etchandy
Nowports Tech and Product

I'm a passionated programmer who loves to learn about almost everything. I like mainly football, video games, music and spending time with my friends.