akyou56 发表于 2018-11-7 06:50:13

使用Redis-benchmark为Redis性能测试

  Redis-benchmark为Redis性能测试工具。
  指令说明:
  Usage: redis-benchmark [-h ] [-p ] [-c ] [-n[-k ]
  -h       Server hostname (default 127.0.0.1)
  -p         Server port (default 6379)
  -s         Server socket (overrides host and port)
  -c      Number of parallel connections (default 50)
  -n       Total number of requests (default 10000)

  -d         Data>  -k      1=keep alive 0=reconnect (default 1)
  -r    Use random keys for SET/GET/INCR, random values for SADD
  Using this option the benchmark will get/set keys
  in the form mykey_rand:000000012456 instead of constant
  keys, theargument determines the max
  number of values for the random number. For instance
  if set to 10 only rand:000000000000 - rand:000000000009
  range will be allowed.
  -P         Pipelinerequests. Default 1 (no pipeline).
  -q               Quiet. Just show query/sec values 只显示每秒钟能处理多少请求数结果
  --csv            Output in CSV format
  -l               Loop. Run the tests forever 永久测试
  -t          Only run the comma separated list of tests. The test
  names are the same as the ones produced as output.

  -I                >  实例:
  redis-benchmark -h 127.0.0.1 -p 6379 -q -d 100
  SET/GET 100 bytes 检测host为127.0.0.1 端口为6379的redis服务器性能
  redis-benchmark -h 127.0.0.1 -p 6379 -c 5000 -n 100000
  5000个并发连接,100000个请求,检测host为127.0.0.1 端口为6379的redis服务器性能
  benchmark工具测试信息:
  测试命令:
  redis-benchmark -n 100000 -c 60
  向redis服务器发送100000个请求,每个请求附带60个并发客户端
  结果(部分):
  ====== SET ======
  对集合写入测试
  100000 requests completed in 2.38 seconds
  100000个请求在2.38秒内完成
  60 parallel clients
  每次请求有60个并发客户端
  3 bytes payload
  每次写入3个字节的数据
  keep alive: 1
  保持一个连接,一台服务器来处理这些请求
  93.06%
页: [1]
查看完整版本: 使用Redis-benchmark为Redis性能测试