Redis Benchmarks
Benchmarks
Redis Benchmarks是一个工具,检查性能的Redis运行n个命令同时。
以下是Redis基准测试的基本语法。
redis-benchmark [option] [option value]
以下示例通过调用100000命令来检查Redis。
redis-benchmark -n 100000
PING_INLINE: 141043.72 requests per second
PING_BULK: 142857.14 requests per second
SET: 141442.72 requests per second
GET: 145348.83 requests per second
INCR: 137362.64 requests per second
LPUSH: 145348.83 requests per second
LPOP: 146198.83 requests per second
SADD: 146198.83 requests per second
SPOP: 149253.73 requests per second
LPUSH (needed to benchmark LRANGE): 148588.42 requests per second
LRANGE_100 (first 100 elements): 58411.21 requests per second
LRANGE_300 (first 300 elements): 21195.42 requests per second
LRANGE_500 (first 450 elements): 14539.11 requests per second
LRANGE_600 (first 600 elements): 10504.20 requests per second
MSET (10 keys): 93283.58 requests per second
以下是Redis基准测试中的可用选项列表。
| 选项 | 描述 | 默认值 |
|---|---|---|
| -h | 指定服务器主机名 | 127.0.0.1 |
| -p | 指定服务器端口 | 6379 |
| -s | 指定服务器套接字 | |
| -c | 指定并行连接的数目 | 50 |
| -n | 指定请求的总数 | 10000 |
| -d | 指定集合/获取值的数据大小,以字节为单位 | 2 |
| -k | 1 = 保持活着,0 = 重新连接 | 1 |
| -r | SET/GET/INCR使用随机键,SADD使用随机值 | |
| -p | 管道<numreq>请求 | 1 |
| -h | 指定服务器主机名 | |
| -q | 迫使Redis安静。只显示查询/秒值 | |
| --csv | CSV格式的输出 | |
| -l | 生成循环,永远运行测试 | |
| -t | 只运行以逗号分隔的测试列表 | |
| -I | 空闲模式。只是打开N个空闲连接并等待 |
以下示例显示了Redis基准测试实用程序中的多种用法选项。
redis-benchmark -h 127.0.0.1 -p 6379 -t set,lpush -n 100000 -q
SET: 146198.83 requests per second
LPUSH: 145560.41 requests per second