我开始使用tsung用socket.io来测试我的服务器.
我下载了Github Zip,编译并安装了最新的"dev",包括Websockets兼容性.
在此邮件列表中浏览了大量Google搜索结果和消息后,我找不到任何问题的答案.我的问题是我无法向socket.io服务器发送/接收消息.我能够通过握手连接到我的套接字,但是当我发送消息时没有任何反应.我试图使用bidir = true属性,但没有任何改变.
在我的tsung日志中,我收到了以下消息:
= INFO REPORT ==== 2013年9月5日:: 08:08:00 ===
ts_client:(7:<0.93.0>)连接到端口80
= INFO REPORT ==== 2013年9月5日:: 08:08:00 ===
ts_client:(3:<0.93.0>)从状态中的socket接收数据,停止
在我的套接字日志(服务器端)中,我收到了以下消息:
debug:客户端授权
info:传输结束(undefined)
debug:清除客户端b07GKwmOJPQVDwznBzN1的心跳间隔
debug:丢弃传输
您可以在此处找到我的tsung.xml文件:http://pastebin.com/A60PpKrL
请帮忙,
亲切的问候,
阿尔诺
我试图在Mac OS X 10.9上运行tsung(通过brew安装)运行tsung_stats.pl并出现错误:
无法在@INC中找到Template.pm(@INC包含:/Library/Perl/5.16/darwin-thread-multi-2level /Library/Perl/5.16/Network/Library/Perl/5.16/darwin-thread-multi- 2level /Network/Library/Perl/5.16 /Library/Perl/Updates/5.16.2 /System/Library/Perl/5.16/darwin-thread-multi-2level /System/Library/Perl/5.16/System/Library/Perl /额外/ 5.16/darwin-thread-multi-2level /System/Library/Perl/Extras/5.16.)在tsung_stats.pl第564行
我搜索,似乎我必须安装perl模板,所以我运行"sudo cpan模板",但仍然得到相同的错误.
cpan和perl都在/ usr/bin /中.Tsung位于/usr/local/Cellar/tsung/1.5.0/bin/tsung
版本是:perl:perl 5,version 16,subversion 2(v5.16.2)cpan:1.57 tsung:1.5.0
我搜索了我的系统,发现没有文件名Template.pm.我找到的最接近的是两个TextTemplate.pm文件
/System/Library/Perl/Extras/5.16/Locale/Maketext/Extract/Plugin/
/System/Library/Perl/Extras/5.12/Locale/Maketext/Extract/Plugin/
Run Code Online (Sandbox Code Playgroud)
以下代码段从第563行开始:
sub html_report {
require Template;
my $titre = 'Tsung ';
my $version = $tagvsn;
my $contact = 'tsung-users@process-one.net';
my $output = 'index.html';
my $tt = Template->new({
INCLUDE_PATH => $template_dir,
PRE_CHOMP => 1,
INTERPOLATE => 1,
}) or die "Template error " . Template->error();
my $xml_conf;
opendir (DIR, ".") or warn "can't open …Run Code Online (Sandbox Code Playgroud) 我正在编写一个库,以一种可以被rails应用程序更好地使用的方式来包装tsung的功能.我想写一些归结为以下内容的集成测试:
对于第1步,虽然我可以在外部启动一个vanilla rails应用程序(例如%x{rails s}),但我很确定有一种更好的方法可以以编程方式创建一个适合测试的简单Web服务器.
tl; dr - 在测试中以编程方式启动简单Web服务器的方法是什么?
我使用tsung时遇到了问题:
我在一个目录中有几个文件,我必须发送到服务器.我用这个文件列表创建文件(fullpath)并为tsung config添加一个选项:
<option name="file_server" id="xml_files" value="/home/ubuntu/.tsung/files"></option>
Run Code Online (Sandbox Code Playgroud)
我的目标是从该文件中选择一个随机文件路径并发送到服务器.为此,我编写了配置的这一部分:
<setdynvars sourcetype="file" fileid="xml_files" delimiter=";"
order="random">
<var name="file_name" />
</setdynvars>
<request subst="true">
<http url="/" version="1.1" method="POST"
contents_from_file="%%_file_name%%"></http>
</request>
Run Code Online (Sandbox Code Playgroud)
但这不起作用.当我将attr contents_from_file设置为常量时,一切正常.有没有办法用变量做到这一点?
我目前正在尝试建立一个使用 Erlang 从属功能的分布式 Tsung 负载测试环境,但是我没有成功让控制器节点启动从属节点。例如
(musicglue@load1)1> net:ping(musicglue@load2).
pong
(musicglue@load1)2> slave:start(load2,musicglue,"-setcookie tom").
{error,timeout}
Run Code Online (Sandbox Code Playgroud)
我的环境:
控制器 - 主机名:load1,用户:musicglue,Ubuntu 10.04 LTS,从源代码编译的 Erlang R15B01
有效的事情:
平输出:
musicglue@load1:~$ erl -rsh ssh -sname musicglue -setcookie tom
Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] [async-threads:
0] [hipe] [kernel-poll:false]
Eshell V5.9.1 (abort with ^G)
(musicglue@load1)1> net:ping(musicglue@load2).
pong …Run Code Online (Sandbox Code Playgroud) 我试图从我的Mac OS X机器发出一个Tsung请求,但我没有太多运气.
我编辑了〜/ .tsung/tsung.xml配置文件,甚至尝试使用-f参数多次更改该文件的位置.
当我运行tsung start时,它返回此输出
dave:/Applications/MAMP/htdocs/barebonessite/wp-content/themes/barebones $ tsung -f ~/.tsung/tsung.xml -l . start
Starting Tsung
"Log directory is: /Applications/MAMP/htdocs/barebonessite/wp- content/themes/barebones/./20130503-1325"
Config Error, aborting ! {{case_clause,{error,enoent}},
[{xmerl_scan,fetch_DTD,2,
[{file,"xmerl_scan.erl"},{line,1283}]},
{xmerl_scan,scan_doctype2,3,
[{file,"xmerl_scan.erl"},{line,1227}]},
{xmerl_scan,scan_prolog,4,
[{file,"xmerl_scan.erl"},{line,722}]},
{xmerl_scan,scan_document,2,
[{file,"xmerl_scan.erl"},{line,563}]},
{xmerl_scan,file,2,
[{file,"xmerl_scan.erl"},{line,249}]},
{ts_config,read,2,
[{file,"src/tsung_controller/ts_config.erl"},
{line,68}]},
{ts_config_server,handle_call,3,
[{file,
"src/tsung_controller/ts_config_server.erl"},
{line,198}]},
{gen_server,handle_msg,5,
[{file,"gen_server.erl"},{line,588}]}]}
Run Code Online (Sandbox Code Playgroud)
我的配置文件如下所示:
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" version="1.0">
<clients>
<client host='localhost' use_controller_vm='true'/>
</clients>
<servers>
<server host="54.225.212.193" port="80" type="tcp"></server
</servers>
<load>
<arrivalphase phase="1" duration="10" unit="minute">
<users maxnumber="650" arrivalrate="8" unit="second"/>
</arrivalphase>
</load>
<sessions>
<session …Run Code Online (Sandbox Code Playgroud) 我正在尝试加载测试websocket服务器.服务器接受并发送application/json,交互似乎相当不错.
服务器正确接受客户端(tsung)发送的消息.不幸的是,从客户端的角度来看,它无法读取响应,我认为可能与至少在查看tsung.dump的消息有关,我看到像NUL,SOH,SI等的ASCII字符,但我也看到了json的响应来自服务器莫名其妙.
这是我的tsung.xml文件片段:
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/local/Cellar/tsung/1.5.0/share/tsung/tsung-1.0.dtd">
<tsung loglevel="debug" dumptraffic="true">
<clients>
<client host="localhost" use_controller_vm="true" maxusers="1000" />
</clients>
<servers>
<server host="127.0.0.1" port="8282" type="tcp" />
</servers>
<load>
<arrivalphase phase="1" duration="120" unit="second">
<users maxnumber="1" arrivalrate="1" unit="second" />
</arrivalphase>
</load>
<sessions>
<session name="websocket" probability="100" type="ts_websocket">
<request subst="true">
<websocket type="connect" path="/fancyurl?Content-Type=application/json"></websocket>
</request>
<transaction name="getsession">
<request subst="true">
<dyn_variable name="sessionid" jsonpath="session"/>
<websocket type="message">{"type": "EventMessageCmd", "user": "lnramirez", "eventCode" : "epfl"}
</websocket>
</request>
</transaction>
<thinktime value="10"/>
<request>
<dyn_variable name="boothAck" jsonpath="commandStatus" />
<websocket type="message">
{
"user": "lramirezmonterosa",
"eventCode": …Run Code Online (Sandbox Code Playgroud) 开放式和近端负载测试有什么区别?
基于线程的负载测试工具属于哪一类?
以下是每个类别中负载测试工具的一些示例?
我正在本地计算机上用Tsung测试eJabberd服务器.这是我的配置文件.一切正常,正常运行.
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/local/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" dumptraffic="false" version="1.0">
<clients>
<client host="localhost" maxusers="28000" use_controller_vm="true">
</client>
</clients>
<servers>
<server host='127.0.0.1' port='5222' type='tcp'/>
</servers>
<monitoring>
<monitor host="localhost" type="erlang"/>
</monitoring>
<!-- register 15000 users in less than 15 minutes -->
<load>
<arrivalphase phase="1" duration="5" unit="minute">
<users maxnumber="15000" interarrival="0.0025" unit="second"></users>
</arrivalphase>
</load>
<options>
<option type="ts_jabber" name="global_number" value="15000"></option>
<option type="ts_jabber" name="userid_max" value="15000"></option>
<option type="ts_jabber" name="domain" value="localhost"></option>
<option type="ts_jabber" name="username" value="test"></option>
<option type="ts_jabber" name="passwd" value="password"></option>
</options>
<sessions>
<session probability="100" name="jabber-example" type="ts_jabber">
<request> <jabber type="connect" …Run Code Online (Sandbox Code Playgroud) 我正在尝试用Tsung创建一个POST请求
<request>
<http url="api.whatever.com" method="POST" version="1.1" contents=""></http>
</request>
Run Code Online (Sandbox Code Playgroud)
如何在contents属性中发送JSON文档?
contents='{"name": "alex"}'
Run Code Online (Sandbox Code Playgroud)
当然是无效的......
有没有办法用我的POST请求发送JSON?