dotnet/orleans

Disabling the population of the state when activating a grain during the invocation of a specific method

mhadhbi opened this issue · 1 comments

Hello,

We started to use Orleans in production several months ago and we are happy with that.

We noticed that the first activation of a grain is relatively slow. Logs show that the Orleans Runtime is spending dozens of milliseconds populating the state from Azure Blob Storage: in our case, this operation will never succeed as the state is not stored yet.
The user has to invoke a specific method in the Grain before calling other methods. This method is responsible for initializing the grain and storing information coming as arguments in the state.
Is it possible to make the population of the state configurable based on the method invoked in a grain ?

public class ComputeGrain : Grain, IComputeGrain
{
    // Method responsible for initializing the grain and storing different information coming from arguments in the state
    public Task Initialize(Type1 arg1, Type2 arg2)
    {
        // No need to populate the state when activating the grain during the invocation of this method.
    }

    public Task DoSomething(int value)
    {
        // We have to populate the state when activating the grain during the invocation of this method.
    }
}

Best regards,
Ahmed

I'm not clear what the use case is.

What's the purpose of storing the state if you're not pulling it to see if it already exists when reactivating a grain?