背景:Rally是OpenStack基准测试的一款工具,集成了部署、API测试、压力测试功能,Rally测试OpenStack在并发下API的相应时间和请求成功率,从而测试出OpenStack规模和性能。
$ rally deployment create –fromenv –name=existing
$ rally deployment create –file=existing.json –name=existing
1.2 检查deployment环境
$ rally deployment check
1.3 rally任务模板
{
“args”: { },
“runner”: { },
“context”: { },
“sla”: { }
}
1.4 执行rally任务
$ rally task start rally-jobs/rally.yaml
1.5 生成测试报告
$ rally task report –out=report.html --open
1.6 其他命令
$ rally show images
$ rally show flavors
$ rally deployment list
$ rally deployment create –fromenv –name=existing
$ rally deployment create –filename=existing.json –name=existing
$ rally deployment list
$ rally deployment check
如果check成功,会返回keystone提供的service和status信息。如下所示:
[root@LIN-20161280922 .rally]# rally deployment check
keystone endpoints are valid and following services are available:
services | type | status |
---|---|---|
ceilometer | metering | Available |
cinder | volume | Available |
glance | image | Available |
heat | orchestration | Available |
keystone | identity | Available |
neutron | network | Available |
nova | compute | Available |
swift | object-store | Available |
1.2 测试案例
为了说明测试的整个过程,这里创建一个5个并发,100次请求的创建和删除用例场景,测试一下keystone压力。
首先创建任务的json文件create_delete.json如下:
{
“KeystoneBasic.create_delete_user”: [
{
“args”: {
“name_length”: 10
},
“runner”: {
“type”: “constant”,
“times”: 100,
“concurrency”: 5
}
}
]
}
使用rally进行测试:
$ rally task start create_delete.json
±------------------------------------------------------------------------------------------------------------------------+
| Response Times (sec) |
±---------------------±----------±-------------±-------------±-------------±----------±----------±--------±------+
| Action | Min (sec) | Median (sec) | 90%ile (sec) | 95%ile (sec) | Max (sec) | Avg (sec) | Success | Count |
±---------------------±----------±-------------±-------------±-------------±----------±----------±--------±------+
| keystone.create_user | 0.357 | 0.691 | 4.187 | 21.285 | 36.024 | 3.033 | 100.0% | 100 |
| keystone.delete_user | 0.125 | 0.337 | 2.759 | 3.326 | 35.895 | 1.598 | 100.0% | 100 |
| total | 0.517 | 1.477 | 16.213 | 21.512 | 36.327 | 4.632 | 100.0% | 100 |
±---------------------±----------±-------------±-------------±-------------±----------±----------±--------±------+
查看任务详情,rally跑成功之后,会生成一个task的UUID,可以通过这个task查看任务的具体信息,主要分两部分,一部分是任务相关信息,另外则是任务的执行结果,如下:
[root@LIN-20161280922 xiaxb]# rally task detailed b0657b73-e4f6-47ce-aedf-703d89c4a95c
test scenario KeystoneBasic.create_delete_user
args position 0
args values:
{
“runner”: {
“type”: “constant”,
“concurrency”: 5,
“times”: 100
},
“args”: {
“name_length”: 10
}
}
±------------------------------------------------------------------------------------------------------------------------+
| Response Times (sec) |
±---------------------±----------±-------------±-------------±-------------±----------±----------±--------±------+
| Action | Min (sec) | Median (sec) | 90%ile (sec) | 95%ile (sec) | Max (sec) | Avg (sec) | Success | Count |
±---------------------±----------±-------------±-------------±-------------±----------±----------±--------±------+
| keystone.create_user | 0.357 | 0.691 | 4.187 | 21.285 | 36.024 | 3.033 | 100.0% | 100 |
| keystone.delete_user | 0.125 | 0.337 | 2.759 | 3.326 | 35.895 | 1.598 | 100.0% | 100 |
| total | 0.517 | 1.477 | 16.213 | 21.512 | 36.327 | 4.632 | 100.0% | 100 |
±---------------------±----------±-------------±-------------±-------------±----------±----------±--------±------+
Load duration: 93.172319
Full duration: 183.385978
生成可视化的结果报告,当需要把执行结果可视化展示出来的时候,可以根据上一步生成的task的UUID号用task report命令生成可视化结果,调用命令后会在当前目录生成一个html的报告文件,用浏览器打开,就可以查看到测试结果。
[root@LIN-20161280922 xiaxb]# rally task report b0657b73-e4f6-47ce-aedf-703d89c4a95c --out create_delete.html