刚上班公司给了个任务,搭建一个Tsung压力测试工具的环境,在网上搜索了一些资料,总结了一点自己的理解体会,比较乱,大致看看吧。有不对的地方还请大神指点指点。
具体Tsung工具的应用是,模拟用户对某平台的访问,其中可以产生自定义数量的虚拟用户,当Tsung start启动后,虚拟用户产生,模拟访问测试的平台,得到压力数据,在平台生产和设计过程中查漏补缺,具体如下:
具体Tsung工具的应用是,模拟用户对某平台的访问,其中可以产生自定义数量的虚拟用户,当Tsung start启动后,虚拟用户产生,模拟访问测试的平台,得到压力数据,在平台生产和设计过程中查漏补缺,具体如下:
Tsung压力测试工具环境搭建
环境:
系统:CentOS 7
版本(软件包):tsung-1.4.2.tar.gz otp_src_R14B04.tar.gz Template-Toolkit-2.24.tar.gz
安装软件之前确保环境中存在以下工具:
yum install gcc -y
yum install perl -y
yum install unixODBC
yum install unixODBC-devel
下载并安装erlang
# wget http://www.erlang.org/download/otp_src_R14B04.tar.gz
# tar -zxvf otp_src_R14B04.tar.gz
# cd otp_src_R14B04
# ./configure --prefix=/usr/local/erlang
# make
# make install
若出现"configure:error: No curses library functions found "错误,则需安装以下工具
yum install -y ncurses-devel
下载并安装Tsung
# wget http://tsung.erlang-projects.org/dist/tsung-1.4.2.tar.gz
# tar -zxvf tsung-1.4.2.tar.gz
# cd tsung-1.4.2
# ./configure --prefix=/usr/local/tsung --with-erlang=/usr/local/erlang
# make
# make install
下载并安装perl Template,用于生成报告模板
# wget http://cpan.org/modules/by-module/Template/Template-Toolkit-2.24.tar.gz
# tar -zxvf Template-Toolkit-2.24.tar.gz
# cd Template-Toolkit-2.24
# perl Makefile.PL
# make
# make install
若在perl Makefile.PL处发生错误如下:
则安装perl-devel即可 yum install -y perl-devel
下载并安装gnuplot ,用于聊天生成
yum install -y gnuplot gd libpngzlib
完成安装后把erlang tsung加入到环境变量中
# vim /etc/profile
export PATH=$PATH:$JAVA_HOME/bin:/usr/local/erlang/bin:/usr/local/tsung/bin:/usr/local/nginx/sbin:$PATH(修改自己实际变量)
保存,退出
# source /etc/profile
不报错则成功
# tsung -v 查看Tsung版本
# erl -v 查看erlang版本
测试
使用并生成报表
1.在root下创建.tsung目录,用于存放log和xml配置文件,测试文件参考/usr/local/tsung/share/doc/tsung/examples/http_simple.xml文件。
mkdir ~/.tsung
cp/usr/local/tsung/share/doc/tsung/examples/http_simple.xml ~/.tsung/tsung.xml
2.运行tsung,默认执行脚本~/.tsung/tsung.xml配置文件
tsung start
[img]data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAi4AAAAuCAIAAACAtwWhAAAgAElEQVR4nO2dV0McSZbvT2a5LJdFOby3hfceYSQ8COERRnjvhDdCeBAI701hC08V3oMMLbVabWbazezszu7evQ/3C9yPcO9DFRKSkLo1025X+XuiksqIyMis+Mc5ceIk/D8CAgICAoLfFfi9G0BAQEBA8KmjkKKI5Hz4zTAJG5C9+Pe///lgttz2t6uV4PeBZeuXk58X7mJfPXU8ku3yq9ZlEV9REubgG1+4tjofbkH7VesiICD4Rfj9pIjg04JkFpA3vLYx3ZqkT0V/1ZoQsm5Cs1i2NlYYYkn6VWsiICD4hSCkiICAgIDgd+anpIgmdE6uX1xcrk+y5VJ+rUYgKuYp9ePL81MD9UkmTPI/XA7XLqJxYH55dqg2xYsjL1nVLT0n0oRN/aWa+k/Dc4+tHl+euRdj8yvbBgQEBAT/bfgpKcLN8hYev5isdhEJsX9i6CRbRNQUxuuxLh9DmUp8oZDPwkhAUTJzuh5YJf7muThUnfkP10JTNnDxCs4RH34lKdYCAADENH11q8tLCfnostiGiYVVt8x+cQcPpm7skDF8dNR1m/taH0lUjEZGgUSmkd/TydrBJXUJ9r90Y34efIv04jJ/w487CRGFVhXdMeb8Ok0iICD4n8VPSpFpzsTyePLrwAIqA+coa+gamDo6OlgZq1MAyGx1SwdHGxP1VwvENK62tYOjlZEKGQCAwtMx8y3oP1wfSwmxtzbXxQEAwUxjqhZkJ4/ODo5WH/iwSAAAdlkbm/0hr6WILNAxdXCwM1R7rWBMVQNbR2cbU30OBQ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