Giter Site home page Giter Site logo

Comments (3)

rogeralsing avatar rogeralsing commented on May 22, 2024

Ideas on how to do the actual passivation.

  1. The obvious approach is to have something similar to ReceiveTimeout, but didicated for killing idle actors.
    this would give a fairly exact time until the actor is passivated.

  2. Another approach could be to per actor, keep track of when it's mailbox last ran.
    And perform a sweep across the process registry, killing off idle actors.
    This would be less exact. but might be cheaper and easier to implement.

Other thoughts?

from protoactor-go.

hiyelbaz avatar hiyelbaz commented on May 22, 2024

What if there are messages coming into the grain mailbox exactly when the grain is about to passivate?

Maybe actor can be recreated where you handle grpc's own timeout exception. (if such a thing exists)

This thread can be useful at some point: grpc/grpc-go#928

Any idea how Orleans handles this?

from protoactor-go.

RussellLuo avatar RussellLuo commented on May 22, 2024

Per How Activation-GC Works, Orleans just:

periodically scan for activations that have not been used at all for some period of time

And the scan is done by ScanStale(), which is called in an asynchronous task CollectActivationsImpl(). And each grain activation provides a method GetIdleness (), which is based on the internal state becameIdle. Much like approach 2 mentioned above:

  1. Another approach could be to per actor, keep track of when it's mailbox last ran.
    And perform a sweep across the process registry, killing off idle actors.
    This would be less exact. but might be cheaper and easier to implement.

For problem 1 mentioned above:

  1. What if there are messages coming into the grain mailbox exactly when the grain is about to passivate?

Orleans handles it in this way:

You can also instruct the runtime to deactivate the grain next time it becomes idle, by using:

protected void DeactivateOnIdle()

An activation is considered idle if it is not processing any message at the moment. If you call DeactivateOnIdle while a grain is processing a message, it will get deactivated as soon as processing of the current message is finished. If there are any requests queued for the grain, they will be forwarded to the next activation.

But seems protoactor-go currently has no mechanism to forward (or persist) messages queued in mailbox. (maybe related to #139?)

from protoactor-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.