Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MsgPack for compressing json data, why not using gzip/deflate?

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.

like image 918
Afshin Mehrabani Avatar asked Oct 16 '12 19:10

Afshin Mehrabani


People also ask

Is DEFLATE same as gzip?

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.

Can I gzip JSON?

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.

How does gzip compression benefit faster?

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.


1 Answers

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.

like image 148
deltheil Avatar answered Oct 07 '22 20:10

deltheil