Skip to content

Redis benchmark: multithread support and cluster support#5889

Merged
antirez merged 12 commits intoredis:unstablefrom
artix75:bm_threads_cluster_dev
Mar 1, 2019
Merged

Redis benchmark: multithread support and cluster support#5889
antirez merged 12 commits intoredis:unstablefrom
artix75:bm_threads_cluster_dev

Conversation

@artix75
Copy link
Copy Markdown
Contributor

@artix75 artix75 commented Mar 1, 2019

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 --threads option, ie:

redis-benchmark --threads 6

The 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 --cluster option.
The redis instance which redis-benchmark will connect to will be used as the cluster entry point.

Examples:

redis-benchmark --cluster -p 7000

The 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 --threads option, ie:

redis-benchmark -p 7000 --threads 6 --cluster # If the cluster has three masters, use two threads per master node

When 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 -r option 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.

@antirez antirez merged commit 537d859 into redis:unstable Mar 1, 2019
@antirez
Copy link
Copy Markdown
Contributor

antirez commented Mar 1, 2019

Aweomse! Thanks Fabio, this feature will be super useful in the future, finally folks can see the numbers Redis Cluster can provide :-D

@antirez
Copy link
Copy Markdown
Contributor

antirez commented Mar 1, 2019

@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.

@artix75
Copy link
Copy Markdown
Contributor Author

artix75 commented Mar 1, 2019

@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

JackieXie168 pushed a commit to JackieXie168/redis that referenced this pull request Apr 10, 2019
Redis benchmark: multithread support and cluster support
@wmh
Copy link
Copy Markdown

wmh commented Dec 13, 2019

-a <password> is no longer available with --cluster in this patch

@artix75
Copy link
Copy Markdown
Contributor Author

artix75 commented Dec 13, 2019

-a <password> is no longer available with --cluster in this patch

@wmh See PR #6665

@wmh
Copy link
Copy Markdown

wmh commented Dec 18, 2019

In cluster mode, it will stop after the test of LRANGE_600 with an error message:

LRANGE_600 (first 600 elements): 33156.50 requests per second
Error: Server closed the connection

It should following a MSET test result like this in non-cluster mode:

LRANGE_600 (first 600 elements): 110864.74 requests per second
MSET (10 keys): 108577.63 requests per second

I guess MSET is not support in cluster mode, so it would be better if we can just skip the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants