源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

php MessagePack介绍

  • 时间:2022-08-21 14:52 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:php MessagePack介绍
1,今天在hacknews上看到很多人对messagepack的争论。首先了解什么是MessagePack: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,MessagePack的主要用途,作者解释说有两大用途:一是Space-efficient storage for Memcache entries (Pinterest),节省空间类型的mamcache应用;另一个是用于RPC传输, 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,争议的地方是MessagePack的benchmark说,他比protocolBuffer,Json快很多倍。但是有人不相信,做个javasript下的测试(json与messagePack)。发现MessagePack仅是压缩后的数据比json少10%左右,而压缩和解压时间则和json的解析器比起来要费时很多。 4,“MsgPack vs. JSON: Cut your client-server exchange traffic by 50% with one line of code”这篇文章使用了messagePack做服务器的优化,降低服务器的数据量,更加合理的利用带宽。作者强调了他们宁愿浪费客户端的0.5ms—1ms,但是服务器使用ruby的MessagePack解析器,效率能够比JSON快5倍。 The difference to[b][url=http://json.org/]JSON[/url] [/b]is, that MsgPack is[b]binary-based[/b] - this gives the possibility to make the exchanged data[b]a) smaller and use less bytes[/b], I guess we all know the advantages of that, however there is an even bigger advantage:[b] b) It is faster to parse[/b] and[b]encode[/b], having a parser parse 40 bytes takes about twice as long as parsing 20 bytes.
[url=http://msgpack.org/]MessagePack[/url]官方网站 2,[url=http://indiegamr.com/cut-your-data-exchange-traffic-by-up-to-50-with-one-line-of-code-msgpack-vs-json/]MsgPack vs. JSON: Cut your client-server exchange traffic by 50% with one line of code[/url] HN评论地址:[url=http://news.ycombinator.com/item?id=4090831]http://news.ycombinator.com/item?id=4090831[/url] 3,[url=https://gist.github.com/2908191]My thoughts on MessagePack[/url] HN评论地址:[url=http://news.ycombinator.com/item?id=4092969]http://news.ycombinator.com/item?id=4092969[/url] 4 [url=https://gist.github.com/2905882]JS下MessagePack与JSON性能对比[/url] HN评论地址:[url=http://news.ycombinator.com/item?id=4091051]http://news.ycombinator.com/item?id=4091051[/url]
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部