In the past, the systems I've worked on have generally used XML to communicate between the client and server and transfer result sets, etc. My current project however simply serializes a list of objects into a binary and sends that across the wire.
We're now coming to a point where our 'transfer objects' (for lack of a better description) could start growing in size due to a bunch of new fields. This, added to the fact that we could in theory have a list of anything up to 100,000 objects sent across, makes me begin to wonder about the relative performance of our current approach vs using XML.
When I say 'performance' I consider:
- Size of objects being sent across the wire, and time taken
- Time taken to assemble objects ready for transfer
- Time taken to parse / deserialize on the other side before we display in the UI
My gut feel is that XML could get very verbose, so might need some kind of compression... but I'm not really familiar with how it scales against serialized binaries.开发者_运维技巧 Is there a general consensus on what sort of approach is more scalable, or are we getting into the realm of "fit for purpose" here? :)
Thanks for any advice.
Cheers, Dave.
I think, very generally speaking, there is some consensus that XML serialization is rather verbose and not very fast.
Regarding your binary serialization, since we don't know the implementation, it is kind of hard to judge. You could of course do some performance comparisons yourself.
Also, it might be interesting to look at publicly available implementations of binary protocols and see how they perfom against XML. Protocol buffers and Thrift come to mind.
Also check these: Performance comparison of Thrift, Protocol Buffers, JSON, EJB, other?
https://github.com/eishay/jvm-serializers/wiki/
精彩评论