Microservices
Russell Bateman
last update:
Microservices are (really) small services (or service fragments) that make up
a single, purposeful application. Why are microservices so compelling? Summed
up in a single expression, it's technical debt. Or, the reduction of it.
- Microservices don't care what languages are used in their
implementation since the constituent components live and die by their
contracted interfaces: each component can do whatever it needs to do in
whatever way it wants as long as components interfacing with it can get
what the component has agreed to deliver the way it agreed to deliver it.
- Testing is simplifed because only the service is tested and not all
features of the entire application at once. (Integration testing is still
a requirement, but basic testing is much easier to conceive and much
cheaper.) Reduction in technical debt.
- Debugging is simplifed. If there's a null-pointer exception or other
bug, it's not "somewhere inside the whole monolithic mess somewhere." It's
probably—identifiably—in one service or between two services,
i.e.: service A send data incorrectly to service B or service B bungled
the data it got. Reduction in technical debt.
- Deployment is easier because when a change to a service is made,
only that service needs redeployment (unless a change in its contract
with other services was made). Reduction in technical debt.
Strangler pattern
This pattern is used to migrate a monolithic application to a suite of
microservices. A service or aspect of a service is chosen for migration,
written anew, greenfield or adapted from existing code, but separated out from
the monolith yet leaving the monolith version intact and functioning. Traffic
is gated through the new component to share the load with the original
implementation. Good processes, testing, deployment, etc. characterize the
new version. Eventually, traffic through the legacy component can be shut off
in favor of using only the new component. This process is repeated (or engaged
simultaneously) for other aspects of the monolith until there is no longer any
traffic transiting the old application.