Pros and cons of microservices

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the architecture category.

Last Updated: 2024-04-25

Pros

Ability to test-drive risky new technologies

In a monolith, bringing in a new technology (e.g. a database) risks impacting everyone. Not so with microservices.

i.e. the benefit of technological heterogeneity.

Resilience

One server going down doesn't mean the others have to. (Counterpoint from monoliths: you can have them running on multiple machines)

Ease of deployment

A one-line change to a million line monolith requires a deploy of the whole shebang and because this is understandably risky, deploys happen less often. (counterpoint: but now you need to do 10x more deploys and have that dev-ops monitoring infrastrucutre in place)

Cons

Network failures and distributed system hardships

Whole nasty class of problems not experienced much in monoliths.

Technological heterogeneity

If you have ten different languages, how will people move across teams? How will you hire? How will you have enough experience to run these things at any scale?

Moreover, you will never build up tooling around some particular tech.

Service Oriented Architectures (SOA) Tips

Gotchas with DB integration

DRY in the context of microservices

Client libraries

Access by reference

Orchestration issues

Image that creating a customer also entails many other actions like:

How do we orchestrate all this?

One option is that the original custom service system does it all through a series of request/response calls. If synchronous, we could even know if each stage worked (but only is synchronous and FAST)

The downsides to doing this synchornously are:

The alternative is pub/sub. Its downsides are:

tip with pub-sub: use correlation IDs to trace requests across process boundaries

Event based integration

Versioning etc.

Issues with REST

Build or buy?

Strangler pattern

Counterpoint: You might already be doing microservices

At Oxbridge Notes, the fact that my Heroku deploy talks to an SQL database via a network endpoint could be said to be a "microservice". As could my use of PayPal, S3, and other vendor integrations.

Resources