OpenStack 性能测试项目Rally 部署

OpenStack 已经成为企业构建私有云的首选,部署openstack 的方式有很多种,那么如何对openstack 环境做性能评估呢?  Rally 就是你想要的测试项目。

下载安装Rally

参考 http://rally.readthedocs.org/en/latest/tutorial/step_0_installation.html

git clone https://github.com/stackforge/rally.git
./rally/install_rally.sh -v

配置测试环境

参考

http://rally.readthedocs.org/en/latest/tutorial/step_1_setting_up_env_and_running_benchmark_from_samples.html

http://rally.readthedocs.org/en/latest/tutorial/step_3_benchmarking_with_existing_users.html

rally 代码的 samples/deployments 目录下有模板可以参考

[root@localhost deployments]# pwd
/root/rally/samples/deployments
[root@localhost deployments]# ll
total 24
-rw-r--r--. 1 root root  313 Apr  8 14:52 existing.json
-rw-r--r--. 1 root root  430 Apr  8 14:52 existing-keystone-v3.json
-rw-r--r--. 1 root root  423 Apr  8 14:52 existing-with-given-endpoint.json
-rw-r--r--. 1 root root  558 Apr  8 14:52 existing-with-predefined-users.json
drwxr-xr-x. 2 root root 4096 Apr  8 14:52 for_deploying_openstack_with_rally
-rw-r--r--. 1 root root 1396 Apr  8 14:52 README.rst

我的existing.json

[root@localhost rally]# cat existing.json
{
    "type": "ExistingCloud",
    "auth_url": "http://192.168.132.53:5000/v3/",
    "region_name": "RegionOne",
    "endpoint_type": "public",
    "admin": {
        "username": "admin",
        "password": "admin",
        "tenant_name": "admin"
    },
    "https_insecure": false,
    "https_cacert": ""
}

创建deployment

[root@localhost rally]# rally deployment create --filename=existing.json --name=existing
2016-04-09 14:51:24.557 19950 INFO rally.deployment.engine [-] Deployment 301118b9-c4cc-4e60-8761-57bbdffb392e | Starting:  OpenStack cloud deployment.
2016-04-09 14:51:24.583 19950 INFO rally.deployment.engine [-] Deployment 301118b9-c4cc-4e60-8761-57bbdffb392e | Completed: OpenStack cloud deployment.
+--------------------------------------+----------------------------+----------+------------------+--------+
| uuid                                | created_at                | name    | status          | active |
+--------------------------------------+----------------------------+----------+------------------+--------+
| 301118b9-c4cc-4e60-8761-57bbdffb392e | 2016-04-09 18:51:24.549769 | existing | deploy->finished |        |
+--------------------------------------+----------------------------+----------+------------------+--------+
Using deployment: 301118b9-c4cc-4e60-8761-57bbdffb392e
~/.rally/openrc was updated

HINTS:
* To get your cloud resources, run:
        rally show [flavors|images|keypairs|networks|secgroups]

* To use standard OpenStack clients, set up your env by running:
        source ~/.rally/openrc
  OpenStack clients are now configured, e.g run:
        glance image-list

检查测试环境

[root@localhost rally]# rally deployment check
keystone endpoints are valid and following services are available:
+-------------+----------------+-----------+
| services    | type          | status    |
+-------------+----------------+-----------+
| __unknown__ | volumev2      | Available |
| ceilometer  | metering      | Available |
| cinder      | volume        | Available |
| cloud      | cloudformation | Available |
| glance      | image          | Available |
| heat        | orchestration  | Available |
| keystone    | identity      | Available |
| neutron    | network        | Available |
| nova        | compute        | Available |
+-------------+----------------+-----------+
NOTE: '__unknown__' service name means that Keystone service catalog doesn't return name for this service and Rally can not identify service by its type. BUT you still can use such services with api_versions context, specifying type of service (execute `rally plugin show api_versions` for more details).
[

测试

[root@localhost rally]# cp ./samples/tasks/scenarios/keystone/create-and-delete-user.json .
[root@localhost rally]# vi create-and-delete-user.json

{
    "KeystoneBasic.create_delete_user": [
        {
            "args": {},
            "runner": {
                "type": "constant",
                "times": 100,
                "concurrency": 10
            }
        }
    ]
}

运行测试

[root@localhost rally]# rally -v task start create-and-delete-user.json

测试结果

--------------------------------------------------------------------------------
Task b859b06f-d4db-4d21-bac7-66dd03375b4c: finished
--------------------------------------------------------------------------------

test scenario KeystoneBasic.create_delete_user
args position 0
args values:
{
  "runner": {
    "type": "constant",
    "concurrency": 10,
    "times": 100
  }
}

--------------------------------------------------------------------------------
 Task b859b06f-d4db-4d21-bac7-66dd03375b4c has 0 error(s)
--------------------------------------------------------------------------------

+-------------------------------------------------------------------------------------------------------------------------+
|                                                  Response Times (sec)                                                  |
+----------------------+-----------+--------------+--------------+--------------+-----------+-----------+---------+-------+
| Action              | Min (sec) | Median (sec) | 90%ile (sec) | 95%ile (sec) | Max (sec) | Avg (sec) | Success | Count |
+----------------------+-----------+--------------+--------------+--------------+-----------+-----------+---------+-------+
| keystone.create_user | 1.801    | 4.229        | 6.752        | 7.454        | 9.972    | 4.624    | 100.0%  | 100  |
| keystone.delete_user | 1.231    | 3.38        | 5.862        | 6.903        | 8.482    | 3.816    | 100.0%  | 100  |
| total                | 3.084    | 8.064        | 12.238      | 13.135      | 15.829    | 8.44      | 100.0%  | 100  |
+----------------------+-----------+--------------+--------------+--------------+-----------+-----------+---------+-------+

Load duration: 86.1431050301
Full duration: 93.1646080017

HINTS:
* To plot HTML graphics with this data, run:
        rally task report b859b06f-d4db-4d21-bac7-66dd03375b4c --out output.html

* To generate a JUnit report, run:
        rally task report b859b06f-d4db-4d21-bac7-66dd03375b4c --junit --out output.xml

* To get raw JSON output of task results, run:
        rally task results b859b06f-d4db-4d21-bac7-66dd03375b4c

生成可视化结果

执行 rally task report --out=report_sla.html --open  会在当前目录生成 report_sla.html

[root@localhost ~]# rally task report --out=report_sla.html --open
[root@localhost ~]# ll
total 232
-rw-------.  1 root root   1054 Apr  8 07:29 anaconda-ks.cfg
-rw-r--r--.  1 root root  10240 Jan 20  2011 ez_setup.py
-rw-r--r--.  1 root root 154686 Jan  7 22:39 nose-1.3.6-py2-none-any.whl
drwxr-xr-x. 11 root root   4096 Apr  9 14:55 rally
-rw-r--r--.  1 root root  50210 Apr 11 11:48 report_sla.html
drwxr-xr-x. 12 root root   4096 Apr 11 11:03 solum
drwxr-xr-x. 14 root root   4096 Apr  9 11:49 tempest

下载下来,打开

OpenStack 性能测试项目Rally 部署

会提示加载不了JS,那是应为使用了google 的js ,无法访问的问题

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.css">
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.13/d3.min.js"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.js"></script>

angular的路径 替换为http://cdn.bootcss.com/angular.js/1.3.3/angular.min.js

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.css">
  <script type="text/javascript" src="http://cdn.bootcss.com/angular.js/1.3.3/angular.min.js"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.13/d3.min.js"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.js"></script>

再次打开

猜你喜欢

转载自www.linuxidc.com/Linux/2017-10/148040.htm