1
 
 
Account
In your account you can view the status of your application, save incomplete applications and view current news and events
July 29, 2014

Scaling with Micro­services and Vertical Decomposition

What is the article about?

The architecture of otto.de is based on the concept of vertical decomposition: the whole system is vertically split into several loosely coupled applications.

Every "vertical" is responsible for a single business domain such as "Order", "Search & Navigation", "Product", etc. It has its own presentation layer, persistence layer and a separate database. From the development perspective, every vertical is implemented by exactly one team and no code is shared between the different systems.

We have already described the details of this architecture in an article in OBJEKTspektrum (German), a different blog post German) and at conferences like QCon (English).

Vertical Decomposition
Vertical Decomposition

For some time, a different approach to decompose large systems is becoming more and more popular: microservices. What are the similarities and differences of both kinds of architectures and how is it possible to get the best of both? This is what I want to discuss in this textLet us start with microservices: In short, "the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API (Martin Fowler).

Sometimes, people refer to the code size: for example, a microservice should not have more than 100 lines of code. Personally, I do not find such definitions helpful, for several reasons. I prefer definitions from the feature perspective: A microservice should be responsible for a single use case. In other words, the "Single Responsibility Principle" known from object oriented development should be adopted to applications.

Let us have a look at an example from our online shop. There are different areas in the shop where we are promoting products: similar products, products other people were interested in, and so on. In a monolithic application, we would need a database of product data, having all the attributes needed for any kind of recommendation (in addition to all the information needed by other components of the shop). In the case of otto.de, this is a noticeable amount of data and a rather complex data model.

The problem is that it is hardly possible to find a data structure that fits well for every use case. Using a microservice architecture, finding the "perfect" solution for every kind of problem is much easier. For example, we could have a microservice only responsible for serving a single recommendation type. One service would have to serve "similar articles", another one "best rated products", and so on. The data needed to identify "similar articles" is very different from the data used to select "best rated products", so both services would have different data structures, fitting exactly their needs.

Not only the data structures would differ: the services could also use different implementations, for example, one using in-memory calculations while others would make use of a relational database. A microservice architecture has a whole slew of advantages when compared to monolithic architectures:

  • Microservices are small enough to be developed by only a few developers in a short time.
  • A single developer is able to understand all aspects of a service.
  • It is possible to choose the "best" programming language for different kind of problems.
  • The code of the service remains compact, without having too much boilerplate code, no need to use heavyweight frameworks or abstraction layers.
  • Together with REST there is an architecture to realize a loosely coupled system of services. There are other options like thrift or protocol buffers, having similar characteristics.
  • Microservices can be developed and deployed independent from each other. This is an important premise for continuous delivery.
  • The development stays highly efficient, while developing monolithic architectures tends to slow down over time.
  • Because microservices are small, it is easy to replace them by newer, better implementations.
  • The development of small services scales better: it is easier to establish independent teams in a microservice architectures than in monolithic ones.
  • The scalability of a distributed system is much better than a monolithic one because the different services can be scaled independently.

On the downside of microservices: like every distributed system, the operation of such an architecture is much more complex than the operation of monolithic systems. We need more hardware resources, it is a must to automate everything, monitoring and alarming is more complex and so on.

Another problem is the comprehensibility of a pure microservice architecture for complex systems. Because the system is loosely coupled, consisting of independent applications, it is not easy for developers to "see" the overall structure of the system.

Microservices
Microservices

This is where vertical decomposition comes into the game. The two concepts fit perfectly together, because vertical decomposition introduces another dimension to scale the system, and they help to give microservices a structure.

Microservices, on the other hand, help us to cut down verticals into smaller pieces, so they do not turn into large monolithic applications.

From the outside, a vertical is a black box. There are some REST interfaces, but the internal structure (or micro architecture) is up to the development team responsible for the vertical. Whether or not a team is choosing microservices to realize a vertical is irrelevant from the perspective of other teams or systems, because it is only the URLs of the different REST resources that may differ.

 Vertical Decomposition with Microservices
Vertical Decomposition with Microservices

Below the line, combining vertical decomposition with microservices is a great way to build large systems. Like namespaces in object oriented applications are structuring code, verticals are grouping microservices, so it is easier to understand the overall architecture. Microservices are a way to implement verticals, preventing the teams from turning an initially small vertical into a 100.000 lines of code monster application.

16Comments

Write a comment
Answer to: Reply directly to the topic

Written by

Guido Steinacker

Similar Articles

We want to improve out content with your feedback.

How interesting is this blogpost?

We have received your feedback.

Allow cookies?

OTTO and three partners need your consent (click on "OK") for individual data uses in order to store and/or retrieve information on your device (IP address, user ID, browser information).
Data is used for personalized ads and content, ad and content measurement, and to gain insights about target groups and product development. More information on consent can be found here at any time. You can refuse your consent at any time by clicking on the link "refuse cookies".

Data uses

OTTO works with partners who also process data retrieved from your end device (tracking data) for their own purposes (e.g. profiling) / for the purposes of third parties. Against this background, not only the collection of tracking data, but also its further processing by these providers requires consent. The tracking data will only be collected when you click on the "OK" button in the banner on otto.de. The partners are the following companies:
Google Ireland Limited, Meta Platforms Ireland Limited, LinkedIn Ireland Unlimited Company
For more information on the data processing by these partners, please see the privacy policy at otto.de/jobs. The information can also be accessed via a link in the banner.