I’ve been wanting to take a deeper dive into Microsoft Orleans for awhile now. With the next release targeting .NET Standard 2.0, it felt like an great time to do it. This is the first blog post in a series that will go beyond a simple Hello World. The plan is to make this a practical Microsoft Orleans guide to follow along with.
Sponsor: Do you build complex software systems? See how NServiceBus makes it easier to design, build, and manage software systems that use message queues to achieve loose coupling. Get started for free.
Blog Post Series:
- Part 1 – Practical Orleans
- Part 2 – Grains and Silos
- Part 3 – Smart Cache Pattern
- Part 4 – Event Sourced Grain
- Part 5 – EventStore for Grain Persistence
Microsoft OrleansIf you aren’t familiar with Orleans, here’s a brief overview.
Orleans is a framework that provides a straightforward approach to building distributed high-scale computing applications, without the need to learn and apply complex concurrency or other scaling patterns.Or maybe you have heard Orleans is an Actor model framework. Well…
Implementation of Orleans is based on the Actor Model that’s been around since 1970s. However, unlike actors in more traditional actor systems such as Erlang or Akka, Orleans Grains are virtual actors. The biggest difference is that physical instantiations of grains are completely abstracted away and are automatically managed by the Orleans runtime. The Virtual Actor Model is much more suitable for high-scale dynamic workloads like cloud services and is the major innovation of Orleans. You can read more details in the Technical Report on Orleans.
DocsI have to give it to the Orleans team. Their docs seem fantastic. I’ve read over most of their Step-by-Step guide and feel like there’s a lot of insight being shared. There’s a section about Concurrency that has some great code samples that gives with code samples a deadlock scenario. I found reading over these docs to be really helpful in understanding and just looking at small code samples.
Event SourcingOne aspect that I find interesting is having a grain manage it’s state being event sourced.
Event sourcing provides a flexible way to manage and persist grain state. An event-sourced grain has many potential advantages over a standard grain. For one, it can be used with many different storage provider configurations, and supports geo-replication across multiple clusters. Moreover, it cleanly separates the grain class from definitions of the grain state (represented by a grain state object) and grain updates (represented by event objects).My plan is to use event sourcing as grain state and persist events to Event Store. Luckily I’m familiar enough with Event Store however have to do more reading on if there is an existing implementation or have to roll my own.
5 thoughts to “Practical Microsoft Orleans”
I have an ETL project . https://github.com/ignatandrei/stankins . There are tests, but no documentation . Also, you may want to try running HTMLGenerator for seeing the feature. Beacuse it is an ETL, it will greatly benefit of Orleans.
Cool thanks! I’ll check it out.
Looking forward to seeing how this goes. I’ve been interested in Orleans for quite a while now and have looked into frameworks that use it, like Orleanka and Microdot (by Gigya), but haven’t had the time to create practical samples. Microdot looks very promising but unfortunately it’s very new so it doesn’t have much documentation. Maybe you can pick up where they leave off? They have some samples in the repo here https://github.com/gigya/microdot-samples
Interesting. I’ll take a look. Appreciate the suggestion!
I think you could take one of the microservices from https://github.com/dotnet-architecture/eShopOnContainers project and implement it using Orleans.