The core concept of this disadvantage relies in the term subdomain
, which sometimes can be fuzzy to truly understand it, mainly because it's on that border between business and engineering. A similar term for it is bounded context, and this article gives a pretty good explanation of it.
For example, in an e-commerce application, we can have the following subdomains, which can be easily mapped to individual microservices:
- The Payment subdomain
- The Order subdomain
- The Authentication subdomain
- The Search subdomain
However, in a more complex application, where the majority of components are tightly coupled (monoliths), it's not always so clear where to draw the border between some subdomains. You need business knowledge and good documentation (or ideally, access to the original authors of the application), in order to properly get this right.
For that reason, you may end up creating too many subdomains, which may translate into too many microservices (one subdomain can have multiple microservices), and this has it's own disadvantages (we're talking here about tens of microservices or even more).
One of them would be routing a request to the proper microservice, or properly orchestrating the calls when you got a call which needs to translate to a number of downstream calls, for example (on the e-commerce app):
- The user is logged in and wants to search for a product (makes a request to your API gateway)
- The request is routed first to
authentication
microservice to check the token received on the request
- Then, the request is routed to the
search
microservice to retrieve the actual data
- A final request is launched to the
profile
microservice to get the existing shopping cart items, to be displayed in the top right corner of the page.
Of course that things can be cached to avoid extra calls, but that's just a possible sequence so you can make an idea.