Hi guys is there a way to control the number of instances on each broker?
What do you mean?
Well each broker is a service or microservice which run as fork or cluster right?, or each broker runs in the same instance?. May be I need to understand this part first.
The Broker is running your services. It can run one or more services. And you can execute multiple brokers too. So it's your choice that how many broker instances are running.
Yes, I understand it, but does each service run in a separate node js instance?. What happens if I want to use a service which is heavy and I want it to use more cores?, like PM2 does or node js cluster mode. Or the lib simply run each service in same thread?
HI @cesar2064 how are you?
You can have multiple services working in one node js instance, it's just business logic.
If you want to have multiple node js instances you have many options:
--instances (http://moleculer.services/0.12/docs/runner.html)Remember that for all of this cases you have to define a transport in order to allow to work the service discovery of moleculer and really important to have each node js instance their own unique id.
This is something really cool to understand the different possible architectures for your nodes and services: http://moleculer.services/0.12/docs/nodes.html
this is so cool, thanks @tinchoz49 and @icebob
Most helpful comment
HI @cesar2064 how are you?
You can have multiple services working in one node js instance, it's just business logic.
If you want to have multiple node js instances you have many options:
--instances(http://moleculer.services/0.12/docs/runner.html)Remember that for all of this cases you have to define a transport in order to allow to work the service discovery of moleculer and
really importantto have each node js instance their own unique id.This is something really cool to understand the different possible architectures for your nodes and services: http://moleculer.services/0.12/docs/nodes.html