orleans icon indicating copy to clipboard operation
orleans copied to clipboard

[Question] Is Orleans Serializer good choice for storing data?

Open zeinali-ali opened this issue 3 months ago • 2 comments

Hi I'm working on an event-sourcing system on top of Orleans. I gonna store all events permanently in DB. The question is: Is Orleans Serializer stable enough to we rely on for storing data? (I mean would be any probable breaking changes in the future?)

I have 2 option:

  1. Orleans Serializer
  2. Protobuf

And the possibility of breaking changes is the only reason if I gonna go with Protobuf

zeinali-ali avatar Sep 26 '25 20:09 zeinali-ali

Protobuf gives you a lot of assurance because it's very stable and has support for every language. The biggest downside is that it requires you to model your types in a specific way which is not as expressive as .NET's type system. Orleans' serializer gives you the full power of .NET's type system (as far as is reasonable, eg no raw pointers or stack-only types) so that you can model your domain as you see fit, but it comes with the downside that it is .NET-specific. Since it exposes more of .NET's type system, people may be more prone to making mistakes during refactoring (eg, moving types around without first adding aliases).

Ultimately, there's no one best choice for all situations. If you are happy to model your types using Protobuf's type system, I'd go with that.

ReubenBond avatar Oct 02 '25 17:10 ReubenBond

Thanks for guide. Yeah exactly as you mention the Orealns serializer give the full power of .NET type system so it has many advantages and streamline development process, the support for record-types is very important as we can model our events and states using records which give us a native immutability Orleans serializer also showed better performance than protobuf in our benchmarks.

The official protobuf tools and typing system is not very .net friendly, specially the lack of nullable-type support make codes very unclean, hard to develop and mistakable, you have to add a bunch of extra-line of code to check the value is really default or is null with Has[fieldname] Properties. also you have to put almost all modern C# features away.

so my preference is Orleans serializer(version 7+) unless Orleans team are considering it only as a transport level serializer and in the future updates there could be some breaking-changes that corrupt stored data-deserialization, I'm just looking, how much is the chance of such a breaking change? if it's high I go with protobuf first (probably with protobuf-net which is more .net friendly), if it's rare I go with Orleans serializer

zeinali-ali avatar Oct 04 '25 11:10 zeinali-ali