Advertisement
About a week ago I wrote a blog post on which I got a lot of feedback: “12 Rules for a Great (Micro)Service Architecture”. In it I presented twelve rules that are useful to us Native Web GmbH The concept, design and development of microservices have proven themselves in recent years. I also clearly said: “your mileage may vary”, in other words: the fact is that these rules apply We Being proven doesn’t mean they can be transferred 1:1 to you, your team, and your needs.
Also, I did not claim that microservices is the only true architectural approach. But in a blog post about the architecture of microservices, I naturally assume that the text will be read primarily by those who are involved in the concept, design and development of microservices – or at least those who will be interested in it in the future.
Attention Attention! Please stay away from microservices!
So I was surprised that almost half of the comments – whether they were on Heise Developer, on YouTube, by email or in personal conversations – questioned the use of microservices itself, meaning: yes, you can do anything, but first you should carefully question whether microservices themselves are a good idea. I was surprised because, on the one hand, I consider it self-evident that any architectural principle should be checked for suitability beforehand, and on the other hand, this question was not the topic of a blog post.
Recommended editorial content
With your consent, an external YouTube video (Google Ireland Ltd) will be loaded here.
Always load YouTube videos
Why Microservices Can Ruin Your Project?
Apparently there is a need to warn against the use of microservices because people have “already had bad experiences” with them. The fact that the same applies to other architectural approaches such as monolith, client-server or peer-to-peer is often overlooked. I find it interesting that I often experience this reaction when microservices are mentioned. I don’t want to deny that someone or the other hasn’t actually had a bad experience with microservices – I’m just surprised that it’s only pointed out so strenuously when it comes to microservices.
That’s why I thought it would be appropriate to ask the question when microservices are a good idea and when they are a bad idea. In other words: what aspects are worth considering before relying on microservices so that a project doesn’t actually fail?
And by the way, before anyone starts arguing about this Amazon will now operate without microservices: I already commented on this rumor a while ago. So if you want to make this argument, please watch the video first”Microservices are stupid – says Amazon?!” But.
Argument #1: Architectural Complexity
Let us now come to the first frequently mentioned argument against microservices, namely the fairly high complexity of the architecture. By definition, microservices is a distributed architecture, so a service-based application is a distributed system. American computer scientist Andrew S. Tannenbaum There is such a system is defined as follows,
“A distributed system is a collection of independent computers that present themselves to the user as a single system.”
In fact, there is also a humorous variation of this definition, namely:
“A distributed system is a system that doesn’t do what it should do because a computer you didn’t know existed or was important for something failed.”
But all jokes aside: it is obvious that distributed systems are technically more complex than non-distributed systems. This mainly relates to problems associated with communication between the different parties involved, i.e. issues like consistency, synchronization, availability, etc.
In this context the so-called CAP theoremwhich says (in simple terms): if a network failure occurs in a distributed system and results in a partition (which corresponds to “P”), you can choose whether you want either consistency (that’s “C”) or availability (that’s “A”, which stands for “availability”). Both are not possible simultaneously.
This means that with distributed systems you have to think a lot more about dealing with consistency and availability, which requires a lot of knowledge and experience. However, above all, you need one thing for a distributed system: a good reason why you want to design a system as a distributed system in the first place. You shouldn’t do it because it “sounds interesting” or “feels cool”.
Probably the primary reason for wanting to design a system as a distributed system is (and this is even in Andrew S. Tannenbaum’s definition) that you strive for a high degree of independence between the individual parts, especially in terms of technical, organizational and operational aspects from a technical point of view. Also, it is often said that you don’t want a technology to become system-relevant, that microservices will give you more flexibility and better adaptability, that you can scale a distributed system in a more targeted way, and so on – but independence is actually the driving force behind distributed systems. And if there is no need for this, a more centralized approach is probably more appropriate.
Therefore, you have to ask yourself the question: Do you need technical, organizational and, above all, professional independence?
Argument #2: Deployment and infrastructure
Let’s move on to the second argument often cited against microservices, namely deployment and infrastructure. It’s clear that microservices result in more complex deployments, not only because there’s more to deploy. Of course it is. XCOPY Deployment A simple monolith running on a single server with a single instance is easy enough.
However, deploying microservices actually always works in a similar way, no matter what application it is. This means that you can easily buy information “off the shelf”. You don’t need to experiment a lot or know a lot – you just need someone who has done it before and who is familiar with the relevant technologies. So, first and foremost: containers, Docker and Kubernetes.
Personally, I’m not really convinced by this argument, because yes, the complexity is higher, but not significantly higher – and in return I get a much lower level of complexity in the technicality of the individual services. This means that each individual service becomes easier to develop because it’s much smaller and more manageable. And since this is the point I can’t buy off the shelf, the savings here far outweigh the potential additional costs I’ll incur when deploying. Because yes, on the one hand a simple, standardized and always the same task becomes a bit more complex, but on the other hand you get a lot less complexity for things that are already difficult, demanding, time-consuming and individual. And that actually sounds like a pretty good tradeoff to me personally.
This counter-argument is of course based on the assumption that you are somewhat familiar with containerization, Docker, Kubernetes & Co. Anyone who still uses shell scripts on bare metal today will have difficulty deploying microservices efficiently. However, experience shows that this applies to all other types of deployments as well. If containerization and things like that are still new territory for you and your team, this is something you should change as soon as possible – at least if you work in the web and cloud area. To get you started, I can offer you our free Docker deep dive Recommend, which also has a few sequels and a different sequel Deep Dive on Kubernetes gives.