Is there a way to make sure that Orleans Grains end up in the same Silo

796 Views Asked by At

In our Orleans setup we have some Grains that frequently call each other. Is the performance of these Grain calls affected by them being in different Silos?

Is it possible to somehow tell Orleans to try activate a Grain in the same Silo as the calling Grain?

1

There are 1 best solutions below

0
On

Yes, network call is a network call and it will affect the performance of your calls.

You can put [PreferLocalPlacement] attribute on top of your grains, but AFAIK this can't be enforced, this is only a guidance for Orleans silo where to put new activation of the grain. This should work for both - state-full and stateless grains.

For purely stateless grains - you can use [StatelessWorker] attribute as Tseng suggested in his comment. I suggest you read the docs for stateless worker gains, they describe how they're different from regular grains. There are a few important aspects, besides local activation.