脚本从数据库生成缓存,并在Redis中存储有说服力的模型。
默认情况下,Laravel不支持Redis的自定义序列化程序,但是我使用了Laravel Lodash包来实现这一点。
结果:
Predis (serializer: php) Execution time: 00:05:53.0355 Cache storage used: 936.92MB — — — — — — — — — — — — — — — — — — Predis (serializer: igbinary)Execution time: 00:07:45.2460 Cache storage used: 342.66MB — — — — — — — — — — — — — — — — — Predis (serializer: igbinary, with ext-phpiredis)Execution time: 00:07:51.9046 Cache storage used: 342.66MB — — — — — — — — — — — — — — — — — PhpRedis (serializer: php)Execution time: 00:01:36.9863 Cache storage used: 936.75MB — — — — — — — — — — — — — — — — — PhpRedis (serializer: igbinary)Execution time: 00:01:37.3176 Cache storage used: 342.66MB
注:
Execution time:执行时间 Cache storage used:缓存存储
结论:
PhpRedis的速度大约是x6倍。使用igbinary序列化器可以将存储的数据大小减少3倍左右。如果将Redis安装在不同的计算机上,那么减少网络流量将大大加快速度。
以上就是PhpRedis与Predis之间的性能比较(实例)的详细内容,更多请关注Gxl网其它相关文章!
查看更多关于PhpRedis与Predis之间的性能比较(实例)的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did63066