Sereal and its tooling

20 minutes



Sereal is a schema-less, cross-language binary serialization protocol aiming to replace Storable in Perl. It natively handles almost all Perl data structures including “special" ones such as aliases, weakrefs, regexps and cyclic references. Sereal supports compression and string de-duplication and employs other nice tricks allowing it to produce one of the most compact outputs across available serialization libraries. It is also very fast!

Sereal is widely adopted at for serialization of objects for storage (MySQL, Redis, Memcached), as the default format for transferring data between different services, and for delivering logging data in our distributed environment.

Being very efficient in both speed and space Sereal::Encoder and Sereal::Decoder provide facilities which are not optimal in certain cases. For example many manipulations on encoded documents can be done only through re-serialization. To improve performance characteristics for these cases a set of tools was created:
- Sereal::Path - a query engine for Sereal allowing extraction of a single part of a document, similar to XPath and JSONPath.
- Sereal::Merger - a tool to combine several Sereal documents into a single one.
- Sereal::Splitter - a tool to split large documents into smaller ones.

In my talk I will give a quick introduction to Sereal and its internals. I’ll cover some design choices and important features. Finally, I’m going to explain the reasons of creating the tools and the best situations for using them.