Treasure Data

1.866.306.DATA (3282)     spacer spacer spacer

MessagePack: the missing serializer


MessagePack in a nutshell

Greetings! We are kicking off the Treasure Data blog with MessagePack, the efficient, blazing fast serializer at the core of our technology.

The best way to describe MessagePack is “JSON on steroids”. It supports an almost identical set of data types as JSON —Nil, Boolean, Integer, Float, String, Array, and Associative Array— but runs much faster and requires a fraction of space.

The gory details

MessagePack is fast and space-efficient for a couple of reasons.

  • Stream deserializer.

MessagePack’s protocol is designed so that one can start deserializing the buffered data before all the data is received. The user simply appends new data to the buffer and start deserializing them right away. The real benefit of stream deserializer is pipelining; by overlapping deserialization and data reception, one can cut down the total time drastically.

  • “zero-copy” serialize/deserializer.
spacer

MessagePack’s dramatic speedup comes from “zero-copy” serialization (currently implemented only in the C++ and D library). As the name suggests, “zero-copy” serialization copies no data. Well, almost.

Instead of the entire data, the library keeps track of just enough metadata to recover the object for read operations. “zero-copy” deserialization works similarly but the other way around. The absence of copy operations speeds up serialization/deserialization, especially for large data.

  • Being smart about serialization schema.

Like many other efficient messaging protocols, MessagePack is a binary protocol. Furthermore, it is optimized to store common data types compactly. Here is a quick comparison with JSON.

spacer
  • Community, Community, Community.

Since the inception of the MessagePack project, we have had the fortune of having experts implement the library for each programming language. Instead of asking them to write a simple wrapper around the core C implementation, we encouraged them to go as low-level and hardcore as possible to squeeze in as many implementation-specific optimizations.

For example, the Ruby library has “zero-copy” deserialization implemented. This blog post shows how the Python’s implementation of MessagePack runs circles around every other serialization library. The community is active and growing, and the performance of each library continues to improve.

And this is only the beginning

Treasure Data eliminates obstacles for analyzing Big Data. All of your time should go into data analysis, not management. We are here to build powerful tools to help you do that.

We have a number of technical challenges ahead of us. We are small (a team of five so far) and actively looking for hackers and product managers who want to transform how people analyze Big Data. If you think you are a fit, please let us know. We’d love to talk to you!

Further readings:

  • MessagePack Top
  • MessagePack Manual
  • MessagePack Source
  • Architecture of MessagePack on SlideShare
  • Why Not MessagePack?
  • MessagePack: Efficient, Cross Language Binary Object Serialization
  • 7 months ago
  • 2
  • Comments
  • Permalink
  • Share
    Tweet

2 Notes/ Hide

  1. spacer take-cheeze liked this
  2. spacer treasure-data posted this

Recent comments

Blog comments powered by Disqus
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.