Orleans vs a Distributed Cache
I’m often asked what the difference is between Orleans and a distributed cache. It’s a good observation because on the face of it they have similar aims, to hold objects in memory for the right period of time to provide a performance benefit.
However, there are a number of differences.
- The grains in Orleans are programmable, whereas caches normally just store data.
- With a distributed cache you keep objects in memory, but there’s a good chance that the data doesn’t reside on the same machine that’s serving the request. This means that machine processing the request has to retrieve the data from another node. Orleans will send the request to the machine which holds the data, which in theory should be more efficient.
- Orleans queues message to each grain and processes them one by one with a single threaded programming model. This stops concurrency problems and race conditions. With caches you have to build a locking system yourself, as described here for memcached.
- A grain can register a timer so it can call itself without requiring an external request. Caches generally just respond to external requests.
People are certainly using Orleans as a cache, but I think it’s capable of much more.
Roger Alsing 11:02 am on June 25, 2014 Permalink | Log in to Reply
On #3) my impression is that during a net split, Orleans can spawn the same virtual actor on each side of the network partition, and thus, break the fundamental single threaded behavior of actors.
I Think Caitie McCaffrey taked about this during a Jepsen webcast.
If this is true, you can still get race conditions and corrupted data
Graham Hay 3:34 pm on June 30, 2014 Permalink | Log in to Reply
“stops concurrency problems and race conditions” is a bit optimistic 🙂 It might remove certain categories of problems, if you’re lucky, but any interactions between grains will still be subject to the usual problems with distributed systems.
Orleans vs a Distributed Cache | Richard Astbury’s Blog | Orleans 5:44 pm on January 21, 2017 Permalink | Log in to Reply
[…] Source: Orleans vs a Distributed Cache | Richard Astbury’s Blog […]