← 返回命令列表

Linux command

redis-benchmark 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Run default benchmark

redis-benchmark

Connect to host

redis-benchmark -h [localhost] -p [6379]

Set client count

redis-benchmark -c [100]

Set request count

redis-benchmark -n [10000]

Test specific command

redis-benchmark -t [get,set]

Test with specific data size

redis-benchmark -d [256]

Pipeline requests

redis-benchmark -P [16]

Quiet mode

redis-benchmark -q

说明

redis-benchmark measures Redis server performance by simulating multiple clients concurrently executing various commands. By default it tests a standard set of operations including SET, GET, INCR, LPUSH, LPOP, and others, reporting requests per second for each command type. The -c flag controls the number of concurrent client connections, while -n sets the total request count. Pipelining with -P batches multiple requests per round-trip, testing raw throughput independent of network latency. The -d flag adjusts the data payload size to benchmark different workload patterns, and -t limits testing to specific commands.

参数

-h _HOST_
Server hostname.
-p _PORT_
Server port.
-c _N_
Concurrent clients.
-n _N_
Total requests.
-t _TESTS_
Test commands.
-d _SIZE_
Data size in bytes.
-P _N_
Pipeline N requests.
-q
Quiet, show query/sec.
-a _PASSWORD_
Authentication password.
--csv
CSV output.

FAQ

What is the redis-benchmark command used for?

redis-benchmark measures Redis server performance by simulating multiple clients concurrently executing various commands. By default it tests a standard set of operations including SET, GET, INCR, LPUSH, LPOP, and others, reporting requests per second for each command type. The -c flag controls the number of concurrent client connections, while -n sets the total request count. Pipelining with -P batches multiple requests per round-trip, testing raw throughput independent of network latency. The -d flag adjusts the data payload size to benchmark different workload patterns, and -t limits testing to specific commands.

How do I run a basic redis-benchmark example?

Run `redis-benchmark` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -h _HOST_ do in redis-benchmark?

Server hostname.