JSON, by now, became a regular part of most applications and services. Do we, how ever, really want to transfer human readable information or are we looking for a binary protocol to be as debuggable as JSON? CBOR the Concise Binary Object Representation offers the best of JSON + an extremely efficient, binary representation.
http://www.cbor.io
32. www.hazelcast.com@noctarius2k
Real World (Size) Example
www.pathway-game.com
• Stores Geometry Information
• Mainly Float Data
• Often floatToIntBits for Speed
• Lots of Sequences
• Only a few Dictionaries
Really simple data structure
33. www.hazelcast.com@noctarius2k
Real World (Size) Example
2250000
4500000
6750000
9000000
XML JSON BSON CBOR MSGPACK
MSGPACK
CBOR
BSON
JSON
XML
1.408.737 bytes
1.415.215 bytes
5.575.783 bytes
5.755.188 bytes
8.592.541 bytes
1.0x
1.0x
3.9x
4.0x
6.0x
34. www.hazelcast.com@noctarius2k
Debugging capability built-in
Dictionary [
ByteString{ ANI0 }=Sequence [
Sequence [
UInt{ 7264 },
UInt{ 4 },
UInt{ 2724 },
UInt{ 37 },
Sequence [
NInt{ -1053818880 },
UInt{ 1077214225 },
UInt{ 0 },
UInt{ 0 },
UInt{ 1068825617 },
]
]
]
]
Since items carry their type information,
writing a quick debugger or using the
provided to-string capabilities of libs
44. www.hazelcast.com@noctarius2k
MessagePack
• Extremely concise
• Available in almost every language
• UTF-8 and binary strings
• No map keys datatype restriction
• Schemaless
• Binary
• 32bit size limitation for certain data types
• Specification is concise too (~450 lines)
• No official standard
45. www.hazelcast.com@noctarius2k
MessagePack
• Extremely concise
• Available in almost every language
• UTF-8 and binary strings
• No map keys datatype restriction
• Schemaless
• Binary
• 32bit size limitation for certain data types
• Specification is concise too (~450 lines)
• No official standard
1:0
2:0
Draw
Draw
Draw
Draw
2:1
2:2
2:3
46. www.hazelcast.com@noctarius2k
JSON
• Human readable
• Official standard (ECMA-404)
• Subset of JavaScript (strong support)
• Schemaless
• Kind of type safe
• Human readable
• Text-based
• Map keys can be strings only
• Large bytesize
47. www.hazelcast.com@noctarius2k
• Human readable
• Official standard (ECMA-404)
• Subset of JavaScript (strong support)
• Schemaless
• Kind of type safe
• Human readable
• Text-based
• Map keys can be strings only
• Large bytesize
1:0
Draw
2:0
Draw
Draw
2:1
2:2
2:3
2:4
JSON
48. www.hazelcast.com@noctarius2k
• Binary
• Available in a lot of languages
• Derived from JSON, interoperability 1+
• Schemaless
• Type safe
• Supports in-place updates
• No official standard
• Extremely concise specification
• Map keys can be strings only
• Large bytesize
BSON
49. www.hazelcast.com@noctarius2k
• Binary
• Available in a lot of languages
• Derived from JSON, interoperability 1+
• Schemaless
• Type safe
• Supports in-place updates
• No official standard
• Extremely concise specification
• Map keys can be strings only
• Large bytesize
Draw
1:0
2:0
Draw
Draw
3:0
3:1
3:2
3:3
3:4
BSON
50. www.hazelcast.com@noctarius2k
• Human readable
• Official standard (W3C REC-xml)
• Strong commercial support (e.g. IBM)
• Supported everywhere
• Type safe or schemaless
• Human readable
• Text-based
• Very verbose
• Large bytesize
XML
51. www.hazelcast.com@noctarius2k
• Human readable
• Official standard (W3C REC-xml)
• Strong commercial support (e.g. IBM)
• Supported everywhere
• Type safe or schemaless
• Human readable
• Text-based
• Very verbose
• Large bytesize
1:0
Draw
2:0
3:0
3:1
3:2
3:3
3:4
3:5
XML
52. www.hazelcast.com@noctarius2k
More alternatives
Text-based:
• bencode
• YAML
• …
Binary:
• Amazon ION
• Smile
• Apache Thrift
• Apache Avro
• Protobuf
• …
ASCII based encoding, unaffected by endianess, type safe
commonly for configuration, superset of JSON, type safe
skip-scan parsable, type safe, commercial support (Amazon)
based on JSON, property-name back-references
DSL, schema-bound, developed by Facebook, RPC services
DSL, schema-bound, primarily used by Hadoop
DSL, schema-bound, developed by Google, RPC services