Replies: 4 comments 1 reply
-
Have you considered either Apache Thrift or Apache Avro? |
Beta Was this translation helpful? Give feedback.
-
I did not looked closer, but when searching for comparisons between Protocol Buffers and Thrift I stumbled over those:
Others: https://old.floatingsun.net/articles/thrift-vs-protocol-buffers/index.html Benchmarks: https://github.com/eishay/jvm-serializers/wiki/ (though benchmarks have to be taken with care, depends a lot of application context) So overall it seems Protocol Buffers and Thrift are not that much far apart. Another interesting one might be Kryo. But have not looked closer and seems a smallish project which comes with the mentioned security risks. Apache Avro seems to be favouring dynamic typing: [1] https://stackoverflow.com/questions/69316/biggest-differences-of-thrift-vs-protocol-buffers |
Beta Was this translation helpful? Give feedback.
-
One important consideration was missing in my initial post: |
Beta Was this translation helpful? Give feedback.
-
I looked at all the mentioned ideas. The most flexible approach would be to create a custom TLV format, but we do not have the required resources, as you said. From the others, Cap'n Proto looks the most promising, but I would still prefer Protocol Buffers. Deserialization bugs usually lead to arbitrary code execution. One of these in the wire format (network layer) would be disastrous. In my opinion, we should select Protocol Buffers even if it's not the fastest one. But please keep in mind that I am probably biased because I have only worked with Protocol Buffers so far. |
Beta Was this translation helpful? Give feedback.
-
As we need to decide soon for the serialisation format we are going to use in Bisq 2 (Misq) I wanted to share my research and discuss what we should use.
Requirements:
Additional nice-to-have:
Candidates:
Protocol Buffers:
Pro:
Con:
Cap'n Proto
Pro:
Con:
FlatBuffers
Pro:
Con:
TLV based custom format:
Pro:
Con:
Comparison/discussions:
Conclusion:
I think Protocol Buffers seems to be the best choice. It does not meet the performance of Cap'n Proto and FlatBuffers but the support for gRPC and the large dev community/support and language support are a big plus. Security considerations are also important specially if not the core language implementation is used. In case of Cap'n Proto and FlatBuffers this work is often done by external developers and there are less eyes on it. Protocol Buffers has achieved inside Google (as well as outside) a huge network effect which is hard to be challenged by the technically maybe superior concepts implemented in Cap'n Proto and FlatBuffers.
Deterministic serialisation is not guaranteed by none of those (beside a TLV based custom format) but it is in practice achieved when avoiding maps (at least in Protocol Buffers ). It could be managed also with a version freeze in case an updated version would cause issues. The requirement for deterministic data is also an exceptional case (DAO) and it could be dealt differently with it as well (would be anyway better but comes with more effort - e.g. use a custom serialisation format where this is a hard requirement).
I have not looked closer to Simple Binary Encoding. Seems to be very fast but comes with its own trade-offs. It is used in high frequency trading context, which does not really match our context.
Any feedback/comments?
Beta Was this translation helpful? Give feedback.
All reactions