Skip to content

What are Microservices?

  • Use Case

Microservices originate from the field of software architecture and describe a structure in which the software consists of many individual services that can communicate via interfaces.

How do Microservices work?

In a microservice architecture, a program is split into many individual services, which take on predefined subtasks and can communicate with each other. These services are self-contained and have the following characteristics:

  • The services have few or even no dependencies on each other.
  • The services can be deployed individually and independently of each other. This means that the technical infrastructure can also be adapted to the load profile of the service.
  • In many cases, the responsibility lies with a clearly defined team.
  • The microservice can be built to solve specific business problems.

This structure in microservices enables the implementation of complex programs by splitting them into smaller, manageable services. Furthermore, programs can also be easily extended retrospectively by adding new services or dropping existing services because they are no longer needed.

Monolithic and Microservice Architecture

There are basically two different approaches to the development of extensive software. In the so-called monolithic architecture, the complete functionality is packed into a single service. The individual elements are closely interwoven and sometimes even indistinguishable in the code. In Python programming, for example, a class with many functions could represent a monolith.

The microservice architecture, on the other hand, uses many individual services that represent self-contained functionalities. To make it coherent software, the functions communicate via API interfaces and thus exchange their intermediate results.

A practical example of the distinction between microservices and monoliths can be found in the automotive sector. A large, structured car manufacturer divides the construction of the car into many different departments. There are special teams that paint bodies and others that build the engine. The intermediate stages of the build go through the assembly line to the appropriate departments. In software development, the departments would be many different microservices.

A private mechanic, on the other hand, who wants to repair or restore his own car, acts like a monolith. If something needs to be done to the engine, he can examine it and replace the broken parts. In the same way, he will also paint parts that have scratches.

What are the Characteristics of Microservices?

When taking a closer look at software, there are two basic characteristics by which a microservice architecture can be recognized.

  1. The services are self-sufficient: The individual components are completely independent of each other, i.e. they can be scaled or deployed without any problems and without affecting the overall software. The first indication of self-sufficiency is the use of APIs for communication between services.
  2. The services are specialized: All components have a specific problem that they solve. If the problem is too complex, other services can be called within the function to assist.

What are the Advantages and Disadvantages of Microservices over Monoliths?

In recent years, microservice architectures have gained acceptance over monolithic ones primarily because of the following advantages:

  • Independence: Development teams can work independently of each other and only need to exchange information about the format of the API interface. All other decisions can be made in a way that is optimal for the service. This includes, for example, the programming language, so that it can happen that the final software consists of services that were programmed in different languages. At the same time, parts of the software can also be developed by outside teams.
  • Agility: The creation of services can take place very fast since the individual problems are not so complex and thus the teams can work fast and uncomplicated. This also means that there is relatively little coordination between the teams, as the services are independent of each other.
  • Scaling: By splitting into services, computationally intensive functions can be scaled in a targeted manner. In a monolithic architecture, on the other hand, the entire software would have to be scaled up, which in turn would be significantly more cost-intensive. For example, it is possible to equip individual services that use neural networks with GPUs.
  • Compatibility: Due to the simple communication via interfaces, the dependencies between the interfaces are only relatively low. This means that services can also be used for completely new projects.
  • Resilience: As soon as a single service fails, the other services are still responsive and the entire software is still accessible. With a monolith, on the other hand, the failure or an error in a single function leads to the failure of the entire system. Thus, significantly higher costs for maintenance and testing are necessary.

Despite this mass of advantages that microservices offer, there are also challenges that need to be considered when introducing such an architecture.

The advantage of monoliths is that central logging can take place, i.e. the state of the system is returned via a central point. In a microservice architecture, such logging must first be established, otherwise one only receives information about the individual services. This also complicates the monitoring of the software, which is not possible centrally.

Testing the system becomes more complex due to the distributed architecture because a large number of services are interconnected. At the same time, latency can occur in the communication between services, which slows down the entire system. If software response time is a critical issue, a microservice architecture may already fall out.

Existing systems are difficult to migrate to such an architecture. For this reason, an attempt should be made to introduce the architecture in new developments if possible, since it can significantly increase the effort required for existing software.

How do Microservices relate to Docker?

Since the microservices are independent of each other, they can also run in their own environments as long as these environments can communicate with each other via interfaces. The Docker virtualization platform is often used for this purpose. It makes it possible to start several so-called containers on one machine, which run in isolation from each other.

All information and resources required by the individual service are contained in this container. In addition, the containers can also be scaled individually, i.e. made more powerful, if the service requires it.

This is what you should take with you

  • Microservice architecture describes a software concept in which a system is divided into many individual services that solve subproblems.
  • The opposite of this is the monolith, in which the software consists of one large construct that combines all functions.
  • The advantages of microservices are the independence of the individual services, increased compatibility, and easy scalability.

Other Articles on the Topic of Microservices

Cookie Consent with Real Cookie Banner