1. Today I saw a lot of people arguing about messagepack on hacknews. First understand what MessagePack is: MessagePack is a binary-based efficient object serialization library. It enables to exchange structured objects between many languages like JSON. But unlike JSON, it is very fast and small.
2. The main purpose of MessagePack. The author explains that it has two major uses: one is Space-efficient storage for Memcache entries (Pinterest), a space-saving mamcache application; the other is for RPC transmission. This use case is fairly close to my original intent. When one is designing an RPC system, one of the first tasks is to specify and implement a communication protocol. This process can get pretty hairy as you need to worry about a lot of low-level issues like Endian -ness. By using MessagePack, one can skip designing and implementing a communication protocol entirely and accelerate development.
3. The controversial point is that the benchmark of MessagePack says that it is many times faster than protocolBuffer and Json. But some people don't believe it and do a test under javascript (json and messagePack). It is found that MessagePack only compresses about 10% less data than json, and the compression and decompression time is much more time-consuming than the json parser.
4. "MsgPack vs. JSON: Cut your client-server exchange traffic by 50% with one line of code" This article uses messagePack to optimize the server, reduce the amount of data on the server, and make more reasonable use of bandwidth. The author emphasized that they would rather waste 0.5ms-1ms on the client, but the server uses ruby's MessagePack parser, which can be 5 times faster than JSON.
The difference to JSON is, that MsgPack is binary-based - this gives the possibility to make the exchanged data a) smaller and use less bytes , I guess we all know the advantages of that, however there is an even bigger advantage: b) It is faster to parse and encode, having a parser parse 40 bytes takes about twice as long as parsing 20 bytes.
The author of MessagePack also believes that MessagePack may not be the best choice for client-side serialization as described by the blog author. The author citing 2 is a little tragic.
5. Bson is the binary form of Json, but it is grammatically incompatible with Json. But MessagePack guarantees semantic consistency.
6. Different scene requirements lead to differences in the application of technology.
PHP Trial MessagePack
It's like JSON. but fast and small.
This sentence attracted me and I went to take a look.
Official website: http://msgpack.org
The official installation method is misleading, there is no php directory in the msgpack directory... I only see csharp, erlang, go, java, ruby etc. directory.
1, MessagePack official website
2. MsgPack vs. JSON: Cut your client-server exchange traffic by 50% with one line of code
HN comment address: http://news.ycombinator.com/item?id=4090831
3, My thoughts on MessagePack
HN comment address: http://news.ycombinator.com/item?id=4092969
4 Performance comparison between MessagePack and JSON under JS
HN comment address: http://news.ycombinator.com/item?id=4091051