当前位置: 首页 > 工具软件 > COSBench > 使用案例 >

Cosbench对象存储测试

西门胜涝
2023-12-01

1、介绍

cosbench - Cloud Object Storage Beachmark,是Intel开发的一个对象存储基准性能测试工具,支持OpenStack* Swift, Amazon* S3, Amplidata v2.3, 2.5 and 3.1, Scality*, Ceph, CDMI,Google* Cloud Storage, Aliyun OSS对象存储。
组件:
cosbench可以联机测试,主要有以下两个关键组件:
driver
cosbench负载生成器,主要负责工作负载生成,发布针对云对象存储的操作和收集性能统计信息
可以通过http://{driver-ip}:18088/driver地址访问
controller
cosbench控制器,主要负责协调负载生成器共同执行工作负载,收集来自负载生成器的基准性能测试结果
可以通过http://{controller-ip}:19088/controller地址访问
注:controller和driver角色可以部署在同一个节点上

2、安装

(1)安装jre
下载jre版本包,解压缩至/opt目录下

wget https://javadl.oracle.com/webapps/download/AutoDL?BundleId=242050_3d5a2bb8f8d4428bbe94aed7ec7ae784 -O  jre-8u251-linux-x64.tar.gz
tar -zxvf jre-8u251-linux-x64.tar.gz -C /opt/

配置jre环境变量

echo "export JAVA_HOME=/opt/jre1.8.0_251/" >> /etc/profile
echo "export CLASSPATH=/opt/jre1.8.0_251/lib" >> /etc/profile
echo "export PATH=/opt/jre1.8.0_251/bin:$PATH" >> /etc/profile
source /etc/profile

(2)安装nmap-ncat
controller和driver之间通信需要依赖nc环境
执行yum install -y nmap-ncat命令在线安装ncat包

yum install -y nmap-ncat

(3)安装curl
通常情况下,系统默认已经安装curl包
如系统未安装,可通过yum install curl -y命令在线安装
(4)安装cosbench
链接:https://pan.baidu.com/s/1DeJGwnCDLi-hQ37lnRSayg
提取码:tdme
免安装,直接解压后即可。
(5)其它
①关闭防火墙
②开放指定端口18089、18088、19089、19088
#开放driver角色服务端口

firewall-cmd --zone=public --add-port=18088/tcp --permanent
firewall-cmd --zone=public --add-port=18089/tcp --permanent
systemctl reload firewalld

#开放controller角色服务端口

firewall-cmd --zone=public --add-port=19088/tcp --permanent
firewall-cmd --zone=public --add-port=19089/tcp --permanent
systemctl reload firewalld

3、开始测试

(1)controller配置
修改conf/controller.conf文件如下,填入四台压力机的压测IP;

[controller]
drivers = 4
log_level = INFO
log_file = log/system.log
archive_dir = archive

[driver1]
name = driver1
url = http://192.168.200.153:18088/driver

[driver2]
name = driver2
url = http:// 192.168.200.157:18088/driver

[driver3]
name = driver3
url = http:// 192.168.200.158:18088/driver

[driver4]
name = driver4
url = http:// 192.168.200.159:18088/driver

(2)配置ntp服务:需要与第一台被测机保持时间同步;
(3)在0.4.2.c4目录下,执行chmod +x *.sh命令;
(4)将修改好的0.4.2.c4整个目录从第一台压力机通过scp传给其它三台压力机节点;
(5)在第二台到第四台压力机的0.4.2.c4目录下,分别执行./start-driver.sh。在第一台压力机执行./start-all.sh;
(6)在浏览器中打开http://192.168.3.153:19088/controller/网页(192.168.3.153为第一台压力机的管理IP,外部可访问的),显示内容如下则代表配置成功。
(7)配置测试脚本
对put-8works-25Workers-32w4MB-32bucket.txt测试脚本进行修改。cosbench测试时需要在测试脚本文件中添加accesskay、secretkey、endpoint,其中accesskay、secretkey是生成uid为s3时产生的Key值,可通过radosgw-admin user info --uid=s3来查询。endpoint对应着每台集群节点(被测机)以及端口号;
正式跑之前先执行del脚本,多执行几遍。
del-8works-25Workers-32w4MB-32bucket.txt脚本:

   <?xml version="1.0" encoding="UTF-8" ?>
<workload name="del_25Workers_32w4MB" description="sample benchmark for s3">
    <workflow>
    <workstage name="del_25Workers_32w4MB">
        <work name="test1" workers="25" totalOps="40000" driver="driver1">
            <storage type="s3" config="timeout=300000;accesskey=4PPX8WL1N41CD0OFQSIB;secretkey=2KRL36APSTPzaFS3IPTZZg0VDS8XdmyDhMlsA6zE;endpoint=http://192.168.200.140:10000/;retry=3" />
            <operation type="delete" ratio="100" config="cprefix=bucket;oprefix=25wks_4M;containers=c(0,3);objects=s(1,40000);sizes=c(4)MB" />
        </work>
		<work name="test21" workers="25" totalOps="40000" driver="driver1">
            <storage type="s3" config="timeout=300000;accesskey=4PPX8WL1N41CD0OFQSIB;secretkey=2KRL36APSTPzaFS3IPTZZg0VDS8XdmyDhMlsA6zE;endpoint=http://192.168.200.140:10001/;retry=3" />
            <operation type="delete" ratio="100" config="cprefix=bucket;oprefix=25wks_4M;containers=c(4,7);objects=s(40001,80000);sizes=c(4)MB" />
        </work>
        <work name="test31" workers="25" totalOps="40000" driver="driver2">
            <storage type="s3" config="timeout=300000;accesskey=4PPX8WL1N41CD0OFQSIB;secretkey=2KRL36APSTPzaFS3IPTZZg0VDS8XdmyDhMlsA6zE;endpoint=http://192.168.200.141:10000/;retry=3" />
            <operation type="delete" ratio="100" config="cprefix=bucket;oprefix=25wks_4M;containers=c(8,11);objects=s(80001,120000);sizes=c(4)MB" />
        </work>
		<work name="test41" workers="25" totalOps="40000" driver="driver2">
            <storage type="s3" config="timeout=300000;accesskey=4PPX8WL1N41CD0OFQSIB;secretkey=2KRL36APSTPzaFS3IPTZZg0VDS8XdmyDhMlsA6zE;endpoint=http://192.168.200.141:10001/;retry=3" />
            <operation type="delete" ratio="100" config="cprefix=bucket;oprefix=25wks_4M;containers=c(12,15);objects=s(120001,160000);sizes=c(4)MB" />
        </work>	
        <work name="test51" workers="25" totalOps="40000" driver="driver3">
            <storage type="s3" config="timeout=300000;accesskey=4PPX8WL1N41CD0OFQSIB;secretkey=2KRL36APSTPzaFS3IPTZZg0VDS8XdmyDhMlsA6zE;endpoint=http://192.168.200.142:10000/;retry=3" />
            <operation type="delete" ratio="100" config="cprefix=bucket;oprefix=25wks_4M;containers=c(16,19);objects=s(160001,200000);sizes=c(4)MB" />
        </work>
		<work name="test61" workers="25" totalOps="40000" driver="driver3">
            <storage type="s3" config="timeout=300000;accesskey=4PPX8WL1N41CD0OFQSIB;secretkey=2KRL36APSTPzaFS3IPTZZg0VDS8XdmyDhMlsA6zE;endpoint=http://192.168.200.142:10001/;retry=3" />
            <operation type="delete" ratio="100" config="cprefix=bucket;oprefix=25wks_4M;containers=c(20,23);objects=s(200001,240000);sizes=c(4)MB" />
        </work>
			 <work name="test71" workers="25" totalOps="40000" driver="driver4">
		            <storage type="s3" config="timeout=300000;accesskey=4PPX8WL1N41CD0OFQSIB;secretkey=2KRL36APSTPzaFS3IPTZZg0VDS8XdmyDhMlsA6zE;endpoint=http://192.168.200.143:10000/;retry=3" />
		            <operation type="delete" ratio="100" config="cprefix=bucket;oprefix=25wks_4M;containers=c(24,27);objects=s(240001,280000);sizes=c(4)MB" />
		        </work>
		<work name="test81" workers="25" totalOps="40000" driver="driver4">
            <storage type="s3" config="timeout=300000;accesskey=4PPX8WL1N41CD0OFQSIB;secretkey=2KRL36APSTPzaFS3IPTZZg0VDS8XdmyDhMlsA6zE;endpoint=http://192.168.200.143:10001/;retry=3" />
            <operation type="delete" ratio="100" config="cprefix=bucket;oprefix=25wks_4M;containers=c(28,31);objects=s(280001,320000);sizes=c(4)MB" />
        </work>
    </workstage>
    </workflow>
</workload>

put-8works-25Workers-32w4MB-32bucket.txt脚本:

<?xml version="1.0" encoding="UTF-8" ?>
<workload name="put_25Workers_32w4MB" description="sample benchmark for s3">
    <workflow>
    <workstage name="put_25Workers_32w4MB">
        <work name="test1" workers="25" totalOps="40000" driver="driver1">
            <storage type="s3" config="timeout=300000;accesskey=4PPX8WL1N41CD0OFQSIB;secretkey=2KRL36APSTPzaFS3IPTZZg0VDS8XdmyDhMlsA6zE;endpoint=http://192.168.200.140:10000/;retry=3" />
            <operation type="write" ratio="100" config="cprefix=bucket;oprefix=25wks_4M;containers=c(0,3);objects=s(1,40000);sizes=c(4)MB" />
        </work>
		<work name="test21" workers="25" totalOps="40000" driver="driver1">
            <storage type="s3" config="timeout=300000;accesskey=4PPX8WL1N41CD0OFQSIB;secretkey=2KRL36APSTPzaFS3IPTZZg0VDS8XdmyDhMlsA6zE;endpoint=http://192.168.200.140:10001/;retry=3" />
            <operation type="write" ratio="100" config="cprefix=bucket;oprefix=25wks_4M;containers=c(4,7);objects=s(40001,80000);sizes=c(4)MB" />
        </work>
        <work name="test31" workers="25" totalOps="40000" driver="driver2">
            <storage type="s3" config="timeout=300000;accesskey=4PPX8WL1N41CD0OFQSIB;secretkey=2KRL36APSTPzaFS3IPTZZg0VDS8XdmyDhMlsA6zE;endpoint=http://192.168.200.141:10000/;retry=3" />
            <operation type="write" ratio="100" config="cprefix=bucket;oprefix=25wks_4M;containers=c(8,11);objects=s(80001,120000);sizes=c(4)MB" />
        </work>
		<work name="test41" workers="25" totalOps="40000" driver="driver2">
            <storage type="s3" config="timeout=300000;accesskey=4PPX8WL1N41CD0OFQSIB;secretkey=2KRL36APSTPzaFS3IPTZZg0VDS8XdmyDhMlsA6zE;endpoint=http://192.168.200.141:10001/;retry=3" />
            <operation type="write" ratio="100" config="cprefix=bucket;oprefix=25wks_4M;containers=c(12,15);objects=s(120001,160000);sizes=c(4)MB" />
        </work>	
        <work name="test51" workers="25" totalOps="40000" driver="driver3">
            <storage type="s3" config="timeout=300000;accesskey=4PPX8WL1N41CD0OFQSIB;secretkey=2KRL36APSTPzaFS3IPTZZg0VDS8XdmyDhMlsA6zE;endpoint=http://192.168.200.142:10000/;retry=3" />
            <operation type="write" ratio="100" config="cprefix=bucket;oprefix=25wks_4M;containers=c(16,19);objects=s(160001,200000);sizes=c(4)MB" />
        </work>
		<work name="test61" workers="25" totalOps="40000" driver="driver3">
            <storage type="s3" config="timeout=300000;accesskey=4PPX8WL1N41CD0OFQSIB;secretkey=2KRL36APSTPzaFS3IPTZZg0VDS8XdmyDhMlsA6zE;endpoint=http://192.168.200.142:10001/;retry=3" />
            <operation type="write" ratio="100" config="cprefix=bucket;oprefix=25wks_4M;containers=c(20,23);objects=s(200001,240000);sizes=c(4)MB" />
        </work>
			 <work name="test71" workers="25" totalOps="40000" driver="driver4">
		            <storage type="s3" config="timeout=300000;accesskey=4PPX8WL1N41CD0OFQSIB;secretkey=2KRL36APSTPzaFS3IPTZZg0VDS8XdmyDhMlsA6zE;endpoint=http://192.168.200.143:10000/;retry=3" />
		            <operation type="write" ratio="100" config="cprefix=bucket;oprefix=25wks_4M;containers=c(24,27);objects=s(240001,280000);sizes=c(4)MB" />
		        </work>
		<work name="test81" workers="25" totalOps="40000" driver="driver4">
            <storage type="s3" config="timeout=300000;accesskey=4PPX8WL1N41CD0OFQSIB;secretkey=2KRL36APSTPzaFS3IPTZZg0VDS8XdmyDhMlsA6zE;endpoint=http://192.168.200.143:10001/;retry=3" />
            <operation type="write" ratio="100" config="cprefix=bucket;oprefix=25wks_4M;containers=c(28,31);objects=s(280001,320000);sizes=c(4)MB" />
        </work>
    </workstage>
    </workflow>
</workload>

(8)正式压测
在浏览器中打开http://192.168.3.153:19088/controller/网页(192.168.3.153为第一台压力机的管理IP,外部可访问的)。
然后点击submit new workloads按钮,提交修改好的put-8works-25Workers-32w4MB-32bucket.txt。开始压测。

 类似资料: