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-h192.168.163.156-p6379-c4-n10000======PING_INLINE======10000requestscompletedin0.46seconds4parallelclients3bytespayloadkeepalive:199.77%<=1milliseconds99.98%<=2milliseconds100.00%<=2milliseconds21598.27requestspersecond======PING_BULK======10000requestscompletedin0.42seconds4parallelclients3bytespayloadkeepalive:1100.00%<=0milliseconds23696.68requestspersecond======SET======10000requestscompletedin0.43seconds4parallelclients3bytespayloadkeepalive:1100.00%<=0milliseconds23364.49requestspersecond======GET======10000requestscompletedin0.44seconds4parallelclients3bytespayloadkeepalive:199.95%<=1milliseconds100.00%<=1milliseconds22935.78requestspersecond======INCR======10000requestscompletedin0.43seconds4parallelclients3bytespayloadkeepalive:1100.00%<=0milliseconds23201.86requestspersecond======LPUSH======10000requestscompletedin0.42seconds4parallelclients3bytespayloadkeepalive:1100.00%<=0milliseconds23923.45requestspersecond======RPUSH======10000requestscompletedin0.43seconds4parallelclients3bytespayloadkeepalive:1100.00%<=0milliseconds23148.15requestspersecond======LPOP======10000requestscompletedin0.44seconds4parallelclients3bytespayloadkeepalive:1100.00%<=1milliseconds22883.29requestspersecond======RPOP======10000requestscompletedin0.44seconds4parallelclients3bytespayloadkeepalive:1100.00%<=0milliseconds22883.29requestspersecond======SADD======10000requestscompletedin0.43seconds4parallelclients3bytespayloadkeepalive:199.97%<=1milliseconds100.00%<=1milliseconds23148.15requestspersecond======SPOP======10000requestscompletedin0.43seconds4parallelclients3bytespayloadkeepalive:1100.00%<=0milliseconds23474.18requestspersecond======LPUSH(neededtobenchmarkLRANGE)======10000requestscompletedin0.42seconds4parallelclients3bytespayloadkeepalive:1100.00%<=0milliseconds23640.66requestspersecond======LRANGE_100(first100elements)======10000requestscompletedin0.60seconds4parallelclients3bytespayloadkeepalive:199.85%<=2milliseconds99.91%<=3milliseconds100.00%<=3milliseconds16666.67requestspersecond======LRANGE_300(first300elements)======10000requestscompletedin1.07seconds4parallelclients3bytespayloadkeepalive:1100.00%<=1milliseconds9337.07requestspersecond======LRANGE_500(first450elements)======10000requestscompletedin1.27seconds4parallelclients3bytespayloadkeepalive:199.88%<=1milliseconds99.97%<=2milliseconds100.00%<=2milliseconds7849.29requestspersecond======LRANGE_600(first600elements)======10000requestscompletedin1.64seconds4parallelclients3bytespayloadkeepalive:199.72%<=1milliseconds100.00%<=1milliseconds6101.28requestspersecond======MSET(10keys)======10000requestscompletedin0.46seconds4parallelclients3bytespayloadkeepalive:1100.00%<=0milliseconds21978.02requestspersecond

LRANGE_600 (first 600 elements) 性能最差,6101.28 requests per second


2.请求两10w,并发数为4

[root@hadoop1zabbix]#/usr/local/redis/bin/redis-benchmark-h192.168.163.156-p6379-c4-n100000======PING_INLINE======100000requestscompletedin4.40seconds4parallelclients3bytespayloadkeepalive:199.94%<=1milliseconds99.98%<=2milliseconds99.99%<=3milliseconds100.00%<=3milliseconds22742.78requestspersecond======PING_BULK======100000requestscompletedin4.29seconds4parallelclients3bytespayloadkeepalive:1100.00%<=1milliseconds100.00%<=1milliseconds23288.31requestspersecond======SET======100000requestscompletedin4.38seconds4parallelclients3bytespayloadkeepalive:1100.00%<=0milliseconds22857.14requestspersecond======GET======100000requestscompletedin4.41seconds4parallelclients3bytespayloadkeepalive:199.99%<=1milliseconds99.99%<=2milliseconds100.00%<=3milliseconds100.00%<=3milliseconds22665.46requestspersecond======INCR======100000requestscompletedin4.67seconds4parallelclients3bytespayloadkeepalive:199.95%<=1milliseconds99.98%<=2milliseconds99.99%<=3milliseconds100.00%<=3milliseconds21422.45requestspersecond======LPUSH======100000requestscompletedin4.30seconds4parallelclients3bytespayloadkeepalive:199.99%<=1milliseconds100.00%<=2milliseconds100.00%<=3milliseconds100.00%<=3milliseconds23239.60requestspersecond======RPUSH======100000requestscompletedin4.33seconds4parallelclients3bytespayloadkeepalive:199.99%<=1milliseconds100.00%<=4milliseconds100.00%<=4milliseconds23105.36requestspersecond======LPOP======100000requestscompletedin4.35seconds4parallelclients3bytespayloadkeepalive:199.99%<=1milliseconds100.00%<=2milliseconds100.00%<=6milliseconds100.00%<=6milliseconds22993.79requestspersecond======RPOP======100000requestscompletedin4.38seconds4parallelclients3bytespayloadkeepalive:199.99%<=1milliseconds100.00%<=1milliseconds22836.26requestspersecond======SADD======100000requestscompletedin4.45seconds4parallelclients3bytespayloadkeepalive:199.99%<=1milliseconds99.99%<=2milliseconds100.00%<=2milliseconds22461.81requestspersecond======SPOP======100000requestscompletedin4.39seconds4parallelclients3bytespayloadkeepalive:1100.00%<=1milliseconds100.00%<=1milliseconds22773.86requestspersecond======LPUSH(neededtobenchmarkLRANGE)======100000requestscompletedin4.53seconds4parallelclients3bytespayloadkeepalive:199.99%<=1milliseconds99.99%<=2milliseconds100.00%<=2milliseconds22094.56requestspersecond======LRANGE_100(first100elements)======100000requestscompletedin5.63seconds4parallelclients3bytespayloadkeepalive:199.98%<=1milliseconds99.99%<=2milliseconds99.99%<=3milliseconds100.00%<=3milliseconds17761.99requestspersecond======LRANGE_300(first300elements)======100000requestscompletedin11.27seconds4parallelclients3bytespayloadkeepalive:199.48%<=1milliseconds99.69%<=2milliseconds99.87%<=3milliseconds99.98%<=4milliseconds100.00%<=5milliseconds100.00%<=6milliseconds100.00%<=6milliseconds8876.26requestspersecond======LRANGE_500(first450elements)======100000requestscompletedin13.19seconds4parallelclients3bytespayloadkeepalive:198.89%<=1milliseconds99.44%<=2milliseconds99.66%<=3milliseconds99.90%<=4milliseconds99.97%<=5milliseconds100.00%<=7milliseconds100.00%<=7milliseconds7583.23requestspersecond======LRANGE_600(first600elements)======100000requestscompletedin17.35seconds4parallelclients3bytespayloadkeepalive:199.67%<=1milliseconds99.97%<=2milliseconds99.98%<=3milliseconds100.00%<=4milliseconds5764.69requestspersecond======MSET(10keys)======100000requestscompletedin4.56seconds4parallelclients3bytespayloadkeepalive:1100.00%<=3milliseconds100.00%<=3milliseconds21939.45requestspersecond

最差的是LRANGE_600 ,5764.69 requests per second


主机监控

另外,CPU load和Memory usage基本上没什么变化。

结论:

redis set,get等类操作,能到到2w吞吐量。

不同的操作类型,对CPU的影响也不同。

奇怪,redis对内存需求较稳定。