Moleculer supports several architectures.
In this version, all services are running on the same node. So there is no network latency and no transporter module. The local calls are the fastest.
This is the well-known microservices architecture when all services are running on individual nodes and communicates via transporter. In this case, the network latency is not negligible. But you can scale your services to avoid faults.
In this case, we are running coherent services in a group on the same node. It combines the advantages of monolith and microservices architectures.
For example, if the
posts service calls the
users service multiple times, we put them together, so that we can cut down the network latency between these services. If this node is overloaded, we will scale it up together.
The ServiceBroker first tries to call the local instances of service (if exists) to reduce network latencies. You can turn off this logic in broker options with
preferLocal: falseunder the