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

Autoscaling actor groups in runtime #202

Merged
merged 34 commits into from
Jul 21, 2020

Conversation

Relrin
Copy link
Member

@Relrin Relrin commented Apr 21, 2020

As the part of this PR, I would to introduce the changes that cover needs in autoscaling actor groups in runtime. The initiative was described in the #155 issue.

The idea

Before starting with the example, any developers needs to enable the scaling feature flag which using for getting an access to desired API, collecting statistical information from actors, etc.

Then, we can import the resizer, and declare the rules around how much actors acceptable (minimal, maximum) for the each actor group. It will be look something like this:

children
    .with_redundancy(3)                                // Start with 3 actors
    .with_resizer(
        Resizer::default()
            .with_lower_bound(0)                       // A minimal acceptable size of group
            .with_upper_bound(UpperBound::Limit(10))   // Max 10 actors in runtime
            .with_upscale_strategy(UpscaleStrategy::MailboxSizeThreshold(3)) // Scale up when a half of actors have more then 3 messages
            .with_upscale_rate(0.1)                    // Increase the size of group on 10%, if necessary to scale up
            .with_downscale_rate(0.2)                  // Decrease the size of group on 20%, if too many free actors
    )

The resizers will take care about reacting on collected stats (currently: active actors and the average mailbox size) and will ask a Child instance to scale up or down the actor group when it necessary in runtime.

Checklist
  • added example
  • tests are passing with cargo test.
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message is clear

@Relrin Relrin force-pushed the feature-autoresize-actor-groups branch from 04defc6 to 3c15e3b Compare May 15, 2020 15:50
@Relrin Relrin force-pushed the feature-autoresize-actor-groups branch from aa37de3 to 4ff0734 Compare June 8, 2020 21:53
@Relrin Relrin requested a review from o0Ignition0o July 17, 2020 19:17
@Relrin Relrin force-pushed the feature-autoresize-actor-groups branch from bba2972 to de74b0c Compare July 17, 2020 19:24
@Relrin Relrin force-pushed the feature-autoresize-actor-groups branch from de74b0c to cab503a Compare July 17, 2020 20:47
Copy link
Member

@vertexclique vertexclique left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is state of the art. Just ornamental things. The rest is looking amazing. Awesome work. Thanks.

src/bastion/examples/scaling_groups.rs Outdated Show resolved Hide resolved
src/bastion/src/children.rs Outdated Show resolved Hide resolved
src/bastion/src/children.rs Show resolved Hide resolved
src/bastion/src/context.rs Outdated Show resolved Hide resolved
@o0Ignition0o o0Ignition0o merged commit 19bca72 into master Jul 21, 2020
@o0Ignition0o o0Ignition0o deleted the feature-autoresize-actor-groups branch July 21, 2020 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants