What is the Performance impact of using BinarySerializer over XmlSerializer in NServiceBus

116 Views Asked by At

I am on an optimization of improving performance and I have found that certain messages, not necessary large in size but complex in structure, takes more time to get received at handler after sending, about 3 seconds between end point running in same physical machine. This I suspect Serializer takes more time to process serialization and deserialization. I am using BinarySerializer, is there any way to calculate the time taken by the serializer. Is there any way to invoke the serializer with unit testing (NServiceBus.Test)

2

There are 2 best solutions below

0
Udi Dahan On

It is extremely unlikely that the binary serializer would be your bottleneck for messages that aren't very large. You could easily run a test to verify this by using the serializer to directly serialize and deserialize one of your messages.

0
Simon On

is there any way to calculate the time taken by the serializer

Your best bet to get accurate+real times is to is to use a profiler like DotTrace http://www.jetbrains.com/profiler/ or JustTrace http://www.telerik.com/products/memory-performance-profiler.aspx

Is there any way to invoke the serializer with unit testing

The classes are public and you can instantiate them and run them from a unit test. The types are BinaryMessageSerializer and XmlMessageSerializer.

If you want to have more of a conversation about it I recommend you re-post on the NSB group https://groups.google.com/forum/#!forum/particularsoftware and include your timings message classes that are causing the issue