Hbase 测试工具

这篇文章主要介绍两种测试hbase的工具和部分参数

wrk压力测试工具

    WRK压力测试工具,这种方式可以测试前端的接口一起测试
    但是瓶颈也是前端的java接口,没有办法知道hbase真正的水平
    -t, --threads     <N>  使用多少个线程进行压测   
    -c, --connections <N>  跟服务器建立并保持的TCP连接数量  
    -d, --duration    <T>  压测时间           
    -s, --script      <S>  指定Lua脚本路径     

./wrk -t16 -c500 -d 300--latency -s data.lua url

loginmap = {}
counter = 0
function init(args)
    for line in io.lines("./idlist.csv"do
        loginmap[counter] = line
        counter = counter + 1
    end
    counter = 0
end

request = function()
        counter = counter+1
          if( counter > 0 )
          then   
             data = '{"gaid":"%s"}'
             parms = loginmap[counter-1]
             wrk.method = "POST"
             wrk.headers["Content-Type"] = "application/json"
             wrk.headers["X-Authorization"] = "Authorization"
             wrk.body = string.format(data,tostring(parms))
             print(wrk.format())
             return wrk.format()
         end
end

hbase pe

hbase预分区语句
create 'student','info',SPLITS =>
['00000000000000000050000000','00000000000000000100000000','00000000000000000150000000',
'00000000000000000200000000','00000000000000000250000000','00000000000000000300000000',
'00000000000000000350000000','00000000000000000400000000','00000000000000000450000000',
'00000000000000000500000000','00000000000000000550000000','00000000000000000600000000',
'00000000000000000650000000','00000000000000000700000000','00000000000000000750000000',
'00000000000000000800000000','00000000000000000850000000','00000000000000000900000000',
'00000000000000000950000000','00000000000000001000000000']
scan 'student',{LIMIT=>10}
hbase pe使用
    只能测试工具自己的格式的数据,暂时没有办法自定义类型,测试还是有点欠缺的
    把每一列的数据长度设置长一点,看看后面读数据效率
    hbase pe --table=student --nomapred --oneCon=true --valueSize=1000 
       --compress=NONE --rows=500000000 --presplit=20 sequentialWrite 20 
    hbase pe --table=student --nomapred --oneCon=true --valueSize=1000 --size=1  randomRead 20

    --table #表名
    --nomapred #不使用MapReduce测试,而是用多线程的方式
    --oneCon #是否开启多线程测试
    --valueSize #写入hbase value大小,默认为1024 Byte
    --compress #压缩方式
    --rows #每个线程,各种写多少行数据,
    --autoFlush #是否开启自动实时flush
    --presplit #表的region个数
    --size #总大小,单位GiB。与-- rows 互斥。默认值:1.0。  
    --sequential  random 顺序随机读写   Read Write 读写
    --最后的20代表了20个线程

    size使用这个的时候数据不是顺序增长的,进行压测的时候会请求在region上分布不均匀
    所以后来使用的时候还是改成了 rows
posted @ 2022-09-20 20:10  Kotlin  阅读(214)  评论(0编辑  收藏  举报
Live2D