SignalR performance: Json is faster than MessagePack
See original GitHub issueDescribe the bug
I’m facing an issue with SignalR. Our benchmark shows that json protocol is faster than messagepack when transfering a lot of data. We need to investigate why messagepack isn’t getting the same or better performance than json.
While signalR with json protocol bandwidth increases when using larger packets (following the performance of raw binary websocket implementation), signalR with messagepack seems to be capped.

To Reproduce
Use the following code: https://github.com/Foxstream/SignalrMessagepackExample
Further technical details
It is a .NET 5.0 project with Microsoft.AspNetCore.SignalR.Client 5.0.5 and Microsoft.AspNetCore.SignalR.Protocols.MessagePack 5.0.5 packages.
Running on Windows 10 20H2. It uses websocket transport protocol and HTTP.sys.
Using the .NET or the Javascript signalR client doesn’t seem to matter because it will result in similar performance issues.
Results on localhost
With messagepack (2000 packets of 256KB)
179 packets/s | Bandwidth=45938 KB/s
It took 11.14s
With json (2000 packets of 256KB)
343 packets/s | Bandwidth=87885 KB/s
It took 5.82s
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (7 by maintainers)
Top Related StackOverflow Question
HttpSys wraps the output stream directly and just writes the data inline as it gets it. Another server like Kestrel, wraps the output stream in a much more complicated way and essentially buffers the writes so they go out in bigger chunks.
Backlogging as we wont be doing anything in 6.0 here.
Any reason why the server is using HTTP.sys? Also, that’s pretty impressive, good job JSON 😄