This pull request implements actor replication in the NOLA system. The main goal is to ensure actors' availability and load balancing by replicating them across multiple servers. The code diff includes the following changes:
Refactored the EnsureActivation method in the kvRegistry struct to improve readability and maintainability.
Refactored the helper function pickServersForActivation to select multiple servers, instead of a single one, for actor activation based on various criteria such as memory usage, activation count, blacklisting, and caching.
Updated the comments to explain the replication logic and code behavior clearer.
Added the pickServersForActivation function to randomly choose the servers for actor activation.
Added the ExtraReplicas field to the EnsureActivationRequest struct. This field specifies the desired number of additional replicas to be created during actor activation in addition to the primary replica.
Moved the ExtraReplicas field from the ActorOptions struct to the EnsureActivationRequest struct. This change aligns the field with its usage in the EnsureActivation method and ensures consistency in the codebase.
Additionally, the code changes include improvements to handle server blacklisting in the ensureActivation method. The logic ensures that if the current request specifies blacklisted servers and any of those servers are not marked as blacklisted in the cache, the cache is refreshed to prevent routing back to blacklisted server IDs. The code also filters the cached references to exclude blacklisted servers for subsequent processing.
Pull Request Description:
This pull request implements actor replication in the NOLA system. The main goal is to ensure actors' availability and load balancing by replicating them across multiple servers. The code diff includes the following changes:
EnsureActivation
method in thekvRegistry
struct to improve readability and maintainability.pickServersForActivation
to select multiple servers, instead of a single one, for actor activation based on various criteria such as memory usage, activation count, blacklisting, and caching.pickServersForActivation
function to randomly choose the servers for actor activation.ExtraReplicas
field to theEnsureActivationRequest
struct. This field specifies the desired number of additional replicas to be created during actor activation in addition to the primary replica.ExtraReplicas
field from theActorOptions
struct to theEnsureActivationRequest
struct. This change aligns the field with its usage in theEnsureActivation
method and ensures consistency in the codebase.Additionally, the code changes include improvements to handle server blacklisting in the
ensureActivation
method. The logic ensures that if the current request specifies blacklisted servers and any of those servers are not marked as blacklisted in the cache, the cache is refreshed to prevent routing back to blacklisted server IDs. The code also filters the cached references to exclude blacklisted servers for subsequent processing.Most interesting files to review:
virtual/registry/kvregistry.go
virtual/activation_cache.go
virtual/environment.go