Skip to content

What are Microservices?

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.

Docker Hub Interface | Quelle: Docker Documentation

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.

What technology stack can be used to build microservices?

The microservices technology stack refers to the various components used to build microservices-based applications. Some of the common technologies are listed below:

  • Programming languages: Microservices can be developed using various programming languages, including Java, Python, Ruby, JavaScript, and Go. Each language has its strengths and weaknesses, and developers should choose the language that best fits the needs of their project.
  • Frameworks: Frameworks are tools that provide a set of predefined functions to speed up development. There are several frameworks for microservices development, such as Spring Boot, Micronaut, Flask, Express.js, and Gin.
  • Containers: Containers are a lightweight alternative to virtual machines that allow microservices to be deployed in a portable and consistent manner. The most popular container technology is Docker, which provides an easy way to package and deploy services.
  • Orchestration tools: Orchestration tools help manage and deploy services in a distributed environment. The most popular orchestration tool is Kubernetes, which provides automated scaling, provisioning, and management.
  • API gateways: API gateways provide a central point for managing inbound and outbound microservices traffic. They can be used for authentication, load balancing, and request routing. Some popular API gateway tools include Kong, Apigee, and AWS API Gateway.
  • Databases: Microservices may require different types of databases depending on their specific requirements. Common database technologies used in microservices include MySQL, MongoDB, Cassandra, and Redis.
  • Logging and monitoring tools: Since microservices are deployed in a distributed environment, logging and monitoring are critical to ensure that they run smoothly. Some popular logging and monitoring tools include ELK Stack, Prometheus, and Grafana.

Overall, the technology stack can vary depending on the specific needs of the project. Developers should make the right choice of technologies that will enable them to build and maintain scalable, reliable, and efficient microservices-based applications.

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.
Das Bild zeigt eine Straße in Anlehnung an Named Entity Recognition.

What is Named Entity Recognition (NER)?

Explanation of Named Entity Recognition with examples and applications.

Das Bild zeigt Bert aus der Sesamstraße mit Popcorn in einem Kinosaal.

Sentiment Analysis with BERT and TensorFlow

Using BERT Embedding for text classification of IMDb movie ratings.

Gesichtserkennung in Anlehnung an Convolutional Neural Network

Convolutional Neural Network in TensorFlow with CIFAR10 images

Create a Convolutional Neural Network in Python with Tensorflow.

Das Bild zeigt eine Spinne, die sich über ihr Netz auf eine Website abseilt.

Web Scraping with Python – in 5 minutes to a working Web Scraper!

Web scraping using Python and the Beautiful Soup library as an example.

Cookie Consent with Real Cookie Banner