zoukankan      html  css  js  c++  java
  • redis-benchmark性能测试

    Redis 包含redis-benchmark模拟 N 个客户端同时发送 M 个查询执行的运行命令实用程序

    Usage: redis-benchmark [-h <host>] [-p <port>] [-c <clients>] [-n <requests]> [-k <boolean>]
    
     -h <hostname>      Server hostname (default 127.0.0.1)
     -p <port>          Server port (default 6379)
     -s <socket>        Server socket (overrides host and port)
     -a <password>      Password for Redis Auth
     -c <clients>       Number of parallel connections (default 50)
     -n <requests>      Total number of requests (default 100000)
     -d <size>          Data size of SET/GET value in bytes (default 2)
     --dbnum <db>       SELECT the specified db number (default 0)
     -k <boolean>       1=keep alive 0=reconnect (default 1)
     -r <keyspacelen>   Use random keys for SET/GET/INCR, random values for SADD
      Using this option the benchmark will expand the string __rand_int__
      inside an argument with a 12 digits number in the specified range
      from 0 to keyspacelen-1. The substitution changes every time a command
      is executed. Default tests use this to hit random keys in the
      specified range.
     -P <numreq>        Pipeline <numreq> requests. Default 1 (no pipeline).
     -q                 Quiet. Just show query/sec values
     --csv              Output in CSV format
     -l                 Loop. Run the tests forever
     -t <tests>         Only run the comma separated list of tests. The test
                        names are the same as the ones produced as output.
     -I                 Idle mode. Just open N idle connections and wait.

    可选参数

    选项 描述 默认值
    -h <hostname> 服务器主机名 127.0.0.1
    -p <port> 服务器端口 6379
    -s <socket> 服务器套接字  
    -a <password> Redis 身份验证的密码  
    -c <clients> 并行连接数 50
    -n <requests> 请求总数 100000
    -d <size> SET/GET 值的数据大小(以字节为单位) 2
    --dbnum <db> 选择指定的数据库编号 0
    -k <boolean> 1=保持活动状态 0=重新连接 1
    -r <keyspacelen>

    SET/GET/INCR 使用随机键,SADD 使用随机值

     
    -P <numreq> 管道 <numreq> 请求 1(无管道)
    -q 安静 (只显示查询/秒值)  
    --csv 以 CSV 格式输出  
    -l(L 的小写字母 循环 (永远运行测试)  
    -t <tests> 只运行逗号分隔的测试列表  
    -I(i 的大写字母 空闲模式(只需打开 N 个空闲连接并等待)  

    压测

    redis-benchmark -h 127.0.0.1 -p 6379 -c 50 -n 10000

    压测多个命令(get、set、incr、lpush......)

    redis-benchmark -h 127.0.0.1 -p 6379 -c 50 -n 10000 -t get

    压测单个命令

    redis-benchmark -q -n 10000

    安静 (只显示查询/秒值)

    可以测试命令:

    PING_INLINE
    PING_MBULK

    SET:设置
    GET:获取
    INCR:增一
    LPUSH:添加到列表头
    RPUSH:添加到列表尾
    LPOP:移除并返回列表头
    RPOP:移除并返回列表尾
    SADD:将member添加集合set中,如果已经存在于集合中不添加
    HSET:
    SPOP:
    ZADD: 
    ZPOPMIN: 
    LPUSH (needed to benchmark LRANGE): 
    LRANGE_100 (first 100 elements): 
    LRANGE_300 (first 300 elements): 
    LRANGE_500 (first 500 elements): 
    LRANGE_600 (first 600 elements): 

  • 相关阅读:
    一. js高级(1)-面向对象编程
    tips01- 定位
    h5c3 part6 flex
    h5c3 part5 background and transform
    template and pagination
    h5c3 part4
    h5c3 part3
    h5c3 part2
    h5c3 part1
    学习博客
  • 原文地址:https://www.cnblogs.com/WarBlog/p/15188992.html
Copyright © 2011-2022 走看看