Orleans: Listing/indexing all actors with persisted state

Created on 14 Sep 2017  路  7Comments  路  Source: dotnet/orleans

First of all, I completely understand that actors in Orleans are never in "destroyed" or "removed" states and that they always exist at all points in time. However, there will eventually come a day when you need a list of all actors of a specific type which exist in persistent data storage, be it for generating a report or calculating some aggregate statistics.

My question, then, is this: how does one find all actors which have a non-default state? I'm basically looking for the equivalent of an SQL SELECT * statement.

One thing that comes to mind is to have a special grain with a list of all actors of a specific type. This, however, looks dangerously like a single point of failure. It also looks to me like the whole state is serialized each time it is saved, which means adding new actors to the collection will be an O(n) operation, which is highly undesirable. You could probably split the index among many different grains by hashing the key, but it's still not optimal in any sense.

Most helpful comment

We have a prototype feature for Orleans that offers indexed actors. It does a lot more than what you need, and isn't production-ready. You can read about it here. I plan to publish the code in the next few days on http://github.com/OrleansContrib.

All 7 comments

Where are you storing the state of grains? SQL server? You can easily query over there.

I was under the impression that I should leave SQL connections (or, generally speaking, persistent storage access) to Orleans itself. It's certainly possible, but feels extremely hacky.

Specifically, if a ShardedStorageProvider is used, custom queries against the provider will be a one-way ticket to bugsville.

We have a prototype feature for Orleans that offers indexed actors. It does a lot more than what you need, and isn't production-ready. You can read about it here. I plan to publish the code in the next few days on http://github.com/OrleansContrib.

I actually read that paper before. It's great to know this is coming, it's a really important feature to have. Do you have any idea when we can expect it to be production-ready?

@Arshia001, we published the code today. It's available at https://github.com/OrleansContrib/Orleans.Indexing.

Great to know! I'll start digging into the source right away.

Was this page helpful?
0 / 5 - 0 ratings