I heard something about MsgPack that can be used for compressing json messages, but I have a question about that, why not simply using Gzip/Deflate instead of MsgPack? I think it's so better to debugging also.
It is one of the three standard formats for HTTP compression as specified in RFC 2616. This RFC also specifies a zlib format (called "DEFLATE"), which is equal to the gzip format except that gzip adds eleven bytes of overhead in the form of headers and trailers.
Compressing with gzip As text data, JSON data compresses nicely. That's why gzip is our first option to reduce the JSON data size. Moreover, it can be automatically applied in HTTP, the common protocol for sending and receiving JSON.
GZip is a form of server-side data compression that's helpful in reducing page loading time. In other words, it takes a set of data and makes it smaller for more streamlined, efficient delivery to a user's computer. Gzip compression reduces the size of your HTML, stylesheets, and JavaScript files.
msgpack is an efficient binary serialization format that you may want to choose as an alternative to JSON according to your use case.
Even if it is advertised as like JSON, but fast and small, it is not intended to compress JSON data. Once again think of it as an alternative, and keep in mind that as stated by its author:
there are many situations where it simply does not offer enough advantage to JSON
I would greatly recommend you to read this article - My thoughts on MessagePack, written by msgpack's author, that includes everything you need to know vs. recommended msgpack use cases, pros/cons and other useful pointers related to msgpack and JSON.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With