Specific tools for specific jobs

I wrote a piece on microservices and nanoservices and how that is not the way to move forward.

I thought it would be appropriate to also state when and how to use microservices though.

Toolbelt

Think of an actual toolbelt with which you do construction in the physical world. It should contain some basic tools that are essential in all jobs: – Hammer – Philips head screwdriver – Flat head screwdriver – Saw – Drill machine – Sander or sandpaper

That is basically all you need to do most general jobs. Let us take the hammer for example. You have your basic run of the mill claw hammer. It can hammer in nails and get them out again. Yet there exist a hammer for banging out dents (planishing), a brass hammer that does not create sparks so you can safely use near flammable materials and even a rubber mallet to lay in tiles in the street. If you would present the rubber mallet you would not hammer in the nail with it, but the planishing hammer you might use for it. However it is a specific tool created for a specific job and when you are using it to hammer in nails you might feel uncomfortable using it or feel it is out of place.

Microservices

Microservices are just such an example of a specialist tool that should be used in specific cases. Of course having the tool in your toolbelt is nice, but take care to not overuse it. It is unlike having either a pull saw or a push saw or one that is sawing on both pull and push and you can have a preference on either one of them, as long as they all saw the same material and have a similar size you can compare between them. A microservice is like having a hacksaw vs a circular saw. Yes they both saw but do it very differently and used in very different situations.

I get the sense everyone is treating microservices more as a general tool in the belt rather than a special tool. Work on knowing you general tools first and then move into learning specialist tools. This way you are better equipped with knowing why the tool exist and how it can be applied more effectively.

Imagine giving a jewelers' hammer to someone who never used a hammer and say it is to be used in all cases and it would be just as effective as using a claw hammer.

When to use them

The trick to effectively use microservices I think lies in the fact you should be able to use them in isolation, like small monoliths basically. Take a notification service for example. If it is part of the monolith it can work fine, but you cannot use it when the monolith itself is down. That means that when the big application is down all of the functionalities are down, even ones that generally do not need to be affected by this.

Let us move the notifications out of there and into it's own environment. It should stand to reason that notification code does not really get updated all that often as they generally tend to be the same over a long time, maybe some more platforms to use / support in the future. This also means that the notification service receives fewer updates and also is less prone to be broken due to changes in the core application.

Now the core application goes down, but our notification service stays up and it might even now send notification to us stating the core application is down.

Of course it can still not notify that it itself is down, but that you could monitor somewhere else which itself has the same problem and so on.

#devops