I'm happy to share with you the first chapter of my new book, Microservices for everyone. I'm still in the process of writing it and intend to release parts of it during the next weeks. If you're interested, sign up on the book's landing page and receive a 25% discount
when the first chapter gets released.
If you're curious about the table of contents so far: you'll find it in the PDF version of the introduction.
Introduction
Scepticism
I can almost hear you think: "Bah, microservices. Nothing good could come from that!"...
We replaced our monolith with micro services so that every outage could be more like a murder mystery.
— Honest Status Page @honest_update
I am absolutely certain that this a solvable problem, but nonetheless, it may scare you away from considering a microservice architecture as a viable choice for your company. Especially since you already receive reminders of what a bad choice that may be on a daily basis (at least if you're on Twitter):
If one piece of your web of microservices suffers an outage and your whole system crashes and burns, then you have a distributed monolith.
— Matt Jordan
Which makes me wonder: how does this differ from when we have a single application? If something goes wrong in a monolith we usually throw an exception, and let it crash the application, right? Is it even possible to make our system as resilient as gets depicted here? When the disaster is too big, there may be nothing we can do to recover
from it. Still, I'm certain that with a few simple implementation patterns we can make our microservice system much more resilient than any monolith we have encountered so far.
If your microservices must be deployed as a complete set in a specific order, please put them back in a monolith and save yourself some pain.
— Matt Stine
This sounds like good advice though. One of the main design goals of microservices is that services can be created and removed on-the-fly and other services shouldn't produce any failures because of that. If this is not the case, indeed we should get back to our monolith. But not too fast! There are some good solutions available.
Microservices without asynchronous communication are as good as writing monolith app.
— Ajey Gore
Asynchronous, event-driven communication is one way to approach the dependency problem. But it is not the one and only solution. In fact, as we will see later on, synchronous communication is still a viable solution. It needs a bit of extra work though. And as soon as you find out how to solve things in an asynchronous fashion, you'll be
looking for other places where you can switch from synchronous to asynchronous communication.
I'm sure there are plenty of teams that have decided to make their next project a microservices project, which took a lot of research and a lot of work and the project may have ended up in quite a bad shape after all. There are many reasons for this. Probably most of those reasons are the same as for any other kind of software project: the
regular problems related to estimations, deadlines, budgets, etc. Or, as often happens, developers were eager to try something new, to escape from the suffocating work on the "legacy system", seeking their salvation in a microservices architecture. Or, they were able to run their services on their own machine, but had trouble getting the
whole system up and running, monitored and all, in an actual production environment.
Optimism
While still surrounded by microservice negativism the tech community has in fact been floating on a wave of microservices hype. Trusting on my built-in "tech radar" and "mood calculator" though, it feels like we're almost past this hype. If I look around me, we're more in the assess phase: "This could be something
for us, let's find out." And I agree, it's time to prove that this can work. It's my current belief that we need the following ingredients for that:
- We need to put a lot of focus on our domain and create (but also continuously refine) a suitable model for it. In order to do so, we need to
Truncated by Planet PHP, read more at the original (another 15808 bytes)