Moleculer: Load Balancing on call to action on the same service.

Created on 15 Dec 2020  路  2Comments  路  Source: moleculerjs/moleculer

Hi,
I did a little test to check if there is a load balancing when I have a service with action that calls to another action on the same service.

I created 2 instances of the same service and simulated 10,000 calls to that action(that calls to another action on the service).
In the logs I always saw that the nodeID is the same on the call to the main action and in the action that he called.

Although load balancing exists on the call to the main action , but the "internal calls" were always on the same instance.

Now, I want to be sure that is the default behavior ? if there is something can be done , some configuration or some way to perform the call to action on same service so the load balancing will be available?

Thanks.

Most helpful comment

The ServiceBroker first tries to call the local instances of service (if exists) to reduce network latencies. This logic can be turned off in broker options with preferLocal: false property under the registry key.

All 2 comments

The ServiceBroker first tries to call the local instances of service (if exists) to reduce network latencies. This logic can be turned off in broker options with preferLocal: false property under the registry key.

Thanks for the quick response馃榾
I will try it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dylanwulf picture dylanwulf  路  4Comments

demetriusnunes picture demetriusnunes  路  5Comments

darky picture darky  路  5Comments

abdavid picture abdavid  路  4Comments

ngraef picture ngraef  路  4Comments