Tuesday, February 03, 2015

Bond... Microsoft Open Source, Bond (the cross-platform high scale serialization library... Microsoft Bond)

InfoQ - Microsoft Open Sources Cross-platform Serialization Library – Bond

Last month Microsoft open sourced Bond, a cross-platform framework for processing schematized data. Bond supports cross-language serialization/deserialization and powerful generic mechanisms for efficiently manipulating data. The framework is broadly used at Microsoft in high-scale services. The project is currently available at GitHub under the permissive MIT license. Current version supports C++, C# and Python and is available on Linux, OS-X and Windows. The Bond compiler is written in pure Haskell.

Bond shares many similarities with other serialization systems, for example Google Protocol BuffersThrift and Avro:

  • Bond messages are defined in the IDL – like language
  • It maps all Bond’s data type to the native language data types

Bond’s implementation however has one major difference: it doesn’t hard-code type mappings. It allows one to plug-in many things that aren't part of the core schema logic -whether to serialize from Bond schemas or a custom type, what the wire format is, whether to put custom metadata in the payload, and so on. For example, in C++ the defaults are STL containers like std::vector; however, a user can easily map custom types - using Python’s boost::multi index container in a generated C++ struct or mapping a uint64 schema field to a System.DateTime field in a generated C# class-. Bond generated C++ structs can also use custom allocators.

A nice comparison between Bond and Google Protocol Buffers is presented is this Stack Overflow



Microsoft open-sources cross-platform serialization library, Bond

Hey all, I wrote a small part of Bond, so let me see if I can answer some of the questions here:

  • Bond is used pervasively throughout the company, in a lot of mission-critical systems. I don't know that I can say where publicly, but when Adam says it's used for scale infrastructure, he really means it.
  • It was started sometime around when Thrift was just picking up steam, so it's been around in one form or another for awhile. The released version is actually Bond v3.
  • The answer to the "why" question is more or less here: http://microsoft.github.io/bond/why_bond.html The short of it is that the differences between systems like Thrift, PB, and Avro, tended to be in things like wire format, protocol, format of target class, etc., and not as much in the logic of how you do things like version schemas. But in short, IMHO the innovation of Bond is that it allows you to plug in a lot of the things that aren't core schema logic (e.g., whether to serialize from Bond schemas or a custom type, what the wire format is, whether to put custom metadata in the payload, and so on).

If you want to offer feedback or ask questions, you can either email Adam Sapek (adamsap -at- microsoft) or me, Alex Clemmer (aclemmer@microsoft.com), and I will loop you in with the correct people.



Bond is a cross-platform framework for working with schematized data. It supports cross-language de/serialization and powerful generic mechanisms for efficiently manipulating data. Bond is broadly used at Microsoft in high scale services.




For details, see the User's Manuals for C++, C# and Python.

For a discussion how Bond compares to similar frameworks see Why Bond.




Bond can be built with Clang (3.4+) or GNU C++ (4.7+). We recommend the latest version of Clang as it's much faster with template-heavy code like Bond.



Install XCode and then run the following command to install required packages using Homebrew ...



Install the following tools:


Really, I just wanted to to use Bond in the title... :P

No comments: