More articles from this series
More articles from this series
Companies – of every size – are increasingly adopting microservice architectures. This means: A previously large and complex application is divided into several units. These microservices should communicate with each other exclusively via interfaces (APIs for short).
The supposed advantages are obvious.
Companies henceforth organise their teams into smaller units. These develop their solutions independently of each other. The benefit? They can test results more quickly and thereby identify errors earlier.
Equally important: Because teams are smaller, communication usually improves. As is well known, the number of potential misunderstandings increases with the number of people involved. I say: The pursuit of microservices is logical. At least in theory. Because there are problems precisely when it comes to communication.
In fact, in a development project, not only do people talk to each other, but IT systems also communicate with one another. We’re talking about: REST. Spelled out, this means: Representational State Transfer. The individual microservices exchange information with each other via the HTTP protocol. Questions are asked or answered.
REST, however, also means to be at rest. And that’s unfortunately fitting. In classic microservice architectures, users must do one thing above all: wait.
An example:
Service A wants to get an answer to a question from Service B. So far, uncomplicated. The problem?
B can’t answer it without first asking C. C in turn needs information from D and E for the answer. And A? Waits and waits and waits.
It gets worse:
Perhaps the team operating Service E has just released a new version that no longer matches C’s assumptions. E can’t answer the request as a result. The microservice architecture is thus doomed to failure before the project has even begun.
The obvious solution is well-known. Teams coordinate their activities and henceforth agree all changes amongst themselves. The problem: The units thereby build up exactly what they actually wanted to avoid with microservices: dependencies between teams and thus also between services.
What was supposed to make work easier now makes it more difficult. This costs time and money. Fortunately, there’s Apache Kafka, which can significantly reduce these dependencies even within a microservice architecture.
Kafka dispenses with the request-response game. Instead, different (micro-)services permanently publish their events. The services that are interested in the information listen in real-time to these updates and react correspondingly quickly.
Moreover: Kafka can capture these events in the different services and distribute them company-wide. One can imagine the software as an effective and efficient hub for data streams.
To explain it more tangibly: If you use a service that’s responsible for addresses, it publishes the changes at the moment these adjustments are made.
Even more practical:
If a greeting card service handles shipping, it can access a local copy of the relevant data thanks to Kafka. Querying the address service is no longer necessary. You can save yourselves delays due to downtimes or maintenance with the help of Kafka – or at least minimise them.
Another advantage: The chaos created by the mass connections of the communicating services is also reduced by the hub.
Of course, messaging systems existed before Kafka. But Apache Kafka brings two major architectural innovations:
Kafka’s performance and simultaneous reliability is hard to beat. Even with a small and relatively cost-effective Kafka cluster consisting of 3 standard (cloud) servers, we can achieve data throughputs of several hundred MBs and millions of messages per second. The risk of data loss is extremely low, as Kafka replicates and distributes data across multiple servers.
Kafka doesn’t just send messages between different systems, but can also store this data. When introducing a new service, it doesn’t need to somehow "synchronise" the data. Instead, it can simply read all necessary data from Kafka. Afterwards, it’s at the same level as all other services.
And if someone does deploy erroneously on Friday at 4:00 PM, Kafka allows you to "time travel" and restore the original data – before the bug was introduced. Because Kafka only forgets when we want it to.
Data is available in real-time. The infrastructure for microservices is in place. The goal is clear: We now want the Data Mesh. But how do we reach our business departments with it? This post explains why data management is a cultural and product question.
Read moreThe "Data Mesh" is a real hype in the IT. Why companies benefit from a decentralised data architecture and how Apache Kafka helps establish this new structure is discussed in this article.
Read more