Redis benchmark: multithread support and cluster support#5889
Redis benchmark: multithread support and cluster support#5889antirez merged 12 commits intoredis:unstablefrom
Conversation
- MOVED or ASK replies are now handled in cluster mode. - Only the first slot per node is used in cluster mode. - Mutlithreading: reduced usage of mutexes in favor of atomic vars.
|
Aweomse! Thanks Fabio, this feature will be super useful in the future, finally folks can see the numbers Redis Cluster can provide :-D |
|
@artix75 P.S. Given that the PR description is so well put, maybe you should PR that into the redis-doc repository in the "benchmarking" documentation. |
Yeah, i agree |
Redis benchmark: multithread support and cluster support
|
|
|
In cluster mode, it will stop after the test of It should following a MSET test result like this in non-cluster mode: I guess MSET is not support in cluster mode, so it would be better if we can just skip the test. |
This PR implements support for threads and cluster into redis-benchmark.
Multi-Thread support
By default, redis-benchmark will be launched in single-thread mode as usual.
In order to launch it in multi-thread mode, you can use the
--threadsoption, ie:redis-benchmark --threads 6The command above will launch redis-benchmark with six threads.
Cluster Support
Redis benchmark can now work with clusters. This can be done by using the
--clusteroption.The redis instance which redis-benchmark will connect to will be used as the cluster entry point.
Examples:
redis-benchmark --cluster -p 7000The line above will launch redis-benchmark in cluster mode and will use the instance with port 7000 as the cluster entry point.
When launched in cluster mode, redis-benchmark will implicitly start in multi-threading mode too.
By default, it will use one thread for each master node found in the cluster.
Anyway, you're free to change this default configuration by explicitly pass the
--threadsoption, ie:redis-benchmark -p 7000 --threads 6 --cluster # If the cluster has three masters, use two threads per master nodeWhen launched in cluster mode, you can use the special
{tag}placeholder inside the key names in order to let redis-benchmark use slot hash tags, in a similar fashion of the__rand_int__placeholder.In this case, redis-benchmark will automatically replace the
{tag}placeholder with the proper slot hash tag depending on which master node is querying.Example:
redis-benchmark -p 7000 --cluster get mykey:{tag}Default redis-benchmark's tests already have the
{tag}placeholder in their key name(s).You're free to mix the
{tag}placeholder and the__rand_int__placeholder in order to be sure that every thread uses random and different keys (remember to use the-roption to enable the key name randomization).Example:
redis-benchmark -r -p 7000 --cluster get mykey:{tag}:__rand_int__When working in cluster mode, redis-benchmark will always fetch the cluster configuration before starting the test(s). Anyway, if some slot is moved during the tests (ie. because of a resharding), after receiving an "ASK/MOVED" reply error, redis-benchmark will fetch the cluster configuration again in order to update it.
The configuration update will be atomically handled by threads.