openstack 性能测试 Rally

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

openstack 性能测试 Rally_第1张图片

下载安装Rally

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

[html] view plain copy
  1. git clone https://github.com/stackforge/rally.git  
  2. ./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 目录下有模板可以参考

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

我的existing.json

[html] view plain copy
  1. [root@localhost rally]# cat existing.json   
  2. {  
  3.     "type": "ExistingCloud",  
  4.     "auth_url": "http://192.168.132.53:5000/v3/",  
  5.     "region_name": "RegionOne",  
  6.     "endpoint_type": "public",  
  7.     "admin": {  
  8.         "username": "admin",  
  9.         "password": "admin",  
  10.         "tenant_name": "admin"  
  11.     },  
  12.     "https_insecure": false,  
  13.     "https_cacert": ""  
  14. }  


创建deployment

[html] view plain copy
  1. [root@localhost rally]# rally deployment create --filename=existing.json --name=existing  
  2. 2016-04-09 14:51:24.557 19950 INFO rally.deployment.engine [-] Deployment 301118b9-c4cc-4e60-8761-57bbdffb392e | Starting:  OpenStack cloud deployment.  
  3. 2016-04-09 14:51:24.583 19950 INFO rally.deployment.engine [-] Deployment 301118b9-c4cc-4e60-8761-57bbdffb392e | Completed: OpenStack cloud deployment.  
  4. +--------------------------------------+----------------------------+----------+------------------+--------+  
  5. | uuid                                 | created_at                 | name     | status           | active |  
  6. +--------------------------------------+----------------------------+----------+------------------+--------+  
  7. | 301118b9-c4cc-4e60-8761-57bbdffb392e | 2016-04-09 18:51:24.549769 | existing | deploy->finished |        |  
  8. +--------------------------------------+----------------------------+----------+------------------+--------+  
  9. Using deployment: 301118b9-c4cc-4e60-8761-57bbdffb392e  
  10. ~/.rally/openrc was updated  
  11.   
  12. HINTS:  
  13. * To get your cloud resources, run:  
  14.         rally show [flavors|images|keypairs|networks|secgroups]  
  15.   
  16. * To use standard OpenStack clients, set up your env by running:  
  17.         source ~/.rally/openrc  
  18.   OpenStack clients are now configured, e.g run:  
  19.         glance image-list  

检查测试环境
[html] view plain copy
  1. [root@localhost rally]# rally deployment check  
  2. keystone endpoints are valid and following services are available:  
  3. +-------------+----------------+-----------+  
  4. | services    | type           | status    |  
  5. +-------------+----------------+-----------+  
  6. | __unknown__ | volumev2       | Available |  
  7. | ceilometer  | metering       | Available |  
  8. | cinder      | volume         | Available |  
  9. | cloud       | cloudformation | Available |  
  10. | glance      | image          | Available |  
  11. | heat        | orchestration  | Available |  
  12. | keystone    | identity       | Available |  
  13. | neutron     | network        | Available |  
  14. | nova        | compute        | Available |  
  15. +-------------+----------------+-----------+  
  16. 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).  
  17. [  

测试
[html] view plain copy
  1. [root@localhost rally]# cp ./samples/tasks/scenarios/keystone/create-and-delete-user.json .  
  2. [root@localhost rally]# vi create-and-delete-user.json   
  3.   
  4. {  
  5.     "KeystoneBasic.create_delete_user": [  
  6.         {  
  7.             "args": {},  
  8.             "runner": {  
  9.                 "type": "constant",  
  10.                 "times": 100,  
  11.                 "concurrency": 10  
  12.             }  
  13.         }  
  14.     ]  
  15. }  
运行测试
[html] view plain copy
  1. [root@localhost rally]# rally -v task start create-and-delete-user.json   
测试结果
[html] view plain copy
  1. --------------------------------------------------------------------------------  
  2. Task b859b06f-d4db-4d21-bac7-66dd03375b4c: finished  
  3. --------------------------------------------------------------------------------  
  4.   
  5. test scenario KeystoneBasic.create_delete_user  
  6. args position 0  
  7. args values:  
  8. {  
  9.   "runner": {  
  10.     "type": "constant",   
  11.     "concurrency": 10,   
  12.     "times": 100  
  13.   }  
  14. }  
  15.   
  16. --------------------------------------------------------------------------------  
  17.  Task b859b06f-d4db-4d21-bac7-66dd03375b4c has 0 error(s)  
  18. --------------------------------------------------------------------------------  
  19.   
  20. +-------------------------------------------------------------------------------------------------------------------------+  
  21. |                                                  Response Times (sec)                                                   |  
  22. +----------------------+-----------+--------------+--------------+--------------+-----------+-----------+---------+-------+  
  23. | Action               | Min (sec) | Median (sec) | 90%ile (sec) | 95%ile (sec) | Max (sec) | Avg (sec) | Success | Count |  
  24. +----------------------+-----------+--------------+--------------+--------------+-----------+-----------+---------+-------+  
  25. | keystone.create_user | 1.801     | 4.229        | 6.752        | 7.454        | 9.972     | 4.624     | 100.0%  | 100   |  
  26. | keystone.delete_user | 1.231     | 3.38         | 5.862        | 6.903        | 8.482     | 3.816     | 100.0%  | 100   |  
  27. | total                | 3.084     | 8.064        | 12.238       | 13.135       | 15.829    | 8.44      | 100.0%  | 100   |  
  28. +----------------------+-----------+--------------+--------------+--------------+-----------+-----------+---------+-------+  
  29.   
  30. Load duration: 86.1431050301  
  31. Full duration: 93.1646080017  
  32.   
  33. HINTS:  
  34. * To plot HTML graphics with this data, run:  
  35.         rally task report b859b06f-d4db-4d21-bac7-66dd03375b4c --out output.html  
  36.   
  37. * To generate a JUnit report, run:  
  38.         rally task report b859b06f-d4db-4d21-bac7-66dd03375b4c --junit --out output.xml  
  39.   
  40. * To get raw JSON output of task results, run:  
  41.         rally task results b859b06f-d4db-4d21-bac7-66dd03375b4c  

生成可视化结果

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

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

openstack 性能测试 Rally_第2张图片

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

[html] view plain copy
  1. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.css">  
  2. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js">script>  
  3. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.13/d3.min.js">script>  
  4. <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

[html] view plain copy
  1. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.css">  
  2. <script type="text/javascript" src="http://cdn.bootcss.com/angular.js/1.3.3/angular.min.js">script>  
  3. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.13/d3.min.js">script>  
  4. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.js">script>  

再次打开

openstack 性能测试 Rally_第3张图片


openstack 性能测试 Rally_第4张图片

你可能感兴趣的:(openstack)