Open Michael-Kempe opened 3 years ago
I am using the library in production and it is working fine. But I also wanted to exchange the serializer since Newtonsoft is slow and allocates a lot of memory. I will try to use MessagePack instead, but not sure if it works easily. You can insert your own serializer, I tried that with System.Text.Json but it did not work because it cannot serialize System.Type since it is unsafe and not recommended.
I will try to get MessagePack working, hopefully without too many changes. I will report back how it went.
Update
MessagePack serializer seems to work out of the box, you just have to use attributes on the classes/properties you want to serialize or use the typeless serializer which is slower and produces a bigger message. So you might give it a try. But for me it still feels a bit slow. I am running several processes on a Raspberry Pi and it takes around 5ms to exchange 3-4kB of data. I will maybe try a shared memory solution to see if it is faster.
System.Text.Json with source generators is also a good alternative if you do not want to have more external dependencies. Serializing a basic POCO here with around 10 properties and one string property which holds the content of a file of about 3KB.
Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0 | Allocated |
---|---|---|---|---|---|---|---|
STJ | 87.58 ns | 1.523 ns | 1.272 ns | 1.00 | 0.00 | 0.0293 | 184 B |
MessagePack | 67.30 ns | 1.341 ns | 1.490 ns | 0.76 | 0.02 | 0.0050 | 32 B |
MessagePackTypeless | 73.80 ns | 0.444 ns | 0.371 ns | 0.84 | 0.01 | 0.0050 | 32 B |
Update 2
I tried another library for shared memory which also enables RPC calls and in my quick tests on my local machine it was 8x faster than named pipes. On the Raspberry Pi it is may be even faster due to the slow SD card compared to the SSD on my local machine. It was pretty easy to setup and use, so maybe I will switch to this one after doing some more tests.
CoreWCF
Hi, I see that during the last 11 months no code changes have been made and I want to ask about the status of this project. I'm looking for a replacement of our WCF (Named Pipe) Services. Is this Framework ready for production?
Cheers, Micha
When comparing the performance between WCF via Named Pipes and this Framework I see a significant difference. WCF is a lot faster and I think this is because of it's embedded BinarySerializer. So an additional question is : can we change the JSON Serializer with another one - please see customize user data serialization for request and response . I really like your implementation - during my tests everything works as expected. Great, thanks!