redis自带一个很好的基准测试工具,记录一下测试效果,欢迎拍砖。我发现一个奇怪的情况,一些关于开源工具的博客,很少描述当时主机的一些情况,没有主机部分数据的记录,是有些不太完整的。
环境介绍
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对内存需求较稳定。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。