Reputation: 53
Currently I am starting a project, which needs to serialize the data from .net application ( c# app) and pass it throug a network to a java based server application. Therefore I would like to know which serialization mechanism is most efficient and at the same time serilized objct must be desirialize by java aplication.
queries:
I have heard that protobuf is much more faster than any other serialization like xml. Is is possible to use protobuf to accomplish the above mentioned requirement ??
In java there is newly developed technology named "Kryo" framework for serialization, which is even more efficient than protobuf, so are there any such thing in .net enviornment which must be language independent.
Upvotes: 4
Views: 1657
Reputation: 15706
Hessian is a highly efficient, binary but language independent serialization protocol.
Implementations are available for Java, C++, C#, Objective-C, PHP, Ruby, Javascript etc.
A comparison of the performance of various remote protocol can be found here:
Java Remoting: Protocol Benchmarks
Upvotes: 2
Reputation: 3473
Hmm..
It depends on the type of data you want to share between applications ofcourse.. Here's a brief overview of what I find to be pros & cons.. Can you maybe explain what type of data structures you'd want to share?
I'd advise to either use XML or JSON, to allow flexibility. Other binary based serialisation options will be difficult in the longer run, because,
Json is an option
XML as well
And then,
Protobuf
Upvotes: 1
Reputation: 200266
Language independence of communication is achieved by the contract-first approach. Create a clear and simple specification of the interchange format and then find the best tool at either end to help you adhere to it.
There are two basic choices for the wire format: XML and JSON.
XML has the advantage of a widely understood Schema specification, which then allows tools to generate binding code.
JSON has the advantage of being a simpler format to "hack together" in any language.
Regarding any statements about the speed of a format, this is tightly bound to existing implementations on a specified platform. There is no language-independent speed rating of a protocol.
Upvotes: 0
Reputation: 1064014
Yes, protobuf is language independent. The java version is provided by google, with multiple C# implementations (I would recommend protobuf-csharp-port if you want very similar code at both ends, and protobuf-net if you prefer the .NET code to look like idiomatic .NET).
Re Kryo - I genuinely don't know enough to comment, but the only way to answer the "is it more efficient" question is to test it (also: define what efficiency means to you: is that serialization size? CPU time? resource usage? or...?). Personally, I'd be a little skeptical that it is going to be smaller, but: there's a sure fire way to find out: you try it.
I do not know whether Kryo is language agnostic, but I can only see Java mentioned.
Upvotes: 5