Danish version: http://qed.dk/jeppe-cramon/2014/03/13/micro-services-det-er-ikke-kun-stoerrelsen-der-er-vigtigt-det-er-ogsaa-hvordan-du-bruger-dem-del-2/
Part 1 – Microservices: It’s not (only) the size that matters, it’s (also) how you use them
Part 3 – Microservices: It’s not (only) the size that matters, it’s (also) how you use them
Part 4 – Microservices: It’s not (only) the size that matters, it’s (also) how you use them
Part 5 – Microservices: It’s not (only) the size that matters, it’s (also) how you use them
Part 6 – Service vs Components vs Microservices
Text updated the 23rd of June 2021
In Micro services: It’s not (only) the size that matters, it’s (also) how you use them – part 1, we discussed how the number of lines of code is a very poor measure for whether a service has the correct size and it’s totally useless for determining whether a service has the right responsibilities.
We also discussed how using 2 way (synchronous) communication between our services results in tight coupling and other annoyances, amongst other things communication related coupling, because data and logic often aren’t in the same service.
2 way (synchronous) communication between services also causes:
- Higher latency due to network communication
- Contractual-, data– and functional coupling
- Layered coupling, because persistence logic often isn’t in the same service that owns the business logic
- Temporal coupling, which means that our service can not operate if it is unable to communicate with the services it depends on
- Lower services autonomy and less reliability, because our service depends on other services to perform its job
- All of this also introduces the need for complex compensation logic due to the lack of reliable messaging and coordinating transactions.
Reusable service, 2 way (synchronous) communication and coupling
Worst case, If we combine (synchronous) 2 way communication with nano- / micro-services, modelled according to e.g. the rule 1 class = 1 service, we have basically returned to the 1990s where Corba and J2EE/EJB’s and distributed objects ruled.
Unfortunately, it seems that new generations of developers, who did not experience distributed objects and therefore haven’t yet realized how bad an idea it was to overuse this, is bound to repeat history.
This time we have just switched technologies like RMI or IIOP out with HTTP+JSON instead.
Jay Kreps summed up the common Micro Service approach, using two way communication, very aptly:
Jay Kreps – Microservice == distributed objects for hipsters (what could possibly go wrong?)