2023拉

funkload 安装

上一篇 / 下一篇  2012-11-19 16:52:15 / 个人分类:性能测试

   

一.安装Funkload之前检查服务器的pyton版本【funkload 1.14.0 requires python >= 2.5】, 是否安装gcc【yum -y install gcc* 】
    查看版本python -V,如果版本低于2.5,进行如下升级
1、下载
wget  http://www.python.org/ftp/python/2.6.5/Python-2.6.5.tar.bz2
2、解压
tar jxvf Python-2.6.5.tar.bz2
3、编译安装
cd Python-2.6.5
./configure
make && make install
Python 默认安装目录在/usr/local/lib/python2.6
查看一下刚才安装的版本 /usr/local/lib/python2.6 -V,看到了2.6.5吧
4、更改系统默认版本
之前查看版本使用 /usr/local/lib/python2.6 -V,现在来把系统默认的Python指向刚才安装的Python2.6。
(如果有人问为什么不把2.4.3卸载呢?呃,貌似网上有讲yum是基于2.4.3,所以我也就没那样折腾)
mv /usr/bin/python /usr/bin/python.bak
ln -s /usr/local/bin/python2.6 /usr/bin/python
敲入 python -V 查看是否成功。
5、修复不能正常工作的yum
在完成了上面4步之后,如果有使用yum的话会发现出错,这是因为yum 依赖2.4.3而现在默认的 Python 版本是2.6.5。
vim /usr/bin/yum
将首行显示的 !#/usr/bin/python 修改为 !#/usr/bin/python2.4

二:easy_install工具安装
 1.  wget http://peak.telecommunity.com/dist/ez_setup.py
     sudo python ez_setup.py   如果出错提示 zipimport.ZipImportError: can't decompress data; zlib not available,这样 解决:
(1)先安装系统相应的依赖库文件

1.wget  http://ys-f.ys168.com/1.0/339619533/igVKgJm24571M5GKKMJ8/zlib-1.2.3.tar.gz
2.cd zlib-1.2.3
3.sudo  ./configure
4.sudo  make && make install
(2)重新编译安装python

1.安装目录下执行 sudo ./configure

2.编辑Modules/Setup文件

   vim Modules/Setup  找到下面这句 #zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz,去掉注释

 3. sudo make

     sudo make -i install

(4)重新执行

 python ez_setup.py 现在就可以用 sudo easy_install 命令安装其他组件了

三:TCPWatch安装
wgethttp://hathawaymix.org/Software/TCPWatch/tcpwatch-1.3.tar.gztar xzvf tcpwatch-1.3.tar.gz
cd tcpwatch
python setup.py build
sudo python setup.py install

四:funkload安装

sudo easy_install -U funkload

五:测试funkload

fl-install-demo

cd funkload-demo/xmlrpc/

make test

make bench


六;实例

Simple.conf内容如下;

[main]
title= ----------------Beta1 FunkLoad tests-------------------------
description=Simply testing a default static page
url=http://baidu.com


# a section for each test
[test_simple]
description=Access %(nb_time)s times the main url
#请求次数
nb_time=120


# a section to configure the test mode
[ftest]
log_to = console file
log_path = test_beta1.log
result_path = test_beta1.xml
sleep_time_min = 0
sleep_time_max = 0


# a section to configure the bench mode
[bench]
cycles = 50:75:100:125
#持续时间
duration = 10
#启动延时
startup_delay = 0.01
#循环等待时间
sleep_time = 0.01
cycle_time = 1
# log&result输出
log_to =
log_path = beta1.log
result_path = beta1.xml
#休眠最小值
sleep_time_min = 0
sleep_time_max = 0.5

Simple.py 如下:

import unittest
from random import random
from funkload.FunkLoadTestCase import FunkLoadTestCase

class Simple(FunkLoadTestCase):
    """This test use a configuration file Simple.conf."""
    def setUp(self):
        """Setting up test."""
        self.server_url = self.conf_get('main', 'url')

    def test_simple(self):
        # The description should be set in the configuration file
        server_url = self.server_url
        # begin of test ---------------------------------------------
        nb_time = self.conf_getInt('test_simple', 'nb_time')
        for i in range(nb_time):
            self.get(server_url, description='Get url')
        # end of test -----------------------------------------------

if __name__ in ('main', '__main__'):
    unittest.main()


执行这个命令:sudo -s fl-run-test -dv Simple.py




TAG:

 

评分:0

我来说两句

Open Toolbar