Akka.Serialization.MessagePack2
1.5.31-beta1
Prefix Reserved
See the version list below for details.
dotnet add package Akka.Serialization.MessagePack2 --version 1.5.31-beta1
NuGet\Install-Package Akka.Serialization.MessagePack2 -Version 1.5.31-beta1
<PackageReference Include="Akka.Serialization.MessagePack2" Version="1.5.31-beta1" />
paket add Akka.Serialization.MessagePack2 --version 1.5.31-beta1
#r "nuget: Akka.Serialization.MessagePack2, 1.5.31-beta1"
// Install Akka.Serialization.MessagePack2 as a Cake Addin #addin nuget:?package=Akka.Serialization.MessagePack2&version=1.5.31-beta1&prerelease // Install Akka.Serialization.MessagePack2 as a Cake Tool #tool nuget:?package=Akka.Serialization.MessagePack2&version=1.5.31-beta1&prerelease
Akka.Serialization.MessagePack
Akka.NET serialization with MessagePack
The Akka.Serialization.MessagePack
plugin is designed to:
- Be Low Ceremony for common cases.
- Allow flexiblity for advanced cases.
- Provide High Performance
- Allow for Optional LZ4 compaction.
Payload Versioning Notes
Assembly Versions
This plugin has a few different options to control payload serialization/deserialization:
allow-assembly-version-mismatch
- If
False
, Assembly version mismatches between payload and availiable deserializer will throw. - Default is
True
- If
omit-assembly-version
- Controls whether Assembly version is included in payload.
Schema Evolution
One can do a form of 'Schema evolution' (if you squint at it from the right angle) with MessagePack payload definitions.
Consider the following:
[MessagePackObject(false)]
public class WireType
{
[Key(0)]
public int Foo {get;set;}
[Key(1)]
public string Bar {get;set;}
[Key(2)]
public byte[] Bin {get;set;}
}
The above uses Messagepack attributes to define that every item is packed into an array.
If one wanted to add a new field, they could do, for example,
[MessagePackObject(false)]
public class WireType
{
[Key(0)]
public int Foo {get;set;}
[Key(1)]
public string Bar {get;set;}
[Key(2)]
public byte[] Bin {get;set;}
[Key(3)]
public byte[]? OtherBin {get;set;}
}
The consumer will, of course, need to do it's own checks for whether OtherBin
is null, however the serializer itself will be able to handle using/ignoring data appropriately.
Two additional notes:
- Any empty slots will be filled with nil up to the max Key in the array. So, in the above example, if
OtherBin
had a Key index of 64, it would be serialized as a 64 slot array with 60nil
values betweenBin
andOtherBin
. - One can apply inheritance and DU-style behavior via attributes, see the MP docs for details.
How to setup MessagePack as default serializer
Bind MessagePack serializer using following HOCON configuration in your actor system settings:
akka {
actor {
serializers {
messagepack = "Akka.Serialization.MessagePack.MsgPackSerializer, Akka.Serialization.MessagePack"
}
serialization-bindings {
"System.Object" = messagepack
}
}
}
Benchmarks
BenchmarkDotNet=v0.10.9, OS=Windows 10 Redstone 2 (10.0.15063)
Processor=Intel Core i5-6400 CPU 2.70GHz (Skylake), ProcessorCount=4
Frequency=2648439 Hz, Resolution=377.5809 ns, Timer=TSC
.NET Core SDK=2.0.0
[Host] : .NET Core 2.0.0 (Framework 4.6.00001.0), 64bit RyuJIT
NETCORE 2.0 : .NET Core 2.0.0 (Framework 4.6.00001.0), 64bit RyuJIT
Job=NETCORE 2.0 Platform=X64 Runtime=Core
Server=True Toolchain=CoreCsProj
Method | Mean | Error | StdDev | Gen 0 | Allocated |
---|---|---|---|---|---|
MsgPack_serialize_string | 248.7 ns | 2.221 ns | 2.078 ns | 0.0029 | 112 B |
Hyperion_serialize_string | 414.2 ns | 5.646 ns | 5.281 ns | 0.0257 | 832 B |
JsonNet_serialize_string | 1,854.9 ns | 36.749 ns | 43.748 ns | 0.1355 | 4336 B |
MsgPack_serialize_SimpleObject | 351.6 ns | 5.425 ns | 5.074 ns | 0.0037 | 136 B |
Hyperion_serialize_SimpleObject | 965.3 ns | 12.820 ns | 11.992 ns | 0.0331 | 1112 B |
JsonNet_serialize_SimpleObject | 23,832.4 ns | 339.575 ns | 317.639 ns | 0.4008 | 14576 B |
MsgPack_serialize_SimpleOptimizedObject_int_keys | 200.1 ns | 1.425 ns | 1.333 ns | 0.0019 | 72 B |
Hyperion_serialize_SimpleOptimizedObject_preregistered | 493.4 ns | 6.110 ns | 5.715 ns | 0.0216 | 712 B |
MsgPack_serialize_TypelessObject | 2,096.3 ns | 21.150 ns | 19.784 ns | 0.0120 | 568 B |
Hyperion_serialize_TypelessObject | 5,698.9 ns | 34.648 ns | 32.410 ns | 0.1465 | 4952 B |
JsonNet_serialize_TypelessObject | 42,583.6 ns | 291.306 ns | 258.235 ns | 0.3342 | 13960 B |
Maintainer
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Akka (>= 1.5.31)
- CommunityToolkit.HighPerformance (>= 8.3.2)
- MessagePack (>= 2.5.192)
- MessagePack.ImmutableCollection (>= 2.4.59)
-
net6.0
- Akka (>= 1.5.31)
- CommunityToolkit.HighPerformance (>= 8.3.2)
- MessagePack (>= 2.5.192)
- MessagePack.ImmutableCollection (>= 2.4.59)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.5.31 | 117 | 11/26/2024 |
1.5.31-beta1 | 77 | 11/19/2024 |
1.5.16-beta1 | 140 | 2/14/2024 |
* [Upgrade Akka.Net to 1.5.31](https://github.com/akkadotnet/akka.net/releases/tag/1.5.31)
* [Bump MessagePack to 2.5.192](https://github.com/akkadotnet/Akka.Serialization.MessagePack/pull/80)
* [Bump CommunityToolkit.HighPerformance to 8.3.2](https://github.com/akkadotnet/Akka.Serialization.MessagePack/pull/68)