溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Tsung:開源多協(xié)議分布式負(fù)載&壓力測試工具

發(fā)布時間:2020-07-05 16:40:49 來源:網(wǎng)絡(luò) 閱讀:707 作者:zddnd 欄目:建站服務(wù)器

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,需要相關(guān)erlang依賴包支持。

 

一.安裝Tsung

sudo apt-get update
sudo apt-get -y install tsung

或自行下載Tsung源碼包安裝:http://tsung.erlang-projects.org/

二.啟用SNMP agent(snmpd)監(jiān)視系統(tǒng)運行

  1. 在目標(biāo)系統(tǒng)上安裝snmpd: apt-get install snmpd

  2. 修改配置文檔/etc/snmp/snmpd.conf:

    1)開啟所有監(jiān)視端訪問:注釋行agentAddress  udp:127.0.0.1:161,然后啟用行agentAddress udp:161,udp6:[::1]:161
    2)設(shè)置snmp agent可監(jiān)視(OID分支)范圍:注釋行view   systemonly  included   .1.3.6.1.2.1.1和view systemonly included .1.3.6.1.2.1.25.1,然后添加行view systemonly included .1
    3)rocommunity public  default    -V systemonly行和rocommunity public  default    -V systemonly行public為默認(rèn)community,可更改自定義
    4)如果在docker中運行snmpd,修改配置文檔/etc/snmp/snmpd.conf后,執(zhí)行service snmpd [command],這對已啟動的snmpd是無效的。因此本人通過重啟snmpd所運行的容器(expose 161),然后再執(zhí)行service snmpd start是可行的方案
  3. 啟動snmpd:service snmpd start
  4. 監(jiān)視端安裝snmp來檢測監(jiān)視目標(biāo)系統(tǒng)snmp agent

    sudo apt-get install snmp
    snmpwalk -v 2c -c public [agent主機名或ip]

三.試運行Tsung并生成統(tǒng)計報告

cd ~
mkdir .tsung
cp /usr/share/doc/tsung/examples/http_simple.xml .tsung/tsung.xml
tsung start

注意事項:

1)/usr/share/doc/tsung/examples:Tsung安裝后,該目錄下有多種配置文檔樣例可參考
2)~/.tsung/tsung.xml:默認(rèn)配置文件。如果該文件不存在,則需添加-f選項,tsung -f myconfigfile.xml start
3)~/.tsung/log:運行命令tsung start后將生成該日志目錄
4)本例中monitor type為snmp
5)關(guān)于tsung.xml的配置可參考:http://tsung.erlang-projects.org/user_manual/

 

Tsung:開源多協(xié)議分布式負(fù)載&壓力測試工具

cenze@kylin:~/.tsung$ ls log20170115-2235cenze@kylin:~/.tsung$ cd log/20170115-2235cenze@kylin:~/.tsung/log/20170115-2235$ /usr/lib/tsung/bin/tsung_stats.pl
warn, last interval (7) not equal to the first, use the first one (10)
No data for Bosh
No data for Match
No data for Event
No data for Async
No data for Errors
cenze@kylin:~/.tsung/log/20170115-2235$ ls -l
總用量 92drwxrwxr-x 2 cenze cenze  4096 1月  15 22:51 data-rw-rw-r-- 1 cenze cenze  3344 1月  15 22:51 gnuplot.log
drwxrwxr-x 2 cenze cenze  4096 1月  15 22:51 gnuplot_scripts-rw-rw-r-- 1 cenze cenze  7333 1月  15 22:51 graph.html
drwxrwxr-x 2 cenze cenze  4096 1月  15 22:51 p_w_picpaths-rw-rw-r-- 1 cenze cenze    62 1月  15 22:35 match.log-rw-rw-r-- 1 cenze cenze  8151 1月  15 22:51 report.html-rw-rw-r-- 1 cenze cenze 10157 1月  15 22:45 tsung_controller@kylin.log-rw-rw-r-- 1 cenze cenze 36480 1月  15 22:45 tsung.log-rw-rw-r-- 1 cenze cenze   961 1月  15 22:35 tsung.xml

Tsung:開源多協(xié)議分布式負(fù)載&壓力測試工具

注意事項:

1)/usr/lib/tsung/bin/tsung_stats.pl:如果當(dāng)前目錄下不存在tsung.log,則需通過選項--stats 指定統(tǒng)計日志文件,執(zhí)行該腳本后將在當(dāng)前目錄下生成相關(guān)統(tǒng)計報告目錄及文檔
2)以上為本機上執(zhí)行的實際情況,點擊report.html在瀏覽器中打開將看到如下界面:

Tsung:開源多協(xié)議分布式負(fù)載&壓力測試工具


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI