Yan Cui
I help clients go faster for less using serverless technologies.
Note: don’t forget to check out the Benchmarks page to see the latest round up of binary and JSON serializers.
Since my last round of benchmarks on binary serializers, there’s a new player in town – MessageShark, which at the time of this writing does not support serialization of fields, but offers comparable speed and payload to protobuf-net.
Using the same test objects, here’s how MessageShark compares to the other binary serializers:
It’s early days for MessageShark but the signs are good, comparable serialization speed with protobuf-net and a noticeably faster deserialization speed, definitely one to keep an eye out for!
Whenever you’re ready, here are 3 ways I can help you:
- Production-Ready Serverless: Join 20+ AWS Heroes & Community Builders and 1000+ other students in levelling up your serverless game. This is your one-stop shop for quickly levelling up your serverless skills.
- I help clients launch product ideas, improve their development processes and upskill their teams. If you’d like to work together, then let’s get in touch.
- Join my community on Discord, ask questions, and join the discussion on all things AWS and Serverless.
Btw, I just recently checkin some changes to MessageShark and I believe that could change the result of the serialization. The change could yield a better result for MessageShark in comparison to protobuf-net.
BinaryFormatter may be slow as hell but it does reconstruct arbitrarily complex object graphs correctly. OrigoDB uses BinaryFormatter by default. We also offer an IFormatter adapter for Protobuf-net but it requires you configure your types with attributes or using a RuntimeTypeModel. See https://github.com/DevrexLabs/Modules.ProtobufFormatter/blob/master/OrigoDB.Modules.Protobuf.Test/TodoModelTests.cs to understand what what kind of object graph issues need to be considered.
The flexibility of BinaryFormatter is definitely useful – we’ve had to build our own plumbing when we moved to protobuf-net, but cost saving is more than significant enough to justify the added complexity. More than halved the number of servers we need to run and saving over $10,000 in EC2 bills per month.
Thanks, good point! I thought it could be fair to point out that performance might not be as superior as your benchmark suggests when the graphs are complex. Some of the formatters can’t even handle cycles and multiple paths to the same object, the MessageShark C# port for instance.
Also, using a contract based serializer (schema is defined separately, not included in the stream) like protobuf is more flexible when dealing with versioning. Renaming a field, class or namespace when using BinaryFormatter is a major pain best to be avoided!
For sure, I have found performance of serializers to differ greatly based on payload, which is why I have always tried to tell folks to benchmark against their actual payload and built a harness to make that easier.