十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
redis自带一个很好的基准测试工具,记录一下测试效果,欢迎拍砖。我发现一个奇怪的情况,一些关于开源工具的博客,很少描述当时主机的一些情况,没有主机部分数据的记录,是有些不太完整的。
创新互联公司作为成都网站建设公司,专注网站建设公司、网站设计,有关成都定制网站方案、改版、费用等问题,行业涉及VR全景等多个领域,已为上千家企业服务,得到了客户的尊重与认可。环境介绍
1.redis服务器(虚拟机,IP:192.168.163.156)
1M内存
20G硬盘
Linux操作系统
2.redis 客户端(虚拟机,IP:192.168.163.146)
1M内存
20G硬盘
3.监控 zabbix (虚拟机,IP:192.168.163.146)
1M内存
20G硬盘
测试了2次
测试记录
1.请求两1w,并发数为4
# /usr/local/redis/bin/redis-benchmark -h 192.168.163.156 -p 6379 -c 4 -n 10000 ====== PING_INLINE ====== 10000 requests completed in 0.46 seconds 4 parallel clients 3 bytes payload keep alive: 1 99.77% <= 1 milliseconds 99.98% <= 2 milliseconds 100.00% <= 2 milliseconds 21598.27 requests per second ====== PING_BULK ====== 10000 requests completed in 0.42 seconds 4 parallel clients 3 bytes payload keep alive: 1 100.00% <= 0 milliseconds 23696.68 requests per second ====== SET ====== 10000 requests completed in 0.43 seconds 4 parallel clients 3 bytes payload keep alive: 1 100.00% <= 0 milliseconds 23364.49 requests per second ====== GET ====== 10000 requests completed in 0.44 seconds 4 parallel clients 3 bytes payload keep alive: 1 99.95% <= 1 milliseconds 100.00% <= 1 milliseconds 22935.78 requests per second ====== INCR ====== 10000 requests completed in 0.43 seconds 4 parallel clients 3 bytes payload keep alive: 1 100.00% <= 0 milliseconds 23201.86 requests per second ====== LPUSH ====== 10000 requests completed in 0.42 seconds 4 parallel clients 3 bytes payload keep alive: 1 100.00% <= 0 milliseconds 23923.45 requests per second ====== RPUSH ====== 10000 requests completed in 0.43 seconds 4 parallel clients 3 bytes payload keep alive: 1 100.00% <= 0 milliseconds 23148.15 requests per second ====== LPOP ====== 10000 requests completed in 0.44 seconds 4 parallel clients 3 bytes payload keep alive: 1 100.00% <= 1 milliseconds 22883.29 requests per second ====== RPOP ====== 10000 requests completed in 0.44 seconds 4 parallel clients 3 bytes payload keep alive: 1 100.00% <= 0 milliseconds 22883.29 requests per second ====== SADD ====== 10000 requests completed in 0.43 seconds 4 parallel clients 3 bytes payload keep alive: 1 99.97% <= 1 milliseconds 100.00% <= 1 milliseconds 23148.15 requests per second ====== SPOP ====== 10000 requests completed in 0.43 seconds 4 parallel clients 3 bytes payload keep alive: 1 100.00% <= 0 milliseconds 23474.18 requests per second ====== LPUSH (needed to benchmark LRANGE) ====== 10000 requests completed in 0.42 seconds 4 parallel clients 3 bytes payload keep alive: 1 100.00% <= 0 milliseconds 23640.66 requests per second ====== LRANGE_100 (first 100 elements) ====== 10000 requests completed in 0.60 seconds 4 parallel clients 3 bytes payload keep alive: 1 99.85% <= 2 milliseconds 99.91% <= 3 milliseconds 100.00% <= 3 milliseconds 16666.67 requests per second ====== LRANGE_300 (first 300 elements) ====== 10000 requests completed in 1.07 seconds 4 parallel clients 3 bytes payload keep alive: 1 100.00% <= 1 milliseconds 9337.07 requests per second ====== LRANGE_500 (first 450 elements) ====== 10000 requests completed in 1.27 seconds 4 parallel clients 3 bytes payload keep alive: 1 99.88% <= 1 milliseconds 99.97% <= 2 milliseconds 100.00% <= 2 milliseconds 7849.29 requests per second ====== LRANGE_600 (first 600 elements) ====== 10000 requests completed in 1.64 seconds 4 parallel clients 3 bytes payload keep alive: 1 99.72% <= 1 milliseconds 100.00% <= 1 milliseconds 6101.28 requests per second ====== MSET (10 keys) ====== 10000 requests completed in 0.46 seconds 4 parallel clients 3 bytes payload keep alive: 1 100.00% <= 0 milliseconds 21978.02 requests per second
LRANGE_600 (first 600 elements) 性能最差,6101.28 requests per second
2.请求两10w,并发数为4
[root@hadoop1 zabbix]# /usr/local/redis/bin/redis-benchmark -h 192.168.163.156 -p 6379 -c 4 -n 100000 ====== PING_INLINE ====== 100000 requests completed in 4.40 seconds 4 parallel clients 3 bytes payload keep alive: 1 99.94% <= 1 milliseconds 99.98% <= 2 milliseconds 99.99% <= 3 milliseconds 100.00% <= 3 milliseconds 22742.78 requests per second ====== PING_BULK ====== 100000 requests completed in 4.29 seconds 4 parallel clients 3 bytes payload keep alive: 1 100.00% <= 1 milliseconds 100.00% <= 1 milliseconds 23288.31 requests per second ====== SET ====== 100000 requests completed in 4.38 seconds 4 parallel clients 3 bytes payload keep alive: 1 100.00% <= 0 milliseconds 22857.14 requests per second ====== GET ====== 100000 requests completed in 4.41 seconds 4 parallel clients 3 bytes payload keep alive: 1 99.99% <= 1 milliseconds 99.99% <= 2 milliseconds 100.00% <= 3 milliseconds 100.00% <= 3 milliseconds 22665.46 requests per second ====== INCR ====== 100000 requests completed in 4.67 seconds 4 parallel clients 3 bytes payload keep alive: 1 99.95% <= 1 milliseconds 99.98% <= 2 milliseconds 99.99% <= 3 milliseconds 100.00% <= 3 milliseconds 21422.45 requests per second ====== LPUSH ====== 100000 requests completed in 4.30 seconds 4 parallel clients 3 bytes payload keep alive: 1 99.99% <= 1 milliseconds 100.00% <= 2 milliseconds 100.00% <= 3 milliseconds 100.00% <= 3 milliseconds 23239.60 requests per second ====== RPUSH ====== 100000 requests completed in 4.33 seconds 4 parallel clients 3 bytes payload keep alive: 1 99.99% <= 1 milliseconds 100.00% <= 4 milliseconds 100.00% <= 4 milliseconds 23105.36 requests per second ====== LPOP ====== 100000 requests completed in 4.35 seconds 4 parallel clients 3 bytes payload keep alive: 1 99.99% <= 1 milliseconds 100.00% <= 2 milliseconds 100.00% <= 6 milliseconds 100.00% <= 6 milliseconds 22993.79 requests per second ====== RPOP ====== 100000 requests completed in 4.38 seconds 4 parallel clients 3 bytes payload keep alive: 1 99.99% <= 1 milliseconds 100.00% <= 1 milliseconds 22836.26 requests per second ====== SADD ====== 100000 requests completed in 4.45 seconds 4 parallel clients 3 bytes payload keep alive: 1 99.99% <= 1 milliseconds 99.99% <= 2 milliseconds 100.00% <= 2 milliseconds 22461.81 requests per second ====== SPOP ====== 100000 requests completed in 4.39 seconds 4 parallel clients 3 bytes payload keep alive: 1 100.00% <= 1 milliseconds 100.00% <= 1 milliseconds 22773.86 requests per second ====== LPUSH (needed to benchmark LRANGE) ====== 100000 requests completed in 4.53 seconds 4 parallel clients 3 bytes payload keep alive: 1 99.99% <= 1 milliseconds 99.99% <= 2 milliseconds 100.00% <= 2 milliseconds 22094.56 requests per second ====== LRANGE_100 (first 100 elements) ====== 100000 requests completed in 5.63 seconds 4 parallel clients 3 bytes payload keep alive: 1 99.98% <= 1 milliseconds 99.99% <= 2 milliseconds 99.99% <= 3 milliseconds 100.00% <= 3 milliseconds 17761.99 requests per second ====== LRANGE_300 (first 300 elements) ====== 100000 requests completed in 11.27 seconds 4 parallel clients 3 bytes payload keep alive: 1 99.48% <= 1 milliseconds 99.69% <= 2 milliseconds 99.87% <= 3 milliseconds 99.98% <= 4 milliseconds 100.00% <= 5 milliseconds 100.00% <= 6 milliseconds 100.00% <= 6 milliseconds 8876.26 requests per second ====== LRANGE_500 (first 450 elements) ====== 100000 requests completed in 13.19 seconds 4 parallel clients 3 bytes payload keep alive: 1 98.89% <= 1 milliseconds 99.44% <= 2 milliseconds 99.66% <= 3 milliseconds 99.90% <= 4 milliseconds 99.97% <= 5 milliseconds 100.00% <= 7 milliseconds 100.00% <= 7 milliseconds 7583.23 requests per second ====== LRANGE_600 (first 600 elements) ====== 100000 requests completed in 17.35 seconds 4 parallel clients 3 bytes payload keep alive: 1 99.67% <= 1 milliseconds 99.97% <= 2 milliseconds 99.98% <= 3 milliseconds 100.00% <= 4 milliseconds 5764.69 requests per second ====== MSET (10 keys) ====== 100000 requests completed in 4.56 seconds 4 parallel clients 3 bytes payload keep alive: 1 100.00% <= 3 milliseconds 100.00% <= 3 milliseconds 21939.45 requests per second
最差的是LRANGE_600 ,5764.69 requests per second
主机监控
另外,CPU load和Memory usage基本上没什么变化。
结论:
redis set,get等类操作,能到到2w吞吐量。
不同的操作类型,对CPU的影响也不同。
奇怪,redis对内存需求较稳定。
创新互联www.cdcxhl.cn,专业提供香港、美国云服务器,动态BGP最优骨干路由自动选择,持续稳定高效的网络助力业务部署。公司持有工信部办法的idc、isp许可证, 机房独有T级流量清洗系统配攻击溯源,准确进行流量调度,确保服务器高可用性。佳节活动现已开启,新人活动云服务器买多久送多久。