丈夫欲遂平生志,一载寒窗一举汤。这篇文章主要讲述json,serialize,msgpack比较相关的知识,希望能为你提供帮助。
速度
在redis中存入同样的压缩数据,取操作执行两个操作:
1 从redis中取
2 解压
3 统一json压缩后放出
ab测试:
[yejianfeng@openstack ~/httpd/usr/bin]$ ./ab -n 10000 -c 10 http://10.16.15.118:7701/location/testGet?type=json
Requests per second:265.11 [#/sec] (mean)
Requests per second:267.58 [#/sec] (mean)
Requests per second:275.48 [#/sec] (mean)
Requests per second:263.11 [#/sec] (mean)
Requests per second:264.99 [#/sec] (mean)
[yejianfeng@openstack ~/httpd/usr/bin]$ ./ab -n 10000 -c 10 http://10.16.15.118:7701/location/testGet?type=serialize
Requests per second:297.52 [#/sec] (mean)
Requests per second:322.57 [#/sec] (mean)
Requests per second:303.59 [#/sec] (mean)
Requests per second:289.89 [#/sec] (mean)
Requests per second:317.26 [#/sec] (mean)
[yejianfeng@openstack ~/httpd/usr/bin]$ ./ab -n 10000 -c 10 http://10.16.15.118:7701/location/testGet?type=msgpack
Requests per second:288.07 [#/sec] (mean)
Requests per second:306.73 [#/sec] (mean)
Requests per second:313.61 [#/sec] (mean)
Requests per second:289.49 [#/sec] (mean)
Requests per second:307.84 [#/sec] (mean)
压缩比例:
[yejianfeng@test34x-nova /tmp]$ ll -h test*
-rw-r--r-- 1 server server 29K Jan3 21:40 testjson
-rw-r--r-- 1 server server 22K Jan3 21:40 testmsgpack
-rw-r--r-- 1 server server 31K Jan3 21:40 testserialize
[yejianfeng@test34x-nova /tmp]$ ll test*
-rw-r--r-- 1 server server 28942 Jan3 21:40 testjson
-rw-r--r-- 1 server server 21993 Jan3 21:40 testmsgpack
-rw-r--r-- 1 server server 31537 Jan3 21:40 testserialize
msgpack是serizalize的69%
【json,serialize,msgpack比较】json是serizalize的91.8%
推荐阅读
- OpenStack Mitaka部署<五;
- 一台服务器可以建设几个网站(一台服务器可以用多久?)
- shell脚本线程并发控制 #yyds干货盘点#
- CentOS7.5 配置BBR加速
- 本地主机wp-admin的WordPress-URL不起作用
- 父/同级页面处于活动状态时显示的WordPress twentyfifteen子菜单项
- WordPress标题未显示在浏览器标题栏中
- 内置产品目录的WordPress主题
- WordPress的主题(删除导航栏)