Main features

  • High Performance: the load can be distributed on a cluster of client machines
  • Multi-protocols using a plugin system: HTTP, WebDAV, SOAP, PostgreSQL, MySQL, LDAP , XMPP/Jabber, BOSH, MQTT and AMQP are currently supported. SSL is also supported.
  • Several IP addresses can be used on a single machine using the underlying OS IP Aliasing
  • OS monitoring (CPU, memory and network traffic) using SNMP, Munin or Erlang agents on remote servers.
  • XML configuration system; several sessions can be used to simulate different type of users. Dynamic sessions can be easily described in XML (this can be used to retrieve at runtime an ID from the server output and use it later in the session).
  • In order to generate a realistic traffic, user think-times and the arrival rate can be randomize using a probability distribution
  • HTML reports can be generated during the load to view response times measurement, server CPU, etc.

Tsung is developed in Erlang,运行Tsung,需要相关erlang依赖包支持。

简介

Tsung 是一个压力测试工具,可以测试包括HTTP, WebDAV, PostgreSQL, MySQL, LDAP, and XMPP/Jabber等服务器。针对 HTTP 测试,Tsung 支持 
HTTP 1.0/1.1 ,包含一个代理模式的会话记录、支持 GET、POST 和 PUT 以及 DELETE 方法,支持 Cookie 和基本的WWW 认证,同时还支持 SSL。

tsung的工作原理
(1) Tsung的每一个虚拟用户就是一个erlang的轻量进程。这点和loadrunner有很大的区别。
(2) 虚拟用户完成session后就消失。
(3) 大量的虚拟用户(erlang轻量进程)建立在erlangVM上。
(4) 一台测试机可以启多个erlangVM,目前按照1个cpu启动1个erlangVM。

一、安装前检查环境

1、查看环境:

[root@localhost bin]#  lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.4 (Final)
Release: 6.4
Codename: Final

2、确保安装了以下工具:

yum install gcc -y
yum install perl -y
yum install unixODBC
yum install unixODBC-devel

二、安装

1、下载并安装erlang

[root@localhost ~]#cd /usr/local
[root@localhost local]#mdir -p erlang [root@localhost local]# wget http://www.erlang.org/download/otp_src_R14B04.tar.gz
[root@localhost local]# tar -zxvf otp_src_R14B04.tar.gz
[root@localhost local]# cd otp_src_R14B04
[root@localhost otp_src_R14B04]# ./configure --prefix=/usr/local/erlang
[root@localhost otp_src_R14B04]# make
[root@localhost otp_src_R14B04]# make install

注意:如果出现 "configure: error: No curses library functions found "错误,尝试安装:

[root@localhost otp_src_R14B04]#yum install -y ncurses-devel 

2、下载并安装Tsung

[root@localhost ~]#cd /usr/local
[root@localhost local]#mkdir -p tsung
[root@localhost local]# wget http://tsung.erlang-projects.org/dist/tsung-1.4.2.tar.gz
[root@localhost local]# tar -zxvf tsung-1.4.2.tar.gz
[root@localhost local]# cd tsung-1.4.2
[root@localhost tsung-1.4.2]# ./configure --prefix=/usr/local/tsung --with-erlang=/usr/local/erlang
[root@localhost tsung-1.4.2]# make
[root@localhost tsung-1.4.2]# make install

3、下载并安装perl Template,用于生成报告模版

[root@localhost ~]#cd /usr/local

[root@localhost local]# wget http://cpan.org/modules/by-module/Template/Template-Toolkit-2.24.tar.gz
[root@localhost local]# tar -zxvf Template-Toolkit-2.24.tar.gz
[root@localhost local]# cd Template-Toolkit-2.24
[root@localhost Template-Toolkit-2.24]# perl Makefile.PL
[root@localhost Template-Toolkit-2.24]# make
[root@localhost Template-Toolkit-2.24]# make test
[root@localhost Template-Toolkit-2.24]# make install

注意:如果出现 以下提示:

[root@localhost Template-Toolkit-2.24]# perl Makefile.PL
Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: ./lib /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 11.
BEGIN failed--compilation aborted at Makefile.PL line 11.

解决办法:

yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker

4、下载并安装gnuplot,用于聊天生成

[root@localhost local]#yum install -y gnuplot gd libpng zlib 

三、检查是否安装成功

[root@localhost local]# perl -v      命令查看显示perl 当前版本信息。
[root@localhostlocal]# gnuplot 命令查看gnuplot 的安装版本
[root@localhost local]# erl 命令查看erlang的安装版本
Erlang R14B04 (erts-5.8.5) [source] [64-bit] [rq:1] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.8.5 (abort with ^G)
[root@localhost local]# tsung -v 命令查看tsung 的安装版本
Tsung version 1.4.2

四、安装后设置环境变量

安装成后添加erlang、tsung环境变量

[root@localhost local]# vim /etc/profile
export PATH=$PATH:$JAVA_HOME/bin:/usr/local/erlang/bin:/usr/local/tsung/bin:/usr/local/nginx/sbin:$PATH(修改自己实际变量)
:wq保存,退出
[root@localhost local]# source /etc/profile
不报错则成功
[root@localhost local]# tsung -v
Tsung version 1.4.2
[root@localhost local]# erl -v
Erlang R14B04 (erts-5.8.5) [source] [64-bit] [rq:1] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.8.5 (abort with ^G)
1>

五、使用并生成报表

1、在root文件夹下新建.tsung目录,用于存放log和xml配置,测试配置文件可参考/usr/local/tsung/share/doc/tsung/examples/目录下配置

[root@localhost local]#mkdir ~/.tsung
[root@localhost local]#cp /usr/local/tsung/share/doc/tsung/examples/http_simple.xml ~/.tsung/tsung.xml

2、运行,默认执行脚本~/.tsung/tsung.xml配置

[root@localhost local]# tsung start
Starting Tsung
"Log directory is: /root/.tsung/log/20150311-0536"

3、进入Log目录下可以看到生成的报表信息

[root@localhost 20150311-0536]# cd /root/.tsung/log/20150311-0536
[root@localhost 20150311-0536]# ls -a
. .. match.log tsung_controller@localhost.log tsung.log tsung.xml

4、进入需要生成图形报表的Log目录,如/root/.tsung/log/20150311-0536

[root@localhost 20150311-0536]# /usr/local/tsung/lib/tsung/bin/tsung_stats.pl
creating subdirectory data
creating subdirectory gnuplot_scripts
creating subdirectory images
No data for Session
No data for Perfs
No data for Transactions
No data for Match
No data for Event
No data for Async
No data for Size
size_rcv is equal to 0 !
size_sent is equal to 0 !
[root@localhost 20150311-0536]# ls
data gnuplot.log gnuplot_scripts graph.html images match.log report.html tsung_controller@localhost.log tsung.log tsung.xml

5、将report.html拖到windows系统中,直接打开即可查看。

目前Tsung工具的最新版本为1.6.0,需要注意的是Tsung1.5.1版本及以上才支持MQTT,并且只有Tsung1.6.0开始,才支持MQTT的username和password的认证。

Tsung测试工具的基本测试命令为 Tsung -f  ~/.tsung/mqtt.xml -l <日志保存路径> start

mqtt.xml具体如下(在/usr/share/doc/tsung/examples路径下可查找到):

<?xml version="1.0"?>

<!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd">

<tsung loglevel="debug" version="1.0">

<!--下面为客户端配置,可以有配有多个客户端,其中ubuntu要保证通过ssh ubuntu能远程登陆上ubuntu这台机器,这里建议通过密钥对来进行远程客户端的登陆。下面类似于loadrunner的load generator,用以模拟用户。具体的详细配置请参见官网文档http://tsung.erlang-projects.org/user_manual/conf-client-server.html-->

转: Tsung:开源多协议分布式负载&压力测试工具的更多相关文章

  1. Tsung:开源多协议分布式负载&压力测试工具

    Main features High Performance: the load can be distributed on a cluster of client machines Multi-pr ...

  2. .net分布式压力测试工具(Beetle.DT)

    肯定有人会问为什么会写这样一个开源工具?和现有的有什么差别?不过对于一个程序员来说写东西还真不需要理由的:),主要原因是工作有点闲(开玩笑),不过说实话一个程员怎可能会停止写代码呢(作为一个奔4的程序 ...

  3. Pylot网站Web服务器性能和负载压力测试-适用Windows可绘制图表

    为了能够准确地评估网站服务器对网络流量的承受能力,我们一般会采取模拟网站用户访问,通过不断地增加并发数,延长访问时长,从而最终得出网站Web服务器的性能和负载能力.当然也可以通过Web压力测试,来完善 ...

  4. Windows开源Web服务器性能和压力测试工具

    linux有很多开源工具用来测试服务器负载,而windows上非常少,几乎没有除了几个复杂的JMeter WET等 将两个好用的工具是Linux版本通过Cygwin移植过来,方便广大windows人员 ...

  5. Linux压力测试工具Tsung安装、使用和图形报表生成

    简介 Tsung 是一个压力测试工具,可以测试包括HTTP, WebDAV, PostgreSQL, MySQL, LDAP, and XMPP/Jabber等服务器.针对 HTTP 测试,Tsung ...

  6. 压力测试工具tsung

    tsung是用erlang开发的一款简单易用的压力测试工具,可以生成成千上万的用户模拟对服务器进行访问.目前对tsung的理解也仅限于会简单的应用,其内部结构没有深入研究过. 1.安装 tsung是用 ...

  7. loadrunner笔记(一):下载、安装loadrunner和负载压力测试概念说明

    (一)   下载和安装 下载:(没账号的话得先注册一个账号) https://software.microfocus.com/en-us/products/loadrunner-load-testin ...

  8. Apache ab并发负载压力测试(python+django+mysql+apache)

    如标题,大家都知道秒杀中存在高并发使库存骤然为0,但在我们个人PC或小区域内是模拟不出这样的情景 现在利用 Apache ab并发负载压力测试 1,数据库建入库存字段并映射模型 2,view编写脚本 ...

  9. CentOS压力测试工具Tsung安装和图形报表生成Tsung安装配置

    Tsung 是一个压力测试工具,可以测试包括HTTP, WebDAV, PostgreSQL, MySQL, LDAP, and XMPP/Jabber等服务器.针对 HTTP 测试,Tsung 支持 ...

随机推荐

  1. android:scrollbarStyle属性及滚动条和分割线覆盖问题

    android:scrollbarStyle可以定义滚动条的样式和位置,可选值有insideOverlay.insideInset.outsideOverlay.outsideInset四种. 其中i ...

  2. Nginx简单认识

    写在前面: 最近一直在学习,这几天了解了下Nginx,虽然看了些资料,斌哥也讲解了一下,但是貌似缺少了实践,就显得对其认识的不那么深刻.这里也还是简单的记录下把. 什么是Nginx? Nginx (e ...

  3. [转]Web.xml配置详解之context-param

    转自:http://blog.csdn.net/liaoxiaohua1981/article/details/6759206 格式定义: [html] view plaincopy   <co ...

  4. Ubuntu 16.04安装OpenVPN客户端GUI

    说明:一般来说OpenVPN在Linux下都是基于命令行的,而Ubuntu可以通过安装扩展放在网络连接上实现GUI操作. 安装: sudo apt-get install openvpn sudo a ...

  5. NHibernate之一级缓存(第十篇)

    NHibernate的一级缓存,名词好像很牛B,很难.实际上就是ISession缓存.存储在ISession的运行周期内.而二级缓存则存储在ISessionFactory内. 一.ISession一级 ...

  6. Android学习进阶路线导航线路(Android源码分享)

                                                                                                       转 ...

  7. python利用os和getopt实现删除指定文件

    工作中经常遇到要删除某些目录下的特定文件 例如删除xxx目录下的所有test开头文件或者.pyc结尾的文件 如果手动删除的话,很麻烦,写个程序自动删除 只需要运行的时候输入路径和文件名即可,不输入文件 ...

  8. 【C#】:浅谈反射机制 【转】

    http://blog.csdn.net/lianjiangwei/article/details/47207875 什么是反射? 反射提供了封装程序集.模块和类型的对象(Type 类型).可以使用反 ...

  9. Dx12 occlusion query

    https://github.com/Microsoft/DirectX-Graphics-Samples/blob/master/Samples/Desktop/D3D12PredicationQu ...

  10. 查询mysql数据库中所有表名

    查找所有表的语句 select table_name from information_schema.tables where table_schema='当前数据库';