简体   繁体   English

Redis集群基准测试

[英]Redis-cluster benchmarking

What is the right way to benchmark the redis-cluster(released recently in 3.0 RC). 什么是基准测试redis-cluster(最近在3.0 RC中发布)的正确方法。 AFAIK, redis-benchmark utility hits only one node of the cluster. AFAIK,redis-benchmark实用程序仅命中群集的一个节点。

EDIT:(Details) My single instance of redis without any clustering gives a throughput of ~90 k set/get operations but the cluster setup fails big time. 编辑:(详细信息)我的redis实例没有任何群集,其吞吐量约为90 k set / get操作,但是群集设置大量时间失败。

SETUP 1: 8 core machine running a cluster of 3 masters+ 3 slaves(all on the same machine) I also run 3 benchmarking utilities on the same machine. 设置1:8台核心计算机,运行3个主节点+ 3个从节点的集群(都在同一台计算机上)我也在同一台计算机上运行3个基准测试实用程序。 The throughput drops to 25 k on each master node. 每个主节点上的吞吐量下降到25 k。

This makes me think that I am, perhaps, running one too many processes for the number of cores on my machine. 这使我认为我可能正在为我的计算机上的内核数量运行过多的进程。

Setup 2: I update the setup to have 3 Masters and 0 slaves. 设置2:我将设置更新为3个主设备和0个从设备。 Interestingly, this doesn't help the case either and the throughput is still 25 k on each machine 有趣的是,这也无济于事,每台机器的吞吐量仍为25 k

The benchmarking command that I am running is: redis-benchmark -p 7000 -n 10000000 -t set,get 我正在运行的基准测试命令是:redis-benchmark -p 7000 -n 10000000 -t set,get

Any help on this front would be appreciated. 在这方面的任何帮助将不胜感激。

As Josiah said, you are getting 2/3 errors. 正如Josiah所说,您将收到2/3的错误。 So to benchmark in the proper way, identify a key which is surely in each node (just connect with redis-cli and use GET/SET brute forcing names). 因此,为了以适当的方式进行基准测试,请确定一个肯定在每个节点中的密钥(只需与redis-cli连接并使用GET / SET蛮力名称)。 Then use redis-benchmark using the key you found to be, for example, in node A, as an hash tag in order to generate only keys that will hash to that node. 然后,使用redis-benchmark(使用在节点A中发现的密钥)作为哈希标签,以便仅生成将散列到该节点的密钥。 So you can do: 因此,您可以执行以下操作:

redis-benchmark -r 100000 -n 1000000 set 'key{your_hash_tag}:__rand_int__' __rand_int__

This way you'll generate different 100k random keys with names that will hash to the node you are testing. 这样,您将生成不同的100k随机密钥,其名称将散列到要测试的节点。 In the example above your_hash_tag is just the key name you found to be in the node you are testing. 在上面的示例中, your_hash_tag只是您在测试节点中发现的密钥名称。

First, it is not clear to me that you are actually benchmarking multiple Redis cluster masters with your description. 首先,我不清楚您实际上是根据自己的描述对多个Redis集群主服务器进行基准测试。 You state, "The benchmarking command that I am running is: redis-benchmark -p 7000 -n 10000000 -t set,get". 您说:“我正在运行的基准测试命令是:redis-benchmark -p 7000 -n 10000000 -t set,get”。 That will only actually benchmark a single Redis cluster master, specifically the one at port 7000. If you want to benchmark other servers, you have to provide different port numbers when running redis-benchmark multiple times (using the -p option). 这实际上只会对单个Redis群集主服务器进行基准测试,特别是对端口7000上的主机进行基准测试。如果要对其他服务器进行基准测试,则在多次运行redis-benchmark时(使用-p选项)必须提供不同的端口号。

Now, even if you do run different commands to hit the different master servers for your cluster, roughly 2/3 of the commands that you perform will result in errors instead of normal command execution simply because the redis-benchmark command is sending commands to a cluster server, and that cluster server does not necessarily hold the shards for the keys that are being operated on. 现在,即使您确实运行了不同的命令来访问群集的不同主服务器,执行的命令中大约有2/3也会导致错误,而不是正常的命令执行,这仅仅是因为redis-benchmark命令正在将命令发送到服务器。群集服务器,并且该群集服务器不一定拥有要操作的密钥的分片。

But what you have really highlighted is that there doesn't seem to be a readily-available solution for benchmarking Redis cluster. 但是,您真正要强调的是,似乎还没有一个易于使用的解决方案来对Redis集群进行基准测试。 A proper benchmark would need to figure out which shards are where, calculate keys to operate on based on the servers and shards, then finally send commands to perform the benchmark, but also raise an error if a shard moves during the benchmark. 一个适当的基准将需要弄清楚哪个分片在哪里,根据服务器和分片计算要操作的密钥,然后最终发送命令执行基准,但是如果分片在基准期间移动,也会引发错误。 As far as I know, the software to do this does not yet exist. 据我所知,执行此操作的软件尚不存在。

Updating this thread with my own answer so as not to leave the answer buried under the comments. 用我自己的答案更新此主题,以免将答案埋在评论中。 When benchmarking the cluster, care must be taken to distribute the 'redis-benchmark' utility. 对群集进行基准测试时,必须注意分发“ redis-benchmark”实用程序。 Running them all from the same machine, and even worse from the same machine running the redis cluster, is a good way to lower the throughput. 在同一台机器上运行它们,甚至在运行Redis集群的同一台机器上运行它们,甚至是降低吞吐量的好方法。 Running the 'redis-benchmark's from a different machine solved the throughput issue for me. 从另一台机器上运行“ redis-benchmark”对我来说解决了吞吐量问题。 Also, as antirez pointed out, one should send the right keys to each node so that you are not dealing with 2/3 errors. 同样,正如antirez所指出的,应该将正确的密钥发送给每个节点,以免您处理2/3错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM