The Wayback Machine - https://web.archive.org/web/20201204050816/https://github.com/dotnet/orleans/issues/6376
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grain placement documentation is a bit lacking #6376

Open
alexrp opened this issue Mar 1, 2020 · 7 comments
Open

Grain placement documentation is a bit lacking #6376

alexrp opened this issue Mar 1, 2020 · 7 comments
Labels
Milestone

Comments

@alexrp
Copy link
Contributor

@alexrp alexrp commented Mar 1, 2020

There is a document on the subject, but it's lacking in a few ways:

I can send a PR to update the document, but I would need someone to clarify the points above.

It would also be good if someone could confirm that the custom strategy example in that document is still up to date since I know some work was done to simplify strategy registration.

@ReubenBond
Copy link
Contributor

@ReubenBond ReubenBond commented Mar 2, 2020

More detail in that document would be much appreciated. To answer your questions:

  1. The default placement strategy is Random
  2. The default placement strategy for all grains (i.e, which have not otherwise specified it) is configured by registering an implementation of PlacementStrategy in the DI container. (this could be nicer - options or an extension method would be better):
siloBuilder.ConfigureServices(services =>
  services.AddSingleton<PlacementStrategy, MyPlacementStrategy>());
  1. Here are the included strategies:

All strategies select a silo from the set of compatible silos. The set of compatible silos is the set of all silos which have an implementation for the grain and where that implementation's interface version is compatible with the caller's interface version. For more information, see the grain versioning documentation.

RandomPlacement

A silo is randomly selected from the set of compatible silos.

PreferLocalPlacement

If the local silo is compatible, select the local silo, otherwise select a random silo.

HashBasedPlacement

Hash the grain id to a non-negative integer and modulo it with the number of compatible silos. Select the corresponding silo from list of compatible silos ordered by silo address. Note that this is not guaranteed to remain stable as the cluster membership changes. Specifically, adding, removing, or restarting silos can alter the silo selected for a given grain id. Because grains placed using this strategy are registered in the grain directory, this change in placement decision as membership changes typically does not have a noticeable effect.

ActivationCountPlacement

The intention of this placement strategy is to place new grain activations on the least heavily loaded silo. The implementation of this director is not simple enough to explain briefly, however. It includes a mechanism in which all silos periodically publish their total activation count to all other silos. The placement director then selects a silo which is predicted to have the fewest activations by examining the most recently reported activation count and a making prediction of the current activation count based upon the recent activation count made by the placement director on the current silo.

The general advice is to not use this placement director without careful testing and analysis. (@sergeybykov, should we submit a PR to remove it?)

@OracPrime
Copy link
Contributor

@OracPrime OracPrime commented Mar 4, 2020

If you do remove ActivationCountPlacement, could I suggest it is moved to Samples rather than deleted, as it might be a useful reference for others writing custom strategies?

@sergeybykov
Copy link
Member

@sergeybykov sergeybykov commented Mar 6, 2020

In my opinion, ActivationCountPlacement is dangerous in its current form. It can be improved by making it operate based on smoothed out statistics, so that it wouldn't overreact to delayed stats.

@alexrp
Copy link
Contributor Author

@alexrp alexrp commented Mar 11, 2020

So let's avoid documenting ActivationCountPlacement for now?

Also, can anyone confirm whether the sample in the existing document is still up to date? Specifically with regard to the strategy and director registration.

@sergeybykov
Copy link
Member

@sergeybykov sergeybykov commented Mar 12, 2020

I think it's okay to document ActivationCountPlacement, so long as there's a caveat that it acts on lagging data and can overreact is a highly dynamic scenario.

The sample code looks correct for 2.x and 3.x.

@sergeybykov sergeybykov added this to the 3.0.0-docs milestone Mar 24, 2020
@yevhen
Copy link
Contributor

@yevhen yevhen commented Apr 9, 2020

We are heavily relying on ActivationCountPlacement. Please don't remove it. We understand all consequences and are using it at our own risk 😃

@sergeybykov
Copy link
Member

@sergeybykov sergeybykov commented Apr 9, 2020

We should publish a Liability Waiver form that one would have to sign before using ActivationCountPlacement. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.