OpenStack测试这个话题,一直以来貌似在国内一直没什么人关注,更多的兄弟还是关注OpenStack哪些功能。最近也有一些基于OpenStack兄弟们的公有云要上线了,终于想起来要做测试了。对于测试这块,国内Intel算最早就把Tempest这个项目搞的风声水起。对于Performance这块,Tempest也支持,但效果如何还没有测试过。应该一年前,Mirantis在这块还是给出了一些比较的建议,后续也起了一个孵化项目Rally做OpenStack性能测试这块。当然,就性能测试这块,OpenStack只能算刚刚起步,但相信测试这块的不断完善也是OpenStack向更加可用迈进的标志。接下来简单讲讲Rally入门。

##Rally结构

  • 部署引擎
  • 环境验证
  • 标准测试引擎

##Rally安装 Python项目的安装还是相对比较简单,这里就不详细说明python pip、virtualenv这块。直接进行安装,如有看不懂的,自行学习Python。

注意:如果你是Mac用户,建议不要在里面试了,巨痛苦,老老实实安装一个虚拟机,开Linux为上(以CentOS 6.5为例).

从github克隆代码:

kevinzhang:~ kevin$ git clone https://github.com/stackforge/rally.git && cd rally

安装python的依赖包(这里用virtualenv):

kevinzhang:~ kevin$ ./rally/install_rally.sh -v

rally提供了安装脚本,直接加-v参数即可。

这样基本的安装就OK了。

##Rally配置和初始化数据库 Rally的配置文件为/etc/rally/rally.conf,主要需要修改的为数据库连接字段,其它默认即可。

kevinzhang:~ kevin$ vim /etc/rally/rally.conf
 # Change the "connection" parameter, For example to this: 
 connection=sqlite://///opt/rally/database/rally.sqlite

初始化数据库:

kevinzhang:~ kevin$ rally-manage db recreate

##如何使用Rally Rally的使用,初步看了一下,发现和dashboard很像,需要给出一个KEYSTONE_AUTH_URL,可以对已经部署的OpenStack做测试。当然,根据架构设计来看,貌似Rally还能调用Mirantis Fuel去部署,在测试。这里我仅对已部署的OpenStack环境做一个keystone 创建-删除用户场景做压力测试。

###根据已有的OpenStack环境初始化Rally 根据目前已有的OpenStack环境生成一个如下的json文件,type类型为ExistingCloud(注意需要用admin的权限):

(rally)[root@dev ~]# cat existing.json
{
    "type": "ExistingCloud",
    "endpoint": {
        "auth_url": "http://192.168.1.170:5000/v2.0",
        "username": "admin",
        "password": "admin",
        "tenant_name": "admin"
    }
}

采用rally的deployment命令根据json文件创建测试环境:

(rally)[root@dev ~]# rally deployment create --filename=existing.json --name=existing
(rally)[root@dev ~]# rally deployment list
/opt/rally/lib/python2.6/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
  _warn("Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
+--------------------------------------+----------------------------+----------+------------------+--------+
|                 uuid                 |         created_at         |   name   |      status      | active |
+--------------------------------------+----------------------------+----------+------------------+--------+
| 33c843c1-de28-4d9e-b30d-b91120ca9770 | 2014-05-05 21:41:16.957229 | existing | deploy->finished |   *    |
+--------------------------------------+----------------------------+----------+------------------+--------+

部署完成后可以采用deployment check进行测试:

(rally)[root@dev ~]# rally deployment check
/opt/rally/lib/python2.6/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
  _warn("Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
keystone endpoints are valid and following services are available:
+----------+----------+-----------+
| services |   type   |   status  |
+----------+----------+-----------+
|   nova   | compute  | Available |
| neutron  | network  | Available |
| cinderv2 | volumev2 | Available |
|  glance  |  image   | Available |
|  cinder  |  volume  | Available |
|   ec2    |   ec2    | Available |
| keystone | identity | Available |
+----------+----------+-----------+

如果仅对keystone相关的服务进行测试,如上的配置即可。

##测试案例 先来试一把,用5个并发,100次请求,先压一下keystone,需要从sample中选择需要测试用例的json文件,并修改测试参数如下:

(rally)[root@dev code]# cp rally/doc/samples/tasks/keystone/create-and-delete-user.json ~
(rally)[root@dev ~]# cat create-and-delete-user_5client_100.json
{
    "KeystoneBasic.create_delete_user": [
        {
            "args": {
                "name_length": 10
            },
            "runner": {
                "type": "constant",
                "times": 100,
                "concurrency": 5
            }
        }
    ]
}

使用rally进行测试:

(rally)[root@dev ~]# rally -v task start create-and-delete-user_5client_100.json

上面也有输出,省略了输出结果。

查看结果:

(rally)[root@dev ~]# rally -vd task detailed 3bc63cfb-89ec-400e-b5bc-ecc68ff96733
/opt/rally/lib/python2.6/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
  _warn("Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
2014-05-06 16:59:45.773 43898 DEBUG rally.cmd.cliutils [-] INFO logs from urllib3 and requests module are hide. run /opt/rally/lib/python2.6/site-packages/rally/cmd/cliutils.py:116

================================================================================
Task 3bc63cfb-89ec-400e-b5bc-ecc68ff96733 is finished.
--------------------------------------------------------------------------------

test scenario KeystoneBasic.create_delete_user
args position 0
args values:
{u'args': {u'name_length': 10},
 u'runner': {u'concurrency': 5, u'times': 100, u'type': u'constant'}}
+--------------------------+-----------+-----------+-----------+---------------+---------------+---------+-------+
| action                   | min (sec) | avg (sec) | max (sec) | 90 percentile | 95 percentile | success | count |
+--------------------------+-----------+-----------+-----------+---------------+---------------+---------+-------+
| keystone.create_user     | 1.518     | 2.725     | 4.331     | 3.513         | 3.891         | 100.0%  | 100   |
| keystone.delete_resource | 0.255     | 1.142     | 2.012     | 1.524         | 1.634         | 100.0%  | 100   |
| total                    | 2.572     | 3.868     | 5.762     | 4.918         | 5.150         | 100.0%  | 100   |
+--------------------------+-----------+-----------+-----------+---------------+---------------+---------+-------+

HINTS:
* To plot HTML graphics with this data, run:
	rally task plot2html 3bc63cfb-89ec-400e-b5bc-ecc68ff96733 --out output.html

* To get raw JSON output of task results, run:
	rally task results 3bc63cfb-89ec-400e-b5bc-ecc68ff96733

可以看到一些详细的数据分析,目前来看,低负载情况下,创建用户相对删除用户要慢一倍左右。

在试试更多的并发和请求数目,这次用100个并发,1000个访问请求,需要修改测试json如下:

(rally)[root@dev code]# cp rally/doc/samples/tasks/keystone/create-and-delete-user.json ~
(rally)[root@dev ~]# cat create-and-delete-user_100client_1000.json
{
    "KeystoneBasic.create_delete_user": [
        {
            "args": {
                "name_length": 10
            },
            "runner": {
                "type": "constant",
                "times": 1000,
                "concurrency": 100
            }
        }
    ]
}

使用rally进行测试:

(rally)[root@dev ~]# rally -v task start create-and-delete-user_100client_1000.json

上面也有输出,省略了输出结果。

查看结果:

(rally)[root@dev ~]# rally -vd task detailed c05a7725-b646-4d58-a54a-43d66341d90d
/opt/rally/lib/python2.6/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
  _warn("Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
2014-05-06 17:06:54.338 43914 DEBUG rally.cmd.cliutils [-] INFO logs from urllib3 and requests module are hide. run /opt/rally/lib/python2.6/site-packages/rally/cmd/cliutils.py:116

================================================================================
Task c05a7725-b646-4d58-a54a-43d66341d90d is finished.
--------------------------------------------------------------------------------

test scenario KeystoneBasic.create_delete_user
args position 0
args values:
{u'args': {u'name_length': 10},
 u'runner': {u'concurrency': 100, u'times': 1000, u'type': u'constant'}}
+--------------------------+-----------+-----------+-----------+---------------+---------------+---------+-------+
| action                   | min (sec) | avg (sec) | max (sec) | 90 percentile | 95 percentile | success | count |
+--------------------------+-----------+-----------+-----------+---------------+---------------+---------+-------+
| keystone.create_user     | 3.706     | 40.148    | 69.864    | 62.414        | 65.213        | 50.8%   | 1000  |
| keystone.delete_resource | 0.594     | 12.071    | 28.795    | 25.412        | 26.431        | 50.8%   | 1000  |
| total                    | 5.746     | 52.231    | 94.030    | 78.073        | 81.833        | 50.8%   | 1000  |
+--------------------------+-----------+-----------+-----------+---------------+---------------+---------+-------+

HINTS:
* To plot HTML graphics with this data, run:
	rally task plot2html c05a7725-b646-4d58-a54a-43d66341d90d --out output.html

* To get raw JSON output of task results, run:
	rally task results c05a7725-b646-4d58-a54a-43d66341d90d

结果这个惨烈,基本上50%的失败,而且并发大的情况下,平均响应时间大大增加。这样看来keystone面对公有云也表示压力山大!后面会针对这个问题进行一些tunning,敬请期待…… 附keystone服务器配置:

CPU:E5520
内存:8G


blog comments powered by Disqus

站内搜索

RSS订阅

rss feed

文章标签

相关文章

友情链接

  • trystack
  • 99cloud
  • tacy
  • 分享按钮