Microservices are a way to independently and quickly develop an application by a larger team of people than without them.
How does this happen? Some area of the application is allocated, a separate command is allocated for it, this command either selects the code from the original monolith (if there was already functionality there), or writes it again. For independence, the team often has complete freedom: technologies, policies, releases.
Microservices are often a legitimate way to rewrite the system. The system is not just refactored into a microservice, but at the same time the code is actually rewritten. Again, this often makes sense: the accumulated experience allows for better implementation (easier to maintain, more stable, faster, etc.) - the so-called improvement of non-functional characteristics.
Microservices bring additional problems: primarily due to the distributed nature of the system:
- network delays
- the complexity of debugging
- transaction complexity
- …
A more serious problem is when teams change (split / merge / shrink / create) - then immediately a technical debt is formed from potentially technically ideal microservices - there is no dedicated team that deals with it (or there is no team “temporarily” or several teams of it). It may turn out that the team will have to work with several languages instead of one previously, etc. In fact, refactoring needs to be done, but for obvious reasons of cost and reduced release intensity, they try to postpone and avoid it altogether.
The principle of “modules” should be considered separately. There was (and maybe still is) the idea that microservices are needed only in case of heavy loads, and if there are just a lot of developers, then you can stay within the monolith, but assemble it from separate modules. It’s pretty easy to find such apps now – these are big mobile apps – they just don’t have any other choice. In theory, it should be the same as microservices, but in practice, a single release imposes additional costs - I’m sure that if there was an opportunity to go to microservices, they would go. It is the same on the server: after all, microservices are easier to perform than a modular monolith and in most cases, because of this, they are preferable.