YCSB工作负载工具测试redis

下载redis:

wget http://download.redis.io/releases/redis-5.0.4.tar.gz
tar xzf redis-5.0.4.tar.gz
cd redis-5.0.4
make

启动redis:

cd src/
./redis-server

显示以下表示启动成功:

18397:M 31 Mar 2019 03:50:27.642 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 5.0.4 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 18397
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

18397:M 31 Mar 2019 03:50:27.642 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value 
of 128.18397:M 31 Mar 2019 03:50:27.643 # Server initialized
18397:M 31 Mar 2019 03:50:27.643 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.over
commit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.18397:M 31 Mar 2019 03:50:27.643 

使用YCSB测试redis首先进行load操作:

bin/ycsb load redis -s -P workloads/workloada -p "redis.host=127.0.0.1" -p "redis.port=6379"

我们在Redis中就能看到1000条数据,因为workloada中定义了recordcount=1000。每一个key都是hash类型,我们可以重执行上面的命令,redis改为basicbasic是一种dummy客户端,实际并不操作任何数据库,而是将YCSB对数据库的各种操作的key-value输出到控制台,这样我们就能看到这些key-value是怎么插入到Redis的,value都是什么样子的了。

使用YCSB测试redis然后进行run操作:

bin/ycsb run redis -s -P workloads/workloada -p "redis.host=127.0.0.1" -p "redis.port=6379"  -threads 128 -p "operationcount=10000" -p "measurementtype=timeseries"  -p "timeseries.granularity=5000"

-threads是模拟的线程数,-p是传入的参数,可以是客户端的参数,可以是YCSB内部组件的参数,例如measurementtype会配置Measurements输出时间序列而不是直方图,也可以覆盖workload文件中预定义的参数,例如上面的operationcount。还有一个常用的参数是-target,指的是每秒最大操作数,当一秒内到达这个阈值,线程就会休眠1毫秒。

./bin/ycsb [load|run] DATABASE -P WORKLOAD -p key=value -s -target n -threads n

 

你可能感兴趣的:(数据库,ycsb)