Edytuj

Udostępnij za pośrednictwem


ActivationCountBasedPlacement Class

Definition

A placement strategy which attempts to achieve approximately even load based upon the number of recently-active grains on each server.

[System.Serializable]
public class ActivationCountBasedPlacement : Orleans.Runtime.PlacementStrategy
[System.Serializable]
[Orleans.GenerateSerializer]
[Orleans.Immutable]
[Orleans.SuppressReferenceTracking]
public sealed class ActivationCountBasedPlacement : Orleans.Runtime.PlacementStrategy
[<System.Serializable>]
type ActivationCountBasedPlacement = class
    inherit PlacementStrategy
[<System.Serializable>]
[<Orleans.GenerateSerializer>]
[<Orleans.Immutable>]
[<Orleans.SuppressReferenceTracking>]
type ActivationCountBasedPlacement = class
    inherit PlacementStrategy
Public Class ActivationCountBasedPlacement
Inherits PlacementStrategy
Public NotInheritable Class ActivationCountBasedPlacement
Inherits PlacementStrategy
Inheritance
ActivationCountBasedPlacement
Attributes

Remarks

The intention of this placement strategy is to place new grain activations on the least heavily loaded server based on the number of recently busy grains. It includes a mechanism in which all servers periodically publish their total activation count to all other servers. The placement director then selects a server 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 server. The director selects a number of servers at random when making this prediction, in an attempt to avoid multiple separate servers overloading the same server. By default, two servers are selected at random, but this value is configurable via Orleans.Runtime.ActivationCountBasedPlacementOptions.
This algorithm is based on the thesis The Power of Two Choices in Randomized Load Balancing by Michael David Mitzenmacher https://www.eecs.harvard.edu/~michaelm/postscripts/mythesis.pdf, and is also used in NGINX for distributed load balancing, as described in the article NGINX and the "Power of Two Choices" Load-Balancing Algorithm https://www.nginx.com/blog/nginx-power-of-two-choices-load-balancing-algorithm/.
This placement strategy is configured by adding the ActivationCountBasedPlacementAttribute attribute to a grain.

Constructors

ActivationCountBasedPlacement()

Properties

IsUsingGrainDirectory

Gets a value indicating whether or not this placement strategy requires activations to be registered in the grain directory.

(Inherited from PlacementStrategy)

Methods

Initialize(GrainProperties)

Initializes an instance of this type using the provided grain properties.

(Inherited from PlacementStrategy)
PopulateGrainProperties(IServiceProvider, Type, GrainType, Dictionary<String,String>)

Populates grain properties to specify the preferred placement strategy.

(Inherited from PlacementStrategy)

Applies to