Monolith149 Daily

Another place to see what KG is doing...

No Microservices?

An article titled “Microservices – Please, don’t” caught my eye, but I think the author has it wrong. It’s true we’ve been using the micro service approach at work, building REST/JSON servers to provice APIs, and I have been questioning whether this is the best approach.

This author says that these are “truths” “that people believe about this approach….”

  1. It keeps the code cleaner
  2. It’s easy to write things that only have one purpose
  3. They’re faster than monoliths
  4. It’s easy for engineers to not all work in the same codebase
  5. It’s the simplest way to handle autoscaling, plus Docker is in here somewhere

None of these have ever been my motivation for micro services. I never thought 1. was the case. Clean code is the result of good style and discipline, and readability in writing code.

Similarly, I’m not sure what 2. has to do with micro services. I can write modules, objects, or functions that have only one purpose.

I never thought 3. was true but actually the opposite. We’re replacing a local function call with a network transaction.

Similarly, 4. is also just not true. Whether micro services are in the picture or not, I take it as a given that code is properly divided into reasonable components with well-defined interfaces and that are loosely coupled.

I doubt that 5. is true, but it might be. Scale has never been a consideration in my thinking about micro services.

Here are some reasons that have been part of my thought process.

  1. The API is language independent. A program written in Java can send an HTTP request as easily as a Python program, or a program in any other language can.

  2. The API is easy to test with something as simple as curl.

  3. The API and HTTP request can cross network boundaries and into different security domains, if permission is set up.

  4. If a component needs to be recompiled, the micro services don’t need to be recompiled.

  5. The micro service can be updated independently of the using code and the clients all get the update immediately and with no changes.

There are downsides I have worried about, though. They include standing up and maintaining so many services along with a lot of extra network traffic. It’s also true that a well written library module is easier to use and test in many ways. The recompiling is not necessarily a large cost.

On a very recent project at work, we went back to using libraries for all of the application layers and components. It’s nice not to have to stand up those services, but I’ll find out if I miss some of those advantages of the micro services.

References

Microservices – Please, don’t