Orleans: Distributed collections in Orleans

Created on 8 Feb 2016  路  5Comments  路  Source: dotnet/orleans

I am exploring how to implement distributed collections for objects in Orleans. I imagine this functionality could be useful for a few scenarios, e.g.

  • Scale existing systems with lots of code that cannot be completely reimplemented in grains.
  • Hold and query large collections on the server side which reduces load on a client.
  • Querying collections of grains, maybe in combination with index building [2].

So far I have identified the following main goals important for my Orleans-based project:

  • Introduce some parallelism for list operations by using a large number of ContainerGrains hosting items.
  • Exact storage location of items should not be dealt with by the user (not completely implemented).
  • Allow efficient communication between objects hosted within a distributed collection (not implemented).
  • Support LINQ-like queries on such a collection (way to go).

I implemented a prototype with some very limited functionality of distributed collections and would be happy to discuss its approaches [1].

I would like to hear what your requirements for a distributed collection are. Is it interesting to you to deal with not only collections of grains but collections of plain old objects as well? Do you care about consistency a lot?

Deprecated [1] https://github.com/bwanner/Orleans.Collections
[2] Related issue: https://github.com/dotnet/orleans/issues/602

Update: See https://github.com/dotnet/orleans/issues/1412#issuecomment-193702118 for latest update on concept and implementation status.

enhancement hacktoberfest help wanted

Most helpful comment

Have you considered the use of IAsyncEnumerable?

I'm new to Orleans and am trying to work out how to deal with collections of grains e.g. A UserGrain may contain many BlogPostGrain's and this requires filtering, sorting, paging, searching. What is the recommended approach?

All 5 comments

Benjamin terrific! Would love to see it in action. When you feel comfortable you can make a PR here. Thanks

Related work Orleans.Consensus. Cross-referencing https://github.com/dotnet/orleans/issues/447 and https://github.com/dotnet/orleans/issues/446 for some ideas on silo locality (of these, don't pay attention to all that is written in #446 and the issue from which it stems from).

@bwanner , I think it is definitely an interesting idea. We generally like designs that built on top of Orleans (stack design). Our internal stream pub-sub is built this way, Orleans.Consensus, Orleans.Activities and more.

I would start with supporting some simple collections, like DistbutedDictionary, where you can lookup the key not by scanning all partitioning but by directly routing to the right one. The routing can be either done via static mapping (hash based or range based), or via intermediate routing grain.
Same with List.

https://github.com/OrleansContrib would be a good place to host it initially. As others will start using it, you will get more concrete feedback and will be able to evolve the model.

I would say that the key thing is to have at least one concrete usage scenario, and build the system targeting at least one production usage (while of course still not losing the sight of generality).

Added a prototypical implementation of containers to OrleansContrib/Orleans.Containers.
Moved away from the collection term a bit and introduced the notion of containers:
A container serves as storage for an object and has the responsibility of executing functions on that object. If one adds an object to a container it becomes the object's owned and returns a ContainerHostedElement<T>. This reference can be used to access that object within the container.

This concept different to regular C# collections where collections are just storing a reference to an object and the object is located on the globally accessible heap. Also C# collections are supposed to implement IEnumerable which is not a concept necessarily aligned with Orleans principles.

The project is not documented well, but the examples should give a feeling for what it is trying to achieve. Feedback is highly appreciated :)

Have you considered the use of IAsyncEnumerable?

I'm new to Orleans and am trying to work out how to deal with collections of grains e.g. A UserGrain may contain many BlogPostGrain's and this requires filtering, sorting, paging, searching. What is the recommended approach?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jt4000 picture jt4000  路  3Comments

danvanderboom picture danvanderboom  路  3Comments

zhoujijian picture zhoujijian  路  5Comments

bobanco picture bobanco  路  3Comments

luciobemquerer picture luciobemquerer  路  4Comments