Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: ca5a5330b8
Fetching contributors…

Cannot retrieve contributors at this time

4570 lines (4445 sloc) 267.79 kb
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>Tsung User's manual
</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META name="GENERATOR" content="hevea 1.10">
<STYLE type="text/css">
.li-itemize{margin:1ex 0ex;}
.li-enumerate{margin:1ex 0ex;}
.dd-description{margin:0ex 0ex 1ex 4ex;}
.dt-description{margin:0ex;}
.toc{list-style:none;}
.thefootnotes{text-align:left;margin:0ex;}
.dt-thefootnotes{margin:0em;}
.dd-thefootnotes{margin:0em 0em 0em 2em;}
.footnoterule{margin:1em auto 1em 0px;width:50%;}
.caption{padding-left:2ex; padding-right:2ex; margin-left:auto; margin-right:auto}
.title{margin:2ex auto;text-align:center}
.center{text-align:center;margin-left:auto;margin-right:auto;}
.flushleft{text-align:left;margin-left:0ex;margin-right:auto;}
.flushright{text-align:right;margin-left:auto;margin-right:0ex;}
DIV TABLE{margin-left:inherit;margin-right:inherit;}
PRE{text-align:left;margin-left:0ex;margin-right:auto;}
BLOCKQUOTE{margin-left:4ex;margin-right:4ex;text-align:left;}
TD P{margin:0px;}
.boxed{border:1px solid black}
.textboxed{border:1px solid black}
.vbar{border:none;width:2px;background-color:black;}
.hbar{border:none;height:2px;width:100%;background-color:black;}
.hfill{border:none;height:1px;width:200%;background-color:black;}
.vdisplay{border-collapse:separate;border-spacing:2px;width:auto; empty-cells:show; border:2px solid red;}
.vdcell{white-space:nowrap;padding:0px;width:auto; border:2px solid green;}
.display{border-collapse:separate;border-spacing:2px;width:auto; border:none;}
.dcell{white-space:nowrap;padding:0px;width:auto; border:none;}
.dcenter{margin:0ex auto;}
.vdcenter{border:solid #FF8000 2px; margin:0ex auto;}
.minipage{text-align:left; margin-left:0em; margin-right:auto;}
.marginpar{border:solid thin black; width:20%; text-align:left;}
.marginparleft{float:left; margin-left:0ex; margin-right:1ex;}
.marginparright{float:right; margin-left:1ex; margin-right:0ex;}
.theorem{text-align:left;margin:1ex auto 1ex 0ex;}
.part{margin:2ex auto;text-align:center}
</STYLE>
<style type="text/css">
<!--
body {font-size: 90%; margin-right:40px; margin-left:40px; font-family:Sans-Serif; color:#000000; background-color:#ffffff;}
p, .n {font-size: 90%; font-family:Sans-Serif; color:#000000; background-color:#ffffff;}
h1 {font-size: 200%; color:#800000; background-color:#ffffff;}
h2 {font-size:150%; color:#000080; background-color:#ffffff;}
h3 {font-family:Sans-Serif; font-size: 120%; font-weight:bold; color:#000080; background-color:#ffffff;}
h4 {font-family:Sans-Serif; font-size:100%; font-weight:bold; color:#000080; background-color:#ffffff;}
h5 {font-family:Sans-Serif; font-size:100%; font-weight:bold; color:#000000; background-color:#ffffff; margin-bottom: 0;}
form {margin-bottom:-5px;}
textarea {color:#333333; background-color:#ffffff; width:90%;}
table {font-size:90%;}
dl,ul,ol {margin-top: 2pt; margin-bottom: 2pt;}
tt, pre {font-family:monospace; color:#666666; background-color:#ffffff;}
pre {
background-color: #ffffee;
white-space:pre;
border-style:solid;
border-width:thin;
border-color:#999999;
color:#333333;
// padding:3px;
margin-bottom: -1pt;
width:100%;
}
a:link {color:#800000; background-color: #ffffff;}
a:visited {color:#006600; background-color: #ffffff;}
a:active {color:green; background-color: #ffffff;}
a:hover {background:#ffffaa;}
.piedpage, .entete {
font-family:Sans-Serif; font-size:90%; font-style:italic; color:#0000ff; background-color: #ffffff;
text-align: center;
}
-->
</style>
</HEAD>
<BODY >
<!--HEVEA command line is: hevea -fix -I ./styles -exec xxdate.exe -pedantic TSUNG.hva user_manual.tex -->
<!--HTMLHEAD-->
<DIV class="entete">
&nbsp;<A href="http://tsung.erlang-projects.org/">http://tsung.erlang-projects.org/</A>
</DIV>
<HR>
<!--ENDHTML-->
<!--CUT DEF section 1 --><H1 ALIGN=center>Tsung User’s manual</H1><DIV CLASS="center">
<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=1><TR><TD ALIGN=left NOWRAP bgcolor="#F2F2F2"> Version:</TD><TD ALIGN=left NOWRAP>1.5.0</TD></TR>
<TR><TD ALIGN=left NOWRAP bgcolor="#F2F2F2"> Date :</TD><TD ALIGN=left NOWRAP>October 2, 2012</TD></TR>
</TABLE>
</DIV><!--TOC section Contents-->
<H2 CLASS="section"><!--SEC ANCHOR -->Contents</H2><!--SEC END --><UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc1">1  Introduction</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc2">1.1  What is Tsung ?</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc3">1.2  What is Erlang and why is it important for Tsung ?</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc4">1.3  Tsung background</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc5">2  Features</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc6">2.1  Tsung main features</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc7">2.2  HTTP related features</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc8">2.3  WEBDAV related features</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc9">2.4  Jabber/XMPP related features</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc10">2.5  PostgreSQL related features</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc11">2.6  MySQL related features</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc12">2.7  Websocket related features</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc13">2.8  LDAP related features</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc14">2.9  Complete reports set</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc15">2.10  Highlights</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc16">3  Installation</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc17">3.1  Dependencies</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc18">3.2  Compilation</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc19">3.3  Configuration</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc20">3.4  Running</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc21">3.5  Feedback</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc22">4  Benchmark approach</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc23">4.1  HTTP/WebDAV benchmark approach</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc24">4.1.1  Benchmarking a Web server</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc25">4.1.2  WEBDAV </A>
</LI><LI CLASS="li-toc"><A HREF="#htoc26">4.1.3  Benchmarking a proxy server</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc27">4.2  LDAP benchmark approach</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc28">4.3  PostgreSQL benchmark approach</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc29">4.4  MySQL benchmark approach</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc30">4.5  Jabber/XMPP benchmark approach</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc31">4.5.1  Overview</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc32">4.5.2  Acknowledgments of messages</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc33">4.5.3  Status: Offline, Connected and Online</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc34">4.5.4  Authentication</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc35">4.5.5  Privacy list testing</A>
</LI></UL>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc36">5  Using the proxy recorder</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc37">5.1  PostgreSQL</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc38">5.2  HTTP and WEBDAV</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc39">6  Understanding tsung.xml configuration file</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc40">6.1  File structure</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc41">6.2  Clients and server</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc42">6.2.1  Basic setup</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc43">6.2.2  Advanced setup</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc44">6.2.3  Running Tsung with a job scheduler</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc45">6.3  Monitoring</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc46">6.3.1  Erlang</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc47">6.3.2  SNMP</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc48">6.3.3  Munin</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc49">6.4  Defining the load progression</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc50">6.4.1  Randomly generated users</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc51">6.4.2  Statically generated users</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc52">6.4.3  Duration of the load test</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc53">6.5  Setting options</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc54">6.5.1  XMPP/Jabber options</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc55">6.5.2  HTTP options</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc56">6.6  Sessions</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc57">6.6.1  Thinktimes</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc58">6.6.2  HTTP</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc59">6.6.3  Jabber/XMPP</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc60">6.6.4  PostgreSQL</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc61">6.6.5  MySQL</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc62">6.6.6  Websocket</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc63">6.6.7  LDAP</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc64">6.6.8  Mixing session type</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc65">6.7  Advanced features</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc66">6.7.1  Dynamic substitutions</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc67">6.7.2  Reading external file</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc68">6.7.3  Dynamic variables</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc69">6.7.4  Checking the server’s response</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc70">6.7.5  Loops, If, Foreach</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc71">6.7.6  Rate limiting</A>
</LI></UL>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc72">7  Statistics and reports</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc73">7.1  File format</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc74">7.2  Available stats</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc75">7.3  Design</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc76">7.4  Generating the report</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc77">7.5  Tsung summary</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc78">7.6  Graphical overview</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc79">7.7  Tsung Plotter</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc80">7.8  RRD</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc81">8  References</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc82">9  Acknowledgments</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc83">A  Frequently Asked Questions</A>
<UL CLASS="toc"><LI CLASS="li-toc">
<A HREF="#htoc84">A.1  Can’t start distributed clients: timeout error </A>
</LI><LI CLASS="li-toc"><A HREF="#htoc85">A.2  Tsung crashes when I start it </A>
</LI><LI CLASS="li-toc"><A HREF="#htoc86">A.3  Why do i have error_connect_emfile errors ?</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc87">A.4  Tsung still crashes/fails when I start it !</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc88">A.5  Can I dynamically follow redirect with HTTP ?</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc89">A.6  What is the format of the stats file tsung.log ?</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc90">A.7  How can I compute percentile/quartiles/median for transactions or requests
response time ?</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc91">A.8  How can I specify the number of concurrent users ?</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc92">A.9  SNMP monitoring doesn’t work ?!</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc93">A.10  How can i simulate a fix number of users ?</A>
</LI></UL>
</LI><LI CLASS="li-toc"><A HREF="#htoc94">B  Errors list</A>
</LI><LI CLASS="li-toc"><A HREF="#htoc95">C  CHANGELOG</A>
</LI></UL><!--TOC section Introduction-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc1">1</A>  Introduction</H2><!--SEC END --><!--TOC subsection What is Tsung ?-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc2">1.1</A>  What is Tsung ?</H3><!--SEC END --><P><EM>Tsung</EM> (formerly IDX-Tsunami) is a distributed load testing tool. It is
protocol-independent and can currently be used to stress HTTP, WebDAV, SOAP,
PostgreSQL, MySQL, LDAP, and Jabber/XMPP servers.</P><P>It is distributed under the GNU General Public License version 2.</P><!--TOC subsection What is Erlang and why is it important for Tsung ?-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc3">1.2</A>  What is Erlang and why is it important for Tsung ?</H3><!--SEC END --><P><EM>Tsung’s</EM> main strength is its ability to simulate a huge number of
simultaneous user from a single machine. When used on cluster, you can
generate a really impressive load on a server with a modest cluster,
easy to set-up and to maintain. You can also use Tsung on a cloud like EC2.</P><P><EM>Tsung</EM> is developed in Erlang and this is where the power
of <EM>Tsung</EM> resides.</P><P>Erlang is a <EM>concurrency-oriented</EM> programming language.
Tsung is based on the Erlang OTP (Open Transaction Platform) and
inherits several characteristics from Erlang:</P><UL CLASS="itemize"><LI CLASS="li-itemize">
<EM>Performance</EM>: Erlang has been made to support hundred thousands
of lightweight processes in a single virtual machine.
</LI><LI CLASS="li-itemize"><EM>Scalability</EM>: Erlang runtime environment is naturally
distributed, promoting the idea of process’s location transparency.
</LI><LI CLASS="li-itemize"><EM>Fault-tolerance</EM>:Erlang has been built to develop robust,
fault-tolerant systems. As such, wrong answer sent from the server
to <EM>Tsung</EM> does not make the whole running benchmark crash.
</LI></UL><P>More information on Erlang on <A HREF="http://www.erlang.org"><TT>http://www.erlang.org</TT></A> and
<A HREF="http://www.erlang-projects.org/"><TT>http://www.erlang-projects.org/</TT></A></P><!--TOC subsection Tsung background-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc4">1.3</A>  Tsung background</H3><!--SEC END --><P>History:
</P><UL CLASS="itemize"><LI CLASS="li-itemize">
<EM>Tsung</EM> development was started by Nicolas Niclausse in
2001 as a distributed jabber load stress tool for internal use at
<A HREF="http://IDEALX.com/"><TT>http://IDEALX.com/</TT></A> (now OpenTrust). It has evolved as an open-source
multi-protocol load testing tool several months later. The HTTP
support was added in 2003, and this tool has been used for several
industrial projects. It is now hosted by Erlang-projects, and
supported by <A HREF="http://process-one.net/"><TT>http://process-one.net/</TT></A>. The list of contributors
is available in the source archive
(<A HREF="https://git.process-one.net/tsung/mainline/blobs/master/CONTRIBUTORS"><TT>https://git.process-one.net/tsung/mainline/blobs/master/CONTRIBUTORS</TT></A>).</LI><LI CLASS="li-itemize">It is an industrial strength implementation of a <EM>stochastic model</EM>
for real users simulation. User events distribution is based on a
Poisson Process. More information on this topic in:<P>Z. Liu, N. Niclausse, and C. Jalpa-Villanueva. <B>Traffic Model
and Performance Evaluation of Web Servers</B>. <EM>Performance Evaluation,
Volume 46, Issue 2-3, October 2001</EM>.</P></LI><LI CLASS="li-itemize">This model has already been tested in the INRIA <EM>WAGON</EM>
research prototype (Web trAffic GeneratOr and beNchmark). WAGON was
used in the <A HREF="http://www.vthd.org/"><TT>http://www.vthd.org/</TT></A> project (Very High Broadband
IP/WDM test platform for new generation Internet applications, 2000-2004).</LI></UL><P><EM>Tsung</EM> has been used for very high load tests:</P><UL CLASS="itemize"><LI CLASS="li-itemize">
<EM>Jabber/XMPP</EM> protocol:
<UL CLASS="itemize"><LI CLASS="li-itemize">
90 000 simultaneous jabber users on a
4-node Tsung cluster (3xSun V240 + 1 Sun V440)
</LI><LI CLASS="li-itemize">10 000 simultaneous users.
<EM>Tsung</EM> was running on a 3-computers cluster (CPU
800MHz)
</LI></UL>
</LI><LI CLASS="li-itemize"><EM>HTTP and HTTPS</EM> protocol:
<UL CLASS="itemize"><LI CLASS="li-itemize">
12 000 simultaneous users.
<EM>Tsung</EM> were running on a 4-computers cluster (in 2003). The
tested platform reached 3 000 requests per second.
</LI><LI CLASS="li-itemize">10 million simultaneous users running on a 75-computers cluster,
generating more than one million requests per second.
</LI></UL>
</LI></UL><P><EM>Tsung</EM> has been used at:</P><UL CLASS="itemize"><LI CLASS="li-itemize">
<EM>DGI</EM> (Direction Générale des impôts): French finance ministry
</LI><LI CLASS="li-itemize"><EM>Cap Gemini Ernst &amp; Young</EM>
</LI><LI CLASS="li-itemize"><EM>IFP</EM> (Institut Français du Pétrole): French Research Organization
for Petroleum
</LI><LI CLASS="li-itemize"><EM>LibertySurf</EM>
</LI><LI CLASS="li-itemize">Sun™for their Mooddlerooms platform on Niagara processors:
<A HREF="http://blogs.sun.com/kevinr/resource/Moodle-Sun-RA.pdf"><TT>http://blogs.sun.com/kevinr/resource/Moodle-Sun-RA.pdf</TT></A>
</LI></UL><!--TOC section Features-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc5">2</A>  Features</H2><!--SEC END --><!--TOC subsection Tsung main features-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc6">2.1</A>  Tsung main features</H3><!--SEC END --><UL CLASS="itemize"><LI CLASS="li-itemize">
<EM>High Performance</EM>: <EM>Tsung</EM> can simulate a
huge number of simultaneous users per physical computer: It can
simulates thousands of users on a single CPU (Note: a simulated user
is not always active: it can be idle during a <TT>thinktime</TT>
period). Traditional injection tools can hardly go further than a
few hundreds (Hint: if all you want to do is requesting a single URL
in a loop, use <EM>ab</EM>; but if you want to build complex
scenarios with extended reports, <EM>Tsung</EM> is for you).
</LI><LI CLASS="li-itemize"><EM>Distributed</EM>: the load can be distributed on a cluster of
client machines
</LI><LI CLASS="li-itemize"><EM>Multi-Protocols</EM> using a plug-in system: HTTP (both standard
web traffic and SOAP), WebDAV, Jabber/XMPP and PostgreSQL are currently
supported. LDAP and MySQL plugins were first included in the 1.3.0 release.
</LI><LI CLASS="li-itemize"><EM>SSL</EM> support
</LI><LI CLASS="li-itemize"><EM>Several IP addresses</EM> can be used on a single machine using
the underlying OS IP Aliasing
</LI><LI CLASS="li-itemize"><EM>OS monitoring</EM> (CPU, memory and network traffic) using Erlang
agents on remote servers or <EM>SNMP</EM>
</LI><LI CLASS="li-itemize"><EM>XML configuration system</EM>: complex user’s scenarios are written
in XML. Scenarios can be written with a simple browser using the
Tsung recorder (HTTP and PostgreSQL only).
</LI><LI CLASS="li-itemize"><EM>Dynamic scenarios</EM>: You can get dynamic data from the
server under load (without writing any code) and re-inject it in
subsequent requests. You can also loop, restart or stop a
session when a string (or regexp) matches the server response.
</LI><LI CLASS="li-itemize"><EM>Mixed behaviours</EM>: several sessions can be used to simulate
different type of users during the same benchmark. You can define
the proportion of the various behaviours in the benchmark scenario.
</LI><LI CLASS="li-itemize"><EM>Stochastic processes</EM>: in order to generate a realistic traffic,
user thinktimes and the arrival rate can be randomized using a probability
distribution (currently exponential)
</LI></UL><!--TOC subsection HTTP related features-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc7">2.2</A>  HTTP related features</H3><!--SEC END --><UL CLASS="itemize"><LI CLASS="li-itemize">
HTTP/1.0 and HTTP/1.1 support
</LI><LI CLASS="li-itemize">GET, POST, PUT, DELETE and HEAD requests
</LI><LI CLASS="li-itemize">Cookies: Automatic cookies management( but you can also manually
add more cookies)
</LI><LI CLASS="li-itemize"><CODE>'</CODE>GET If-modified since<CODE>'</CODE> type of request
</LI><LI CLASS="li-itemize">WWW-authentication Basic and Digest. OAuth 1.0
</LI><LI CLASS="li-itemize">User Agent support
</LI><LI CLASS="li-itemize">Any HTTP Headers can be added
</LI><LI CLASS="li-itemize">Proxy mode to record sessions using a Web browser
</LI><LI CLASS="li-itemize">SOAP support using the HTTP mode (the SOAPAction HTTP header is
handled).
</LI><LI CLASS="li-itemize">HTTP server or proxy server load testing.
</LI></UL><!--TOC subsection WEBDAV related features-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc8">2.3</A>  WEBDAV related features</H3><!--SEC END --><P>The WebDAV (RFC 4918) plugin is a superset of the HTTP plugin. It adds the
following features (some versionning extensions to WebDAV (RFC 3253)
are also supported):</P><UL CLASS="itemize"><LI CLASS="li-itemize">
Methods implemented: DELETE, CONNECT, PROPFIND, PROPPATCH, COPY,
MOVE, LOCK, UNLOCK, MKCOL, REPORT, OPTIONS, MKACTIVITY, CHECKOUT, MERGE
</LI><LI CLASS="li-itemize">Recording of DEPTH, IF, TIMEOUT OVERWRITE, DESTINATION, URL and
LOCK-TOKEN Headers.
</LI></UL><!--TOC subsection Jabber/XMPP related features-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc9">2.4</A>  Jabber/XMPP related features</H3><!--SEC END --><UL CLASS="itemize"><LI CLASS="li-itemize">
Authentication (plain-text, digest and sip-digest). STARTTLS
</LI><LI CLASS="li-itemize">presence and register messages
</LI><LI CLASS="li-itemize">Chat messages to online or offline users
</LI><LI CLASS="li-itemize">MUC: join room, send message in room, change nickname
</LI><LI CLASS="li-itemize">Roster set and get requests
</LI><LI CLASS="li-itemize">Global users<CODE>'</CODE> synchronization can be set on specific actions
</LI><LI CLASS="li-itemize">BOSH &amp; XMPP over Websocket
</LI><LI CLASS="li-itemize">raw XML messages
</LI><LI CLASS="li-itemize">PubSub
</LI><LI CLASS="li-itemize">Multiple vhost instances supported
</LI><LI CLASS="li-itemize">privacy lists: get all privacy list names, set list as active
</LI></UL><!--TOC subsection PostgreSQL related features-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc10">2.5</A>  PostgreSQL related features</H3><!--SEC END --><UL CLASS="itemize"><LI CLASS="li-itemize">
Basic and MD5 Authentication
</LI><LI CLASS="li-itemize">Simple Protocol
</LI><LI CLASS="li-itemize">Extended Protocol (new in version <B>1.4.0</B> )
</LI><LI CLASS="li-itemize">Proxy mode to record sessions
</LI></UL><!--TOC subsection MySQL related features-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc11">2.6</A>  MySQL related features</H3><!--SEC END --><P>
This plugin is experimental. It works only with MySQL version 4.1 and higher.
</P><UL CLASS="itemize"><LI CLASS="li-itemize">
Secured Authentication method only (MySQL &gt;= 4.1)
</LI><LI CLASS="li-itemize">Basic Queries
</LI></UL><!--TOC subsection Websocket related features-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc12">2.7</A>  Websocket related features</H3><!--SEC END --><P>
This plugin is experimental. It only support rfc6455 currently.
</P><UL CLASS="itemize"><LI CLASS="li-itemize">
Both as a server type and session type
</LI></UL><!--TOC subsection LDAP related features-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc13">2.8</A>  LDAP related features</H3><!--SEC END --><UL CLASS="itemize"><LI CLASS="li-itemize">
bind
</LI><LI CLASS="li-itemize">add, modify and search queries
</LI><LI CLASS="li-itemize">starttls
</LI></UL><!--TOC subsection Complete reports set-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc14">2.9</A>  Complete reports set</H3><!--SEC END --><P>Measures and statistics produced by Tsung are extremely feature-full.
They are all represented as a graphic. <EM>Tsung</EM> produces
statistics regarding:</P><UL CLASS="itemize"><LI CLASS="li-itemize">
<EM>Performance</EM>: response time, connection time, decomposition of the user scenario based on request grouping instruction (called <I>transactions</I>), requests per second
</LI><LI CLASS="li-itemize"><EM>Errors</EM>: Statistics on page return code to trace errors
</LI><LI CLASS="li-itemize"><EM>Target server behaviour</EM>: An Erlang agent can gather information
from the target server(s). Tsung produces graphs for CPU and memory
consumption and network traffic. SNMP and munin is also supported to
monitor remote servers.
</LI></UL><P>Note that <EM>Tsung</EM> takes care of the synchronization process
by itself. Gathered statistics are «synchronized».</P><P>It is possible to generate graphs during the benchmark as statistics
are gathered in real-time.</P><!--TOC subsection Highlights-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc15">2.10</A>  Highlights</H3><!--SEC END --><P><EM>Tsung</EM> has several advantages over other injection tools:</P><UL CLASS="itemize"><LI CLASS="li-itemize">
<EM>High performance</EM> and <EM>distributed benchmark</EM>: You
can use Tsung to simulate tens of thousands of virtual users.
</LI><LI CLASS="li-itemize"><EM>Ease of use</EM>: The hard work is already done for all supported
protocol. No need to write complex scripts. Dynamic scenarios only
requires small trivial piece of code.
</LI><LI CLASS="li-itemize"><EM>Multi-protocol support</EM>: <EM>Tsung</EM> is for example one of
the only tool to benchmark SOAP applications
</LI><LI CLASS="li-itemize"><EM>Monitoring</EM> of the target server(s) to analyze the behaviour
and find bottlenecks. For example, it has been used to analyze cluster
symmetry (is the load properly balanced ?) and to determine the best
combination of machines on the three cluster tiers (Web engine, EJB
engine and database)
</LI></UL><!--TOC section Installation-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc16">3</A>  Installation</H2><!--SEC END --><P>This package has been tested on Linux, FreeBSD and Solaris. A port is
available on MacOS X. It should
work on Erlang supported platforms (Linux, Solaris, *BSD, Win32 and
MacOS-X).</P><!--TOC subsection Dependencies-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc17">3.1</A>  Dependencies</H3><!--SEC END --><UL CLASS="itemize"><LI CLASS="li-itemize">
Erlang/OTP R13B and up
(<A HREF="http://www.erlang.org/download.html"><TT>http://www.erlang.org/download.html</TT></A>). Erlang is now
part of fedora and debian/ubuntu repositories.
</LI><LI CLASS="li-itemize">pgsql module made by Christian Sunesson (for the PostgreSQL plugin):
sources available at
<A HREF="http://jungerl.sourceforge.net/"><TT>http://jungerl.sourceforge.net/</TT></A> . The module is
included in the source and binary distribution of <EM>Tsung</EM>. It
is released under the EPL License.
</LI><LI CLASS="li-itemize">mysql module made by Magnus Ahltorp &amp; Fredrik Thulin (for the mysql plugin):
sources available at
<A HREF="http://www.stacken.kth.se/projekt/yxa/"><TT>http://www.stacken.kth.se/projekt/yxa/</TT></A> . The modified module is
included in the source and binary distribution of <EM>Tsung</EM>. It
is released under the three-clause BSD License.
</LI><LI CLASS="li-itemize">eldap module (for the LDAP plugin):
sources available at
<A HREF="http://jungerl.sourceforge.net/"><TT>http://jungerl.sourceforge.net/</TT></A> . The module is
included in the source and binary distribution of <EM>Tsung</EM>. It
is released under the GPL License.
</LI><LI CLASS="li-itemize">mochiweb libs (for xpath parsing, optionally used for dynamic variables in
the HTTP plugin):
sources available at
<A HREF="http://code.google.com/p/mochiweb/"><TT>http://code.google.com/p/mochiweb/</TT></A> . The module is
included in the source and binary distribution of <EM>Tsung</EM>. It
is released under the MIT License.
</LI><LI CLASS="li-itemize">gnuplot and perl5 (optional; for graphical output with
<TT>tsung_stats.pl</TT> script). The Template Toolkit is used for HTML
reports (see <A HREF="http://template-toolkit.org/"><TT>http://template-toolkit.org/</TT></A>)
</LI><LI CLASS="li-itemize">python and mathplotlib (optional; for graphical output with
<TT>tsung-plotter</TT>).
</LI><LI CLASS="li-itemize">for distributed tests, you need an ssh access to remote
machines without password (use a RSA/DSA key without pass-phrase or
ssh-agent) (rsh is also supported)
</LI><LI CLASS="li-itemize">bash
</LI></UL><!--TOC subsection Compilation-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc18">3.2</A>  Compilation</H3><!--SEC END --><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">./configure
make
make install
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>If you want to download the development version, use git:</P><P><TT>git clone git://git.process-one.net/tsung/mainline.git</TT></P><P>(see also <A HREF="https://git.process-one.net/tsung"><TT>https://git.process-one.net/tsung</TT></A> and the github
mirror: <A HREF="https://github.com/processone/tsung"><TT>https://github.com/processone/tsung</TT></A>).</P><P>You can also build packages with <TT>make deb</TT> (on debian and
ubuntu) and <TT>make rpm</TT> (on fedora, rhel, and other rpm based distribution)</P><!--TOC subsection Configuration-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc19">3.3</A>  Configuration</H3><!--SEC END --><P>The default configuration file is <TT>~/.tsung/tsung.xml</TT> (
there are several sample files in
<TT>/usr/share/doc/tsung/examples</TT>).</P><P>Log files are saved in <TT>~/.tsung/log/</TT> . A new sub-directory
is created for each test using the current date as name
(<TT>~/.tsung/log/20040217-0940</TT> for ex.)</P><!--TOC subsection Running-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc20">3.4</A>  Running</H3><!--SEC END --><P>Two commands are installed in the directory <TT>$PREFIX/bin</TT>:
<TT>tsung</TT> and <TT>tsung-recorder</TT>. A man page is available
for both commands.</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&gt;tsung -h
Usage: tsung &lt;options&gt; start|stop|debug|status
Options:
-f &lt;file&gt; set configuration file (default is ~/.tsung/tsung.xml)
(use - for standard input)
-l &lt;logdir&gt; set log directory (default is ~/.tsung/log/YYYYMMDD-HHMM/)
-i &lt;id&gt; set controller id (default is empty)
-r &lt;command&gt; set remote connector (default is ssh)
-s enable erlang smp on client nodes
-m &lt;file&gt; write monitoring output on this file (default is tsung.log)
(use - for standard output)
-F use long names (FQDN) for erlang nodes
-w warm-up delay (default is 10 sec)
-v print version information and exit
-6 use IPv6 for tsung internal communications
-h display this help and exit
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>A typical way of using tsung is to run:
<TT>tsung -f myconfigfile.xml start</TT>.</P><P>The command will print the current log directory created for the test, and wait until the test is
over.</P><!--TOC subsection Feedback-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc21">3.5</A>  Feedback</H3><!--SEC END --><P>Use the Tsung mailing list (see
<A HREF="https://lists.process-one.net/mailman/listinfo/tsung-users"><TT>https://lists.process-one.net/mailman/listinfo/tsung-users</TT></A>) if you have
suggestions or questions about <EM>Tsung</EM>. You can also use the
bug-tracker available at <A HREF="https://support.process-one.net/browse/TSUN"><TT>https://support.process-one.net/browse/TSUN</TT></A>.
You can also try the #tsung IRC channel on Freenode.</P><!--TOC section Benchmark approach-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc22">4</A>  Benchmark approach</H2><!--SEC END --><!--TOC subsection HTTP/WebDAV benchmark approach-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc23">4.1</A>  HTTP/WebDAV benchmark approach</H3><!--SEC END --><!--TOC subsubsection Benchmarking a Web server-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc24">4.1.1</A>  Benchmarking a Web server</H4><!--SEC END --><OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">
Record one or more sessions: start the recorder with:
<TT>tsung-recorder start</TT>, and then configure your browser to use Tsung
proxy recorder (the listen port is 8090). A session file will be
created. For HTTPS recording, use <FONT COLOR=purple>http://-</FONT> instead of
<FONT COLOR=purple>https://</FONT> in your browser.
</LI><LI CLASS="li-enumerate">Edit / organize scenario, by adding recorded sessions in the
configuration file.
</LI><LI CLASS="li-enumerate">Write small code for dynamic parts if needed and place dynamic mark-up
in the scenario.
</LI><LI CLASS="li-enumerate">Test and adjust scenario to have a nice progression of the load. This
is highly dependent of the application and of the size of the target
server(s). Calculate the normal duration of the scenario and use the
interarrival time between users and the duration of the phase to estimate
the number of simultaneous users for each given phase.
</LI><LI CLASS="li-enumerate">Launch benchmark with your first application parameters set-up:
<TT>tsung start</TT> (run <TT>man tsung</TT> for more options)
</LI><LI CLASS="li-enumerate">Wait for the end of the test or stop by hand with
<TT>tsung stop</TT> (reports can also be generated during the
test (see § <A HREF="#sec:statistics-reports">7</A>) : the statistics are
updated every 10 seconds). For a brief summary of the current
activity, use <TT>tsung status</TT>
</LI><LI CLASS="li-enumerate">Analyze results, change parameters and relaunch another benchmark
</LI></OL><!--TOC subsubsection WEBDAV -->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc25">4.1.2</A>  WEBDAV </H4><!--SEC END --><P>It’s the same approach as HTTP: first you start to record one or more
sessions with the recorder:
<TT>tsung-recorder -p webdav start</TT></P><!--TOC subsubsection Benchmarking a proxy server-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc26">4.1.3</A>  Benchmarking a proxy server</H4><!--SEC END --><P>By default, the HTTP plugin is used to benchmark HTTP servers. But you
can also benchmark HTTP Proxy servers. To do that, you must add in the
<TT>options</TT> section:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;option type="ts_http" name="http_use_server_as_proxy" value="true"&gt;&lt;/option&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC subsection LDAP benchmark approach-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc27">4.2</A>  LDAP benchmark approach</H3><!--SEC END --><P>An LDAP plugin for the recorder is not yet implemented, so you have to
write the session by yourself; see section <A HREF="#sec:session:ldap">6.6.7</A> for
more information.</P><!--TOC subsection PostgreSQL benchmark approach-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc28">4.3</A>  PostgreSQL benchmark approach</H3><!--SEC END --><P>It’s the same approach as HTTP: first you start to record one or more
sessions with the recorder:
<TT>tsung-recorder -p pgsql start</TT></P><P>This will start a proxy listening to port 8090 and will proxy requests
to 127.0.0.0:5432.</P><P>To choose another port and/or address:
<TT>tsung-recorder -L 5432 -I 10.6.1.1 -P 5433 -p pgsql start</TT></P><P>This will start a proxy listening to port 5432 and will proxy requests
to 10.6.1.1:5433.</P><!--TOC subsection MySQL benchmark approach-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc29">4.4</A>  MySQL benchmark approach</H3><!--SEC END --><P>A MySQL plugin for the recorder is not yet implemented, so you have to
write the session by yourself; see section <A HREF="#sec:session:mysql">6.6.5</A> for
more information.</P><!--TOC subsection Jabber/XMPP benchmark approach-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc30">4.5</A>  Jabber/XMPP benchmark approach</H3><!--SEC END --><!--TOC subsubsection Overview-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc31">4.5.1</A>  Overview</H4><!--SEC END --><P>This paragraph explains how to write a session for Jabber/XMPP.</P><P>There are two differences between HTTP and Jabber testing:
</P><OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">
There is no recorder for Jabber, so you have to write your
sessions by hand (an example is provided in
<A HREF="#sec:sessions:jabber">6.6.3</A>).
</LI><LI CLASS="li-enumerate">the jabber plugin does not parse XML; instead it uses packet
acknowledgments.
</LI></OL><!--TOC subsubsection Acknowledgments of messages-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc32">4.5.2</A>  Acknowledgments of messages</H4><!--SEC END --><P>Since the jabber plugin does not parse XML (historically, it was for
performance reasons), you must have a way to tell when a request is
finished. There are 3 possibilities:</P><DL CLASS="description"><DT CLASS="dt-description">
<B>ack=local</B></DT><DD CLASS="dd-description"> as soon as a packet is received from the server, the
request is considered as completed. Hence if you use a local ack with a request
that do not require a response from the server (presence for ex.), it
will wait forever (or until a timeout is reached).
</DD><DT CLASS="dt-description"><B>ack=no_ack</B></DT><DD CLASS="dd-description"> as soon as the request is send, it is considered as completed (do
not wait for incoming data)
</DD><DT CLASS="dt-description"><B>ack=global</B></DT><DD CLASS="dd-description"> synchronized users. its main use is for waiting for all
users to connect before sending messages. To do that, set a request
with global ack (it can be the first presence msg:<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;request&gt; &lt;jabber type="presence" ack="global"/&gt; &lt;/request&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>You also have to specify the number of users to be connected:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&lt;option type="ts_jabber" name="global_number" value="100"&gt;&lt;/option&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>To be sure that exactly <TT>global_number</TT> users are started, add the
<FONT COLOR=purple>’maxnumber’</FONT> attribute to <TT>’users’</TT></P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;users maxnumber="100" interarrival="1.0" unit="second"&gt;&lt;/users&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>If you do not specify <TT>maxnumber</TT>, the global ack will be reset every
<TT>global_number</TT> users
</P></DD></DL><P><A NAME="bidi:presence"></A>
<B>New in 1.2.2:</B> This version adds an new option for a
session. if you set the attribute <TT>bidi</TT> (for bidirectional)
in the <TT>session</TT> tag: <FONT COLOR=purple>&lt;session ... bidi=’true’&gt;</FONT>,
then incoming messages from the server will be analyzed. Currently,
only roster subscription requests are handled: if a user received a
subscription request (<FONT COLOR=purple>&lt;presence ... type=’subscribe’&gt;</FONT>), it
will respond with a <FONT COLOR=purple>&lt;presence ... type=’subscribed’&gt;</FONT>
message.</P><!--TOC subsubsection Status: Offline, Connected and Online-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc33">4.5.3</A>  Status: Offline, Connected and Online</H4><!--SEC END --><P>You can send messages to offline or online users. A user is considered
online when he has send a <FONT COLOR=purple>presence:initial</FONT> message (before
this message , the state of the user is <TT>connected</TT>).</P><P>If you want to switch back to <TT>connected</TT> before going
<TT>offline</TT>, you can use a <FONT COLOR=purple>presence:final</FONT> message:</P><P><FONT COLOR=purple>presence:final</FONT> does two things:
</P><OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">
It removes the client from the list of Online users, and moves
them into the list of Connected users.
</LI><LI CLASS="li-enumerate">It sends a broadcast presence update of type=’unavailable’.
</LI></OL><P><FONT COLOR=purple>presence:final</FONT> is optional.</P><P><EM>warn:</EM> this is new in <B>1.2.0</B>, in earlier version, only 2
status were available: online and offline; a user was considered
online as soon as it was connected.</P><!--TOC subsubsection Authentication-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc34">4.5.4</A>  Authentication</H4><!--SEC END --><P>Below are configuration examples for the possible authentication
methods. Note: the regular expressions used here are only examples -
they may need to be altered depending on how a particular server
implementation composes messages (see also  <A HREF="#sec:jabber-options">6.5.1</A>
for password settings).</P><UL CLASS="itemize"><LI CLASS="li-itemize">
<B>plain authentication</B> - sends clear-text passwords:
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;session probability="100" name="jabber-plain" type="ts_jabber"&gt;
&lt;request&gt; &lt;jabber type="connect" ack="local"&gt;&lt;/jabber&gt; &lt;/request&gt;
&lt;thinktime value="2"&gt;&lt;/thinktime&gt;
&lt;transaction name="auth_plain"&gt;
&lt;request&gt; &lt;jabber type="auth_get" ack="local"&gt;&lt;/jabber&gt; &lt;/request&gt;
&lt;request&gt; &lt;jabber type="auth_set_plain" ack="local"&gt;&lt;/jabber&gt; &lt;/request&gt;
&lt;/transaction&gt;
...
&lt;/session&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE></LI><LI CLASS="li-itemize"><B>digest authentication</B> as described in XMPP JEP-0078: Non-SASL Authentication
<A HREF="http://www.jabber.org/jeps/jep-0078.html"><TT>http://www.jabber.org/jeps/jep-0078.html</TT></A>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;session probability="100" name="jabber-digest" type="ts_jabber"&gt;
&lt;!-- regexp captures stream ID returned by server --&gt;
&lt;request&gt;
&lt;dyn_variable name="sid" re="&amp;lt;stream:stream id=&amp;quot;(.*)&amp;quot; xmlns:stream"/&gt;
&lt;jabber type="connect" ack="local"&gt;&lt;/jabber&gt;
&lt;/request&gt;
&lt;thinktime value="2"&gt;&lt;/thinktime&gt;
&lt;transaction name="auth_digest"&gt;
&lt;request&gt; &lt;jabber type="auth_get" ack="local"&gt;&lt;/jabber&gt; &lt;/request&gt;
&lt;request subst='true'&gt; &lt;jabber type="auth_set_digest" ack="local"&gt;&lt;/jabber&gt; &lt;/request&gt;
&lt;/transaction&gt;
...
&lt;/session&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE></LI><LI CLASS="li-itemize"><B>sip-digest authentication</B>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;session probability="100" name="jabber-sipdigest" type="ts_jabber"&gt;
&lt;request&gt; &lt;jabber type="connect" ack="local"&gt;&lt;/jabber&gt; &lt;/request&gt;
&lt;thinktime value="2"&gt;&lt;/thinktime&gt;
&lt;transaction name="auth_sipdigest"&gt;
&lt;!-- regexp captures nonce value returned by server --&gt;
&lt;request&gt;
&lt;dyn_variable name="nonce"
re="&amp;lt;Nonce encoding=&amp;quot;hex&amp;quot;&amp;gt;(.*)&amp;lt;\/Nonce&amp;gt;"/&gt;
&lt;jabber type="auth_get" ack="local"&gt;&lt;/jabber&gt;
&lt;/request&gt;
&lt;request subst='true'&gt; &lt;jabber type="auth_set_sip" ack="local"&gt;&lt;/jabber&gt; &lt;/request&gt;
&lt;/transaction&gt;
...
&lt;/session&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE></LI></UL><!--TOC subsubsection Privacy list testing-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc35">4.5.5</A>  Privacy list testing</H4><!--SEC END --><P>There are two actions available to allow for rudimentary privacy lists
load testing:
</P><UL CLASS="itemize"><LI CLASS="li-itemize">
<FONT COLOR=purple>privacy:get_names</FONT> - gets the list of all names
of privacy lists stored by the server for a given user
</LI><LI CLASS="li-itemize"><FONT COLOR=purple>privacy:set_active</FONT> - sets a list with a predefined
name as active. The list name is determined from the JID,
e.g. if the user’s JID is "john@average.com" then the list name
is "john@average.com_list". One should take care of properly seeding
the server database in order to ensure that such a list exists.
</LI></UL><!--TOC section Using the proxy recorder-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc36">5</A>  Using the proxy recorder</H2><!--SEC END --><P>The recorder has three plugins: for HTTP, WebDAV and for PostgreSQL.</P><P>To start it, run <TT>tsung-recorder -p &lt;PLUGIN&gt; start</TT>, where <TT>PLUGIN</TT> can be
<FONT COLOR=purple>http</FONT>, <FONT COLOR=purple>webdav</FONT> or <FONT COLOR=purple>pgsql</FONT> for PostgreSQL. The default plugin is <FONT COLOR=purple>http</FONT>.</P><P>The proxy is listening to port 8090. You can change the port with
<FONT COLOR=purple>-L portnumber</FONT>.</P><P>To stop it, use <TT>tsung-recorder stop</TT>.</P><P>The recorded session is created as
<TT>~/.tsung/tsung_recorderYYYMMDD-HH:MM.xml</TT>; if it doesn’t work,
take a look at <TT>~/.tsung/log/tsung.log-tsung_recorder@hostname</TT></P><P>During the recording, you can add custom tag in the XML file, this can
be useful to set transactions or comments:
<TT>tsung-recorder record_tag "&lt;transaction name=’login’&gt;’’</TT></P><P>Once a session has been created, you can insert it in your main configuration
file, either by editing by hand the file, or by using an ENTITY
declaration, like:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&lt;!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd" [
&lt;!ENTITY mysession1 SYSTEM "/home/nniclausse/.tsung/tsung_recorder20051217-13:11.xml"&gt;
]&gt;
...
&lt;sessions&gt;
&amp;mysession1;
&lt;/sessions&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC subsection PostgreSQL-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc37">5.1</A>  PostgreSQL</H3><!--SEC END --><P>For PostgreSQL, the proxy will connect to the server at IP 127.0.0.1
and port 5432. Use <FONT COLOR=purple>-I serverIP</FONT> to change the IP and
<FONT COLOR=purple>-P portnumber</FONT> to change the port.</P><!--TOC subsection HTTP and WEBDAV-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc38">5.2</A>  HTTP and WEBDAV</H3><!--SEC END --><P>For HTTPS recording, use <FONT COLOR=purple>http://-</FONT> instead of
<FONT COLOR=purple>https://</FONT> in your browser</P><P><B>New in 1.2.2</B>: For HTTP, you can configure the recorder to
use a parent proxy (but this will not work for https). Add the -u
option to enable parent proxy, and use <FONT COLOR=purple>-I serverIP</FONT> to set
the IP and <FONT COLOR=purple>-P portnumber</FONT> to set the port of the parent.</P><!--TOC section Understanding tsung.xml configuration file-->
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc39">6</A>  Understanding tsung.xml configuration file</H2><!--SEC END --><P>The default encoding is utf-8. You can use a different encoding, like in:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC subsection File structure-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc40">6.1</A>  File structure</H3><!--SEC END --><P>Scenarios are enclosed into Tsung tags:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd" [] &gt;
&lt;tsung loglevel="info"&gt;
...
&lt;/tsung&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>If you add the attribute <FONT COLOR=purple>dumptraffic="true"</FONT>, all the
traffic will be logged to a file. <EM>Warn:</EM> this will considerably
slow down Tsung, so use with care. It is useful for debugging
purpose. You can use the attribute <FONT COLOR=purple>dumptraffic="light"</FONT> to
dump only the first 44 bytes.</P><P>Since version <B>1.4.0</B>, you have also a specific logging per
protocol, using <FONT COLOR=purple>dumptraffic="protocol"</FONT>. It’s currently
only implemented for HTTP: this will log all requests in a CSV file,
with the following data:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">#date;pid;id;http method;host;URL;HTTP status;size;match;error
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>The <TT>loglevel</TT> can also have a great impact on performance:
For high load, <FONT COLOR=purple>warning</FONT> is recommended.
Possible values are:</P><UL CLASS="itemize"><LI CLASS="li-itemize">
emergency
</LI><LI CLASS="li-itemize">critical
</LI><LI CLASS="li-itemize">error
</LI><LI CLASS="li-itemize">warning
</LI><LI CLASS="li-itemize">notice (default)
</LI><LI CLASS="li-itemize">info
</LI><LI CLASS="li-itemize">debug
</LI></UL><P>For REALLY verbose logging, recompile tsung with <TT>make debug</TT>
and set <TT>loglevel</TT> to <FONT COLOR=purple>debug</FONT>.</P><!--TOC subsection Clients and server-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc41">6.2</A>  Clients and server</H3><!--SEC END --><P>Scenarios start with clients (Tsung cluster) and server definitions:</P><!--TOC subsubsection Basic setup-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc42">6.2.1</A>  Basic setup</H4><!--SEC END --><P>
For non distributed load, you can use a basic setup like:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;clients&gt;
&lt;client host="localhost" use_controller_vm="true"/&gt;
&lt;/clients&gt;
&lt;servers&gt;
&lt;server host="192.168.1.1" port="80" type="tcp"&gt;&lt;/server&gt;
&lt;/servers&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>This will start the load on the same host and on the same Erlang
virtual machine as the controller.</P><P>The server is the entry point into the cluster (<B>New in 1.2.0:</B>
if several servers are defined, a round robin algorithm is used to
choose the server).</P><P><TT>Type</TT> can be <FONT COLOR=purple>tcp</FONT>, <FONT COLOR=purple>ssl</FONT> or
<FONT COLOR=purple>udp</FONT> (for IPv6, use <FONT COLOR=purple>tcp6</FONT>, <FONT COLOR=purple>ssl6</FONT> or
<FONT COLOR=purple>udp6</FONT> ; only available in version <B>1.4.2</B> and newer)</P><!--TOC subsubsection Advanced setup-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc43">6.2.2</A>  Advanced setup</H4><!--SEC END --><P>The next example is more complex, and use several features for
advanced distributed testing:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;clients&gt;
&lt;client host="louxor" weight="1" maxusers="800"&gt;
&lt;ip value="10.9.195.12"&gt;&lt;/ip&gt;
&lt;ip value="10.9.195.13"&gt;&lt;/ip&gt;
&lt;/client&gt;
&lt;client host="memphis" weight="3" maxusers="600" cpu="2"/&gt;
&lt;/clients&gt;
&lt;servers&gt;
&lt;server host="10.9.195.1" port="8080" type="tcp"&gt;&lt;/server&gt;
&lt;/servers&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>Several virtual IP can be used to simulate more machines. This is
very useful when a load-balancer use the client<CODE>'</CODE>s IP to
distribute the traffic among a cluster of servers. <B>New in
1.1.1:</B> IP is no longer mandatory. If not specified, the default IP will
be used.</P><P><B>New in 1.4.0:</B> You can use <FONT COLOR=purple>&lt;ip scan="yes"
value="eth0"/&gt;</FONT> to scan for all the IP aliases on a given interface
(<FONT COLOR=purple>eth0</FONT> in this example).</P><P>In this example, a second machine is used in the Tsung cluster,
with a higher weight, and 2 cpus. Two Erlang virtual machines will be
used to take advantage of the number of CPU.</P><BLOCKQUOTE CLASS="quote">
<B>Note:</B> Even if an Erlang VM is now able to handle several CPUs
(erlang SMP), benchmarks shows that it’s more efficient to use one VM
per CPU (with SMP disabled) for tsung clients. Only the controller node is using SMP
erlang. Therefore, <TT>cpu</TT> should be equal to the number of cores of
your nodes. If you prefer to use erlang SMP, add the <FONT COLOR=purple>-s</FONT>
option when starting tsung (and don’t set <TT>cpu</TT> in the config
file).
</BLOCKQUOTE><P>By default, the load is distributed uniformly on all CPU (one CPU
per client by default). The weight parameter (integer) can be used to
take into account the speed of the client machine. For instance, if
one real client has a weight of 1 and the other client has a weight
of 2, the second one will start twice the number of users as the
first (the proportions will be 1/3 and 2/3). In the earlier example
where for the second client has 2 CPU and weight=3, the weight is
equal to 1.5 for each CPU.</P><P>The <TT>maxusers</TT> parameter is used to bypass the limit of
maximum number of sockets opened by a single process (1024 by
default on many OS)
and the lack of scalability of the <TT>select</TT> system call. When
the number of users is higher than the limit, a new erlang virtual
machine will be started to handle new users. The default value of
<TT>maxusers</TT> is 800 . Nowadays, with kernel polling enable, you
can and should use a very large value for <TT>maxusers</TT> (30000 for example) without
performance penalty (but don’t forget to raise the limit of the OS with
<TT>ulimit -n</TT>, see also FAQ <A HREF="#sec:faq:emfile">A.3</A>).</P><!--TOC subsubsection Running Tsung with a job scheduler-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc44">6.2.3</A>  Running Tsung with a job scheduler</H4><!--SEC END --><P>Tsung is able to get its client node list from a batch/job
scheduler. It currently handle PBS/torque, LSF and OAR. To do this,
set the <TT>type</TT> attribute to <FONT COLOR=purple>batch</FONT>, e.g.:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;client type="batch" batch="torque" maxusers="30000"&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>If you need to scan IP aliases on nodes given by the batch scheduler,
use <TT>scan_intf</TT> like this:
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;client type="batch" batch="torque" scan_intf='eth0' maxusers="30000"&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC subsection Monitoring-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc45">6.3</A>  Monitoring</H3><!--SEC END --><P>Tsung is able to monitor remote servers using several backends that
communicates with remote agent; This
is configured in the <TT>&lt;monitoring&gt;</TT> section. Available
statistics are: CPU activity, load average, memory usage.</P><P>Note that you can get the nodes to monitor from a job scheduler, like:
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;monitor batch="true" host="torque" type="erlang"&gt;&lt;/monitor&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>Several types of remote agents are supported (<FONT COLOR=purple>erlang</FONT> is the default) :</P><!--TOC subsubsection Erlang-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc46">6.3.1</A>  Erlang</H4><!--SEC END --><P>The remote agent is started by Tsung. It use erlang communications to
retrieve statistics of activity on the server. For example, here is a
cluster monitoring definition based on Erlang agents, for a cluster of
6 computers:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;monitoring&gt;
&lt;monitor host="geronimo" type="erlang"&gt;&lt;/monitor&gt;
&lt;monitor host="bigfoot-1" type="erlang"&gt;&lt;/monitor&gt;
&lt;monitor host="bigfoot-2" type="erlang"&gt;&lt;/monitor&gt;
&lt;monitor host="f14-1" type="erlang"&gt;&lt;/monitor&gt;
&lt;monitor host="f14-2" type="erlang"&gt;&lt;/monitor&gt;
&lt;monitor host="db" type="erlang"&gt;&lt;/monitor&gt;
&lt;/monitoring&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>Note: monitored computers needs to be
accessible through the network, and erlang communications must be
allowed (no firewall is better ). SSH (or rsh) needs to be configured to
allow connection without password on. <B>You must use the same
version of Erlang/OTP on all nodes otherwise it may not work
properly !</B></P><P>If you can’t have erlang installed on remote servers, you can use one
of the other available agents:</P><!--TOC subsubsection SNMP-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc47">6.3.2</A>  SNMP</H4><!--SEC END --><P>
The type keyword <FONT COLOR=purple>snmp</FONT> can replace the erlang keyword, if SNMP monitoring
is preferred. They can be mixed. Since version 1.2.2, you can customize the SNMP version,
community and port number. It uses the MIB provided in
<EM>net-snmp</EM> (see also <A HREF="#sec:faq:snmp">A.9</A>).</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;monitoring&gt;
&lt;monitor host="geronimo" type="snmp"/&gt;
&lt;monitor host="f14-2" type="erlang"&gt;&lt;/monitor&gt;
&lt;monitor host="db" type="snmp"&gt;
&lt;snmp version="v2" community="mycommunity" port="11161"/&gt;
&lt;/monitor&gt;
&lt;/monitoring&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>The default version is <FONT COLOR=purple>v1</FONT>, default community
<FONT COLOR=purple>public</FONT> and default port <FONT COLOR=purple>161</FONT>.</P><P>Since version <B>1.4.2</B>, you can also customize the OIDs
retrieved from the SNMP server, using one or several <FONT COLOR=purple>oid</FONT>
element:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;monitor host="127.0.0.1" type="snmp"&gt;
&lt;snmp version="v2"&gt;
&lt;oid value="1.3.6.1.4.1.42.2.145.3.163.1.1.2.11.0"
name="heapused" type="sample" eval="fun(X)-&gt; X/100 end."/&gt;
&lt;/snmp&gt;
&lt;/monitor&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P><TT>type</TT> can be <FONT COLOR=purple>sample</FONT>, <FONT COLOR=purple>counter</FONT> or
<FONT COLOR=purple>sum</FONT>, and optionally you can define a function (with erlang
syntax) to be applied to the value (<TT>eval</TT> attribute).</P><!--TOC subsubsection Munin-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc48">6.3.3</A>  Munin</H4><!--SEC END --><P>Since version <B>1.3.1</B>, Tsung is able to retrieve data from a munin-node agent
(see <A HREF="http://munin.projects.linpro.no/wiki/munin-node"><TT>http://munin.projects.linpro.no/wiki/munin-node</TT></A>). The <TT>type</TT>
keyword must be set to <FONT COLOR=purple>munin</FONT>, for example:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;monitoring&gt;
&lt;monitor host="geronimo" type="munin"/&gt;
&lt;monitor host="f14-2" type="erlang"&gt;&lt;/monitor&gt;
&lt;/monitoring&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC subsection Defining the load progression-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc49">6.4</A>  Defining the load progression</H3><!--SEC END --><!--TOC subsubsection Randomly generated users-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc50">6.4.1</A>  Randomly generated users</H4><!--SEC END --><P>The load progression is set-up by defining several arrival phases:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;load&gt;
&lt;arrivalphase phase="1" duration="10" unit="minute"&gt;
&lt;users interarrival="2" unit="second"&gt;&lt;/users&gt;
&lt;/arrivalphase&gt;
&lt;arrivalphase phase="2" duration="10" unit="minute"&gt;
&lt;users interarrival="1" unit="second"&gt;&lt;/users&gt;
&lt;/arrivalphase&gt;
&lt;arrivalphase phase="3" duration="10" unit="minute"&gt;
&lt;users interarrival="0.1" unit="second"&gt;&lt;/users&gt;
&lt;/arrivalphase&gt;
&lt;/load&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>With this setup, during the first 10 minutes of the test, a new user
will be created every 2 seconds, then during the next 10 minutes, a
new user will be created every second, and for the last 10 minutes,
10 users will be generated every second. The test will finish when
all users have ended their session.</P><P>You can also use <TT>arrivalrate</TT> instead of
<TT>interarrival</TT>. For example, if you want 10 new users per
second, use:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;arrivalphase phase="1" duration="10" unit="minute"&gt;
&lt;users arrivalrate="10" unit="second"&gt;&lt;/users&gt;
&lt;/arrivalphase&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>You can limit the number of users started for each phase by using the
<TT>maxnumber</TT> attribute, just like this:
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;arrivalphase phase="1" duration="10" unit="minute"&gt;
&lt;users maxnumber="100" arrivalrate="10" unit="second"&gt;&lt;/users&gt;
&lt;/arrivalphase&gt;
&lt;arrivalphase phase="2" duration="10" unit="minute"&gt;
&lt;users maxnumber="200" arrivalrate="10" unit="second"&gt;&lt;/users&gt;
&lt;/arrivalphase&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>In this case, only 100 users will be created in the first phases, and
200 more during the second phase.</P><P>The complete sequence can be executed several times using the
<TT>loop</TT> attribute in the <TT>load</TT> tag
(<FONT COLOR=purple>loop=’2’</FONT> means the sequence will be looped twice, so the
complete load will be executed 3 times) (feature available since
version 1.2.2).</P><P>The load generated in terms of HTTP requests / seconds will also
depend on the mean number of requests within a session (if you have a
mean value of 100 requests per session and 10 new users per seconds,
the theoretical average throughput will be 1000 requests/ sec).</P><!--TOC subsubsection Statically generated users-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc51">6.4.2</A>  Statically generated users</H4><!--SEC END --><P>If you want to start a given session (see  <A HREF="#sec:sessions">6.6</A>) at a given time during the test,
it is possible since version <B>1.3.1</B>:
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;load&gt;
&lt;arrivalphase phase="1" duration="10" unit="minute"&gt;
&lt;users interarrival="2" unit="second"&gt;&lt;/users&gt;
&lt;/arrivalphase&gt;
&lt;user session="http-example" start_time="185" unit="second"&gt;&lt;/user&gt;
&lt;user session="http-example" start_time="10" unit="minute"&gt;&lt;/user&gt;
&lt;user session="foo" start_time="11" unit="minute"&gt;&lt;/user&gt;
&lt;/load&gt;
&lt;sessions&gt;
&lt;session name="http-example" probability="0" type="ts_http"&gt;
&lt;request&gt; &lt;http url="/" method="GET"&gt;&lt;/http&gt; &lt;/request&gt;
&lt;/session&gt;
&lt;session name="foo" probability="100" type="ts_http"&gt;
&lt;request&gt; &lt;http url="/" method="GET"&gt;&lt;/http&gt; &lt;/request&gt;
&lt;/session&gt;
&lt;sessions&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>In this example, we have two sessions, one has a "0" probability (and
therefore will not be used in the first phase), and the other
100%. We define 3 users starting respectively 3mn and 5 seconds
after the beginning of the test (using the <FONT COLOR=purple>http-example</FONT>
session), one starting after 10 minutes, and a last one starting after
11 minutes (using the <FONT COLOR=purple>foo</FONT> session this time)</P><!--TOC subsubsection Duration of the load test-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc52">6.4.3</A>  Duration of the load test</H4><!--SEC END --><P>By default, tsung will end when all started users have finished their
session. So it can be much longer than the duration of
arrivalphases. If you want to stop Tsung after a given duration
(even if phases are not finished or if some sessions are still actives),
you can do this with the <TT>duration</TT> attribute in
<TT>load</TT> (<B>feature added in 1.3.2</B>):</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;load duration="1" unit="hour"&gt;
&lt;arrivalphase phase="1" duration="10" unit="minute"&gt;
&lt;users interarrival="2" unit="second"&gt;&lt;/users&gt;
&lt;/arrivalphase&gt;
&lt;/load&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>Currently, the maximum value for duration is a little bit less than 50
days. <TT>unit</TT> can be <FONT COLOR=purple>second</FONT>, <FONT COLOR=purple>minute</FONT> or
<FONT COLOR=purple>hour</FONT>.</P><!--TOC subsection Setting options-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc53">6.5</A>  Setting options</H3><!--SEC END --><P>
<A NAME="sec:options"></A></P><!--TOC paragraph Thinktimes, SSL, Buffers-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->Thinktimes, SSL, Buffers</H5><!--SEC END --><P>Default values can be set-up globally: <TT>thinktime</TT> between requests
in the scenario, SSL cipher algorithms, TCP/UDP buffer sizes (the default
value is 32KB). These values overrides
those set in session configuration tags if override is true.
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;option name="thinktime" value="3" random="false" override="true"/&gt;
&lt;option name="ssl_ciphers"
value="EXP1024-RC4-SHA,EDH-RSA-DES-CBC3-SHA"/&gt;
&lt;option name="tcp_snd_buffer" value="16384"&gt;&lt;/option&gt;
&lt;option name="tcp_rcv_buffer" value="16384"&gt;&lt;/option&gt;
&lt;option name="udp_snd_buffer" value="16384"&gt;&lt;/option&gt;
&lt;option name="udp_rcv_buffer" value="16384"&gt;&lt;/option&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC paragraph Timeout for acknowledgments of messages-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->Timeout for acknowledgments of messages</H5><!--SEC END --><P>This is used to set the idle timeout(used for ’parse’ and ’local’ ack) and
global ack timeout(used for ’global’ ack). By default, idle timeout will be
10min(600000) and global ack timeout will be <FONT COLOR=purple>infinity</FONT>. This value
can be changed like this:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;option name="idle_timeout" value="300000"&gt;&lt;/option&gt;
&lt;option name="glocal_ack_timeout" value="6000000"&gt;&lt;/option&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC paragraph Hibernate-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->Hibernate</H5><!--SEC END --><P>A new option is available in version <B>1.3.1</B>: <TT>hibernate</TT>. This
is used to reduced memory consumption of simulated users during
thinktimes. By default, hibernation will be activated for thinktimes
higher than 10sec. This value can be changed like this:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;option name="hibernate" value="5"&gt;&lt;/option&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>To disable hibernation, you must set the value to <FONT COLOR=purple>infinity</FONT>.</P><!--TOC paragraph Rate_limit-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->Rate_limit</H5><!--SEC END --><P>A new option is available in version <B>1.4.0</B>:
<TT>rate_limit</TT>. This will limit the bandwidth of each client
(using a token bucket algorithm). The value is in KBytes per
second. You can also specify a maximum burst value
(eg. <FONT COLOR=purple>max=’2048’</FONT>). By default the burst size is the same as
the rate (1024KB in the following example). Currently, only incoming
traffic is rate limited.</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;option name="rate_limit" value="1024"&gt;&lt;/option&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC paragraph Ports_range-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->Ports_range</H5><!--SEC END --><P>
If you need to open more than 30000 simultaneous connections on a
client machine, you will be limited by the number of TCP client ports,
even if you use several IPs (this is true at least on Linux). To
bypass this limit, Tsung must not delegate the selection of client
ports and together with using several IP for each client,
you have to defined a range for available clients ports, for ex:
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;option name="ports_range" min="1025" max="65535"/&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC paragraph Setting the seed for random numbers-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->Setting the seed for random numbers</H5><!--SEC END --><P>If you want to use a fixed seed for the random generator, you can use
the <TT>seed</TT> option, like this (by default, tsung will use the
current time to set the seed, therefore random numbers should be
different for every test).</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;option name="seed" value="42"/&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC paragraph Path for Websocket-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->Path for Websocket</H5><!--SEC END --><P>When you use Websocket as a server type, you can set the connect path
for Websocket as following:
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;option name="websocket_path" value="/chat"/&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC subsubsection XMPP/Jabber options-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc54">6.5.1</A>  XMPP/Jabber options</H4><!--SEC END --><P>
<A NAME="sec:jabber-options"></A></P><P>Default values for specific protocols can be defined. Here is an
example of option values for Jabber/XMPP:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;option type="ts_jabber" name="global_number" value="5" /&gt;
&lt;option type="ts_jabber" name="userid_max" value="100" /&gt;
&lt;option type="ts_jabber" name="domain" value="jabber.org" /&gt;
&lt;option type="ts_jabber" name="username" value="myuser" /&gt;
&lt;option type="ts_jabber" name="passwd" value="mypasswd" /&gt;
&lt;option type="ts_jabber" name="muc_service" value="conference.localhost"/&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>Using these values, users will be <FONT COLOR=purple>myuserXXX</FONT> where XXX is an integer in
the interval [1:userid_max] and passwd <FONT COLOR=purple>mypasswdXXX</FONT></P><P>If not set in the configuration file, the values will be set to:
</P><UL CLASS="itemize"><LI CLASS="li-itemize">
global_number = 10000
</LI><LI CLASS="li-itemize">userid_max = 100
</LI><LI CLASS="li-itemize">domain = erlang-projects.org
</LI><LI CLASS="li-itemize">username = tsunguser
</LI><LI CLASS="li-itemize">passwd = sesame
</LI></UL><P>You can also set the <TT>muc_service</TT> here (see previous example).</P><!--TOC subsubsection HTTP options-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc55">6.5.2</A>  HTTP options</H4><!--SEC END --><P>For HTTP, you can set the <TT>UserAgent</TT> values
(<B>available since Tsung 1.1.0</B>), using a probability for each
value (the sum of all probabilities must be equal to 100)</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;option type="ts_http" name="user_agent"&gt;
&lt;user_agent probability="80"&gt;
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Galeon/1.3.21
&lt;/user_agent&gt;
&lt;user_agent probability="20"&gt;
Mozilla/5.0 (Windows; U; Windows NT 5.2; fr-FR; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
&lt;/user_agent&gt;
&lt;/option&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC subsection Sessions-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc56">6.6</A>  Sessions</H3><!--SEC END --><P>
<A NAME="sec:sessions"></A></P><P>Sessions define the content of the scenario itself. They describe
the requests to execute.</P><P>Each session has a given probability. This is used to decide which
session a new user will execute. The sum of all session<CODE>'</CODE>s
probabilities must be 100.</P><P><B>Since Tsung 1.5.0</B>, you can use weights instead of
probabilities. In the following example, there will be twice as many
sessions of type s1 than s2.
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;session name="s1" weight="2" type="ts_http"&gt;
&lt;session name="s2" weight="1" type="ts_http"&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>A transaction is just a way to have customized statistics. Say if you
want to know the response time of the login page of your website, you
just have to put all the requests of this page (HTML + embedded
pictures) within a transaction. In the example above, the transaction
called <TT>index_request</TT> will gives you in the
statistics/reports the mean response time to get
<FONT COLOR=purple>index.en.html + header.gif</FONT>. Be warn that If you have a
thinktime inside the transaction, the thinktime will be part of the
response time.</P><!--TOC subsubsection Thinktimes-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc57">6.6.1</A>  Thinktimes</H4><!--SEC END --><P>You can set static or random thinktimes to separate requests. By
default, a random thinktime will be a exponential distribution with
mean equals to <TT>value</TT>.</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&lt;thinktime value="20" random="true"&gt;&lt;/thinktime&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>In this case, the thinktime will be an exponential distribution with a
mean equals to 20 seconds.</P><P><B>Since version 1.3.0</B>, you can also use a range
<FONT COLOR=purple>[min:max]</FONT> instead of a mean for random thinktimes (the
distribution will be uniform in the interval):
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&lt;thinktime min="2" max="10" random="true"&gt;&lt;/thinktime&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P><B>Since version 1.4.0</B>, you can use a dynamic variable to set
the thinktime value:
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&lt;thinktime value='%%_rndthink%%' random='true'&gt;&lt;/thinktime&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC subsubsection HTTP-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc58">6.6.2</A>  HTTP</H4><!--SEC END --><P>This example shows several features of the HTTP protocol support in
Tsung: GET and POST request, basic authentication, transaction for
statistics definition, conditional request (IF MODIFIED SINCE), ...</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&lt;sessions&gt;
&lt;session name="http-example" probability="70" type="ts_http"&gt;
&lt;request&gt; &lt;http url="/" method="GET" version="1.1"&gt;
&lt;/http&gt; &lt;/request&gt;
&lt;request&gt; &lt;http url="/images/logo.gif"
method="GET" version="1.1"
if_modified_since="Fri, 14 Nov 2003 02:43:31 GMT"&gt;
&lt;/http&gt;&lt;/request&gt;
&lt;thinktime value="20" random="true"&gt;&lt;/thinktime&gt;
&lt;transaction name="index_request"&gt;
&lt;request&gt;&lt;http url="/index.en.html"
method="GET" version="1.1" &gt;
&lt;/http&gt; &lt;/request&gt;
&lt;request&gt;&lt;http url="/images/header.gif"
method="GET" version="1.1"&gt;
&lt;/http&gt; &lt;/request&gt;
&lt;/transaction&gt;
&lt;thinktime value="60" random="true"&gt;&lt;/thinktime&gt;
&lt;request&gt;
&lt;http url="/" method="POST" version="1.1"
contents="bla=blu"&gt;
&lt;/http&gt; &lt;/request&gt;
&lt;request&gt;
&lt;http url="/bla" method="POST" version="1.1"
contents="bla=blu&amp;amp;name=glop"&gt;
&lt;www_authenticate userid="Aladdin"
passwd="open sesame"/&gt;&lt;/http&gt;
&lt;/request&gt;
&lt;/session&gt;
&lt;session name="backoffice" probability="30" ...&gt;
... &lt;/session&gt;
&lt;/sessions&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>If you use an absolute URL, the server used in the URL will override
the one specified in the <TT>&lt;server&gt;</TT> section. The following relative
requests in the session will also use this new server value (until a
new absolute URL is set).</P><P><B>New in 1.2.2:</B> You can add any HTTP header now, as in:
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;request&gt;
&lt;http url="/bla" method="POST" contents="bla=blu&amp;amp;name=glop"&gt;
&lt;www_authenticate userid="Aladdin" passwd="open sesame"/&gt;
&lt;http_header name="Cache-Control" value="no-cache"/&gt;
&lt;http_header name="Referer" value="http://www.w3.org/"/&gt;
&lt;/http&gt;
&lt;/request&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P><B>New in 1.3.0:</B> You can also read the content of a POST or PUT
request from an external file:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;http url='mypage' method='POST' contents_from_file='/tmp/myfile' /&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>Since <B>1.3.1</B>, you can also manually set a cookie, though the
cookie is not persistent: you must add it in every <TT>&lt;requests&gt;</TT>:
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;http url="/"&gt;
&lt;add_cookie key="foo" value="bar"/&gt;
&lt;add_cookie key="id" value="123"/&gt;
&lt;/http&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC paragraph Authentication-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->Authentication</H5><!--SEC END --><P>Until Tsung 1.5.0, only Basic authentication was implemented. You can
now use Digest Authentication and OAuth 1.0.</P><P>To use Digest authentication:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;!-- 1. First request return 401. We use dynvars to fetch nonce and realm --&gt;
&lt;request&gt;
&lt;dyn_variable name="nonce" header="www-authenticate/nonce"/&gt;
&lt;dyn_variable name="realm" header="www-authenticate/realm"/&gt;
&lt;http url="/digest" method="GET" version="1.1"/&gt;
&lt;/request&gt;
&lt;!--
2. This request will be authenticated. Type="digest" is important.
We use the nonce and realm values returned from the previous
If the webserver returns the nextnonce we set it to the nonce dynvar
for use with the next request.
Else it stays set to the old value
--&gt;
&lt;request subst="true"&gt;
&lt;dyn_variable name="nonce" header="authentication-info/nextnonce"/&gt;
&lt;http url="/digest" method="GET" version="1.1"&gt;
&lt;www_authenticate userid="user" passwd="passwd" type="digest" realm="%%_realm%%" nonce="%%_nonce%%"/&gt;
&lt;/http&gt;
&lt;/request&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>To use OAuth authentication:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;!-- Getting a Request Token --&gt;
&lt;request&gt;
&lt;dyn_variable name="access_token" re="oauth_token=([^&amp;amp;]*)"/&gt;
&lt;dyn_variable name="access_token_secret" re="oauth_token_secret=([^&amp;amp;]*)" /&gt;
&lt;http url="/oauth/example/request_token.php" method="POST" version="1.1" contents="empty"&gt;
&lt;oauth consumer_key="key" consumer_secret="secret" method="HMAC-SHA1"/&gt;
&lt;/http&gt;
&lt;/request&gt;
&lt;!-- Getting an Access Token --&gt;
&lt;request subst='true'&gt;
&lt;dyn_variable name="access_token" re="oauth_token=([^&amp;amp;]*)"/&gt;
&lt;dyn_variable name="access_token_secret" re="oauth_token_secret=([^&amp;amp;]*)"/&gt;
&lt;http url="/oauth/example/access_token.php" method="POST" version="1.1" contents="empty"&gt;
&lt;oauth consumer_key="key" consumer_secret="secret" method="HMAC-SHA1" access_token="%%_access_token%%" access_token_secret="%%_access_token_secret%%"/&gt;
&lt;/http&gt;
&lt;/request&gt;
&lt;!-- Making Authenticated Calls --&gt;
&lt;request subst="true"&gt;
&lt;http url="/oauth/example/echo_api.php" method="GET" version="1.1"&gt;
&lt;oauth consumer_key="key" consumer_secret="secret" access_token="%%_access_token%%" access_token_secret="%%_access_token_secret%%"/&gt;
&lt;/http&gt;
&lt;/request&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC subsubsection Jabber/XMPP-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc59">6.6.3</A>  Jabber/XMPP</H4><!--SEC END --><P><A NAME="sec:sessions:jabber"></A>
</P><P>Here is an example of a session definition for the Jabber/XMPP protocol:
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&lt;sessions&gt;
&lt;session probability="70" name="jabber-example" type="ts_jabber"&gt;
&lt;request&gt; &lt;jabber type="connect" ack="local" /&gt; &lt;/request&gt;
&lt;thinktime value="2"&gt;&lt;/thinktime&gt;
&lt;transaction name="authenticate"&gt;
&lt;request&gt; &lt;jabber type="auth_get" ack="local"&gt;&lt;/jabber&gt; &lt;/request&gt;
&lt;request&gt; &lt;jabber type="auth_set_plain" ack="local"&gt;&lt;/jabber&gt; &lt;/request&gt;
&lt;/transaction&gt;
&lt;request&gt; &lt;jabber type="presence:initial" ack="no_ack"/&gt; &lt;/request&gt;
&lt;thinktime value="30"&gt;&lt;/thinktime&gt;
&lt;transaction name="online"&gt;
&lt;request&gt; &lt;jabber type="chat" ack="no_ack" size="16" destination="online"/&gt;&lt;/request&gt;
&lt;/transaction&gt;
&lt;thinktime value="30"&gt;&lt;/thinktime&gt;
&lt;transaction name="offline"&gt;
&lt;request&gt; &lt;jabber type="chat" ack="no_ack" size="56" destination="offline"/&gt;&lt;request&gt;
&lt;/transaction&gt;
&lt;thinktime value="30"&gt;&lt;/thinktime&gt;
&lt;transaction name="close"&gt;
&lt;request&gt; &lt;jabber type="close" ack="local"&gt; &lt;/jabber&gt;&lt;/request&gt;
&lt;/transaction&gt;
&lt;/session&gt;
&lt;/sessions&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC paragraph Roster-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->Roster</H5><!--SEC END --><P>What you can do with rosters using Tsung:</P><P>You can
</P><OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">
Add a new contact to their roster
- The new contact is added to the <FONT COLOR=purple>Tsung Group</FONT> group, and their name matches their JID
</LI><LI CLASS="li-enumerate">Send a <FONT COLOR=purple>subscribe</FONT> presence notification to the new contact’s JID
- This results in a <EM>pending</EM> subscription
</LI><LI CLASS="li-enumerate">Rename a roster contact
This changes the previously added contact’s name from the default JID, to <FONT COLOR=purple>Tsung Testuser</FONT>
</LI><LI CLASS="li-enumerate">Delete the previously added contact.
</LI></OL><P>Note that when you add a new contact, the contact JID is stored and used for the operations that follow. It is recommended that for each session which is configured to perform these operations, only do so once. In other words, you would NOT want to ADD more than one new contact per session. If you want to alter the rate that these roster functions are used during your test, it is best to use the session ’probability’ factor to shape this.</P><P>The nice thing about this is that when you test run is complete, your roster tables should look the same as before you started the test. So, if you set it up properly, you can have pre-loaded roster entries before the test, and then use these methods to dynamically add, modify, and remove roster entries during the test as well.</P><P>Example roster modification setup:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&lt;session probability="100" name="jabber-rostermod" type="ts_jabber"&gt;
&lt;!-- connect, authenticate, roster 'get', etc... --&gt;
&lt;transaction name="rosteradd"&gt;
&lt;request&gt;
&lt;jabber type="iq:roster:add" ack="no_ack" destination="online"&gt;&lt;/jabber&gt;
&lt;/request&gt;
&lt;request&gt;
&lt;jabber type="presence:subscribe" ack="no_ack"/&gt;
&lt;/request&gt;
&lt;/transaction&gt;
&lt;!-- ... --&gt;
&lt;transaction name="rosterrename"&gt;
&lt;request&gt; &lt;jabber type="iq:roster:rename" ack="no_ack"&gt;&lt;/jabber&gt; &lt;/request&gt;
&lt;/transaction&gt;
&lt;!-- ... --&gt;
&lt;transaction name="rosterdelete"&gt;
&lt;request&gt; &lt;jabber type="iq:roster:remove" ack="no_ack"&gt;&lt;/jabber&gt; &lt;/request&gt;
&lt;/transaction&gt;
&lt;!-- remainder of session... --&gt;
&lt;/session&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>See also <A HREF="#bidi:presence">4.5.2</A> for automatic handling of subscribing requests.</P><!--TOC paragraph SASL Anonymous-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->SASL Anonymous</H5><!--SEC END --><P>SASL Anonymous authentication example:
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&lt;session probability="100" name="sasl" type="ts_jabber"&gt;
&lt;request&gt; &lt;jabber type="connect" ack="local"&gt;&lt;/jabber&gt; &lt;/request&gt;
&lt;thinktime value="10"&gt;&lt;/thinktime&gt;
&lt;transaction name="authenticate"&gt;
&lt;request&gt;
&lt;jabber type="auth_sasl_anonymous" ack="local"&gt;&lt;/jabber&gt;&lt;/request&gt;
&lt;request&gt;
&lt;jabber type="connect" ack="local"&gt;&lt;/jabber&gt; &lt;/request&gt;
&lt;request&gt;
&lt;jabber type="auth_sasl_bind" ack="local" &gt;&lt;/jabber&gt;&lt;/request&gt;
&lt;request&gt;
&lt;jabber type="auth_sasl_session" ack="local" &gt;&lt;/jabber&gt;&lt;/request&gt;
&lt;/transaction&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC paragraph Presence-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->Presence</H5><!--SEC END --><UL CLASS="itemize"><LI CLASS="li-itemize">
<TT>type</TT> can be either <FONT COLOR=purple>presence:broadcast</FONT> or <FONT COLOR=purple>presence:directed</FONT>.
</LI><LI CLASS="li-itemize"><TT>show</TT> value must be either <FONT COLOR=purple>away</FONT>, <FONT COLOR=purple>chat</FONT>, <FONT COLOR=purple>dnd</FONT>, or <FONT COLOR=purple>xa</FONT>.
</LI><LI CLASS="li-itemize"><TT>status</TT> value can be any text.
</LI></UL><P>
For more info, see section 2.2 of RFC 3921.</P><P>If you omit the <TT>show</TT> or <TT>status</TT> attributes, they default to <FONT COLOR=purple>chat</FONT> and <FONT COLOR=purple>Available</FONT> respectively.</P><P>Example of broadcast presence (broadcast to members of your roster):
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;request&gt;
&lt;jabber type="presence:broadcast" show="away" status="Be right back..." ack="no_ack"/&gt;
&lt;/request&gt;
&lt;thinktime value="5"&gt;&lt;/thinktime&gt;
&lt;request&gt;
&lt;jabber type="presence:broadcast" show="chat" status="Available
to chat" ack="no_ack"/&gt;
&lt;/request&gt;
&lt;thinktime value="5"&gt;&lt;/thinktime&gt;
&lt;request&gt;
&lt;jabber type="presence:broadcast" show="dnd" status="Don't bother me!" ack="no_ack"/&gt;
&lt;/request&gt;
&lt;thinktime value="5"&gt;&lt;/thinktime&gt;
&lt;request&gt;
&lt;jabber type="presence:broadcast" show="xa" status="I may never come back..."
ack="no_ack"/&gt;
&lt;/request&gt;
&lt;thinktime value="5"&gt;&lt;/thinktime&gt;
&lt;request&gt; &lt;jabber type="presence:broadcast" ack="no_ack"/&gt; &lt;/request&gt;
&lt;thinktime value="5"&gt;&lt;/thinktime&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>Example of directed presence (sent to random <FONT COLOR=purple>online</FONT> users):
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;request&gt;
&lt;jabber type="presence:directed" show="away" status="Be right back..." ack="no_ack"/&gt;
&lt;/request&gt;
&lt;thinktime value="5"&gt;&lt;/thinktime&gt;
&lt;request&gt;
&lt;jabber type="presence:directed" show="chat" status="Available to chat" ack="no_ack"/&gt;
&lt;/request&gt;
&lt;thinktime value="5"&gt;&lt;/thinktime&gt;
&lt;request&gt;
&lt;jabber type="presence:directed" show="dnd" status="Don't bother me!" ack="no_ack"/&gt;
&lt;/request&gt;
&lt;thinktime value="5"&gt;&lt;/thinktime&gt;
&lt;request&gt;
&lt;jabber type="presence:directed" show="xa" status="I may never come back..."
ack="no_ack"/&gt;
&lt;/request&gt;
&lt;thinktime value="5"&gt;&lt;/thinktime&gt;
&lt;request&gt;
&lt;jabber type="presence:directed" ack="no_ack"/&gt;
&lt;/request&gt;
&lt;thinktime value="5"&gt;&lt;/thinktime&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC paragraph MUC-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->MUC</H5><!--SEC END --><P>Tsung supports three MUC operations:
</P><OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">
Join a room (attribute <FONT COLOR=purple>type=’muc:join’</FONT>)
</LI><LI CLASS="li-enumerate">Send a message to a room (attribute <FONT COLOR=purple>type=’muc:chat’</FONT>)
</LI><LI CLASS="li-enumerate">Change nickname (attribute <FONT COLOR=purple>type=’muc:nick’</FONT>)
</LI><LI CLASS="li-enumerate">Exit a room (attribute <FONT COLOR=purple>type=’muc:exit</FONT>)
</LI></OL><P>Here’s an example:
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&lt;-- First, choose an random room and random nickname: --&gt;
&lt;setdynvars sourcetype="random_number" start="1" end="100"&gt;
&lt;var name="room"/&gt;
&lt;/setdynvars&gt;
&lt;setdynvars sourcetype="random_string" length="10"&gt;
&lt;var name="nick1"/&gt;
&lt;/setdynvars&gt;
&lt;request subst="true"&gt;
&lt;jabber type='muc:join' ack = "local" room = "room%%_room%%" nick = "%%_nick1%%"/&gt;
&lt;/request&gt;
&lt;!-- use a for loop to send several messages to the room --&gt;
&lt;for from="1" to="6" var="i"&gt;
&lt;thinktime value="30"/&gt;
&lt;request subst="true"&gt;
&lt;jabber type="muc:chat" ack="no_ack" size="16" room =
"room%%_room%%"/&gt;
&lt;/request&gt;
&lt;/for&gt;
&lt;!-- change nickname--&gt;
&lt;thinktime value="2"/&gt;
&lt;setdynvars sourcetype="random_string" length="10"&gt;
&lt;var name="nick2"/&gt;
&lt;/setdynvars&gt;
&lt;request subst="true"&gt;
&lt;jabber type="muc:nick" room="room%%_room%%" nick="%%_nick2%%"
ack="no_ack"/&gt;
&lt;/request&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>MUC support is available since version 1.3.1</P><!--TOC paragraph PubSub-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->PubSub</H5><!--SEC END --><P>Experimental support for PubSub is available in version 1.3.1</P><P>You can read the following entry: <A HREF="https://support.process-one.net/browse/TSUN-115"><TT>https://support.process-one.net/browse/TSUN-115</TT></A></P><!--TOC paragraph VHost-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->VHost</H5><!--SEC END --><P>VHost support is available since version 1.3.2</P><P>Tsung is able to bench multiple vhost instances by choosing a
vhost XMPP name from a list at connection time in the scenario.</P><P>The vhost list is read from a file:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&lt;options&gt;
...
&lt;option name="file_server" value="domains.csv" id="vhostfileId"&gt;&lt;/option&gt;
...
&lt;option type="ts_jabber" name="vhost_file" value="vhostfileId"&gt;&lt;/option&gt;
...
&lt;/options&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>When each client starts a session, it chooses randomly a domain (each domain has the
same probability).</P><!--TOC paragraph Reading usernames and password from a CSV file-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->Reading usernames and password from a CSV file</H5><!--SEC END --><P>Since version 1.4.0, you can now use a CSV file to store the usernames
and password.</P><P>Configure the CSV file:
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;options&gt;
&lt;option name="file_server" id='userdb' value="/home/foo/.tsung/users.csv"/&gt;
&lt;/options&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>And then you have to defined two variables of type <FONT COLOR=purple>file</FONT>,
and the first jabber request (<FONT COLOR=purple>connect</FONT>) must include a
<TT>xmpp_authenticate</TT> tag:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">
&lt;session probability="100" name="jabber-example" type="ts_jabber"&gt;
&lt;setdynvars sourcetype="file" fileid="userdb" delimiter=";" order="iter"&gt;
&lt;var name="username" /&gt;
&lt;var name="password" /&gt;
&lt;/setdynvars&gt;
&lt;request subst='true'&gt;
&lt;jabber type="connect" ack="no_ack"&gt;
&lt;xmpp_authenticate username="%%_username%%" passwd="%%_password%%"/&gt;
&lt;/jabber&gt;
&lt;/request&gt;
&lt;thinktime value="2"&gt;&lt;/thinktime&gt;
&lt;transaction name="authenticate"&gt;
&lt;request&gt;
&lt;jabber type="auth_get" ack="local"&gt; &lt;/jabber&gt;
&lt;/request&gt;
&lt;request&gt;
&lt;jabber type="auth_set_plain" ack="local"&gt;&lt;/jabber&gt;
&lt;/request&gt;
&lt;/transaction&gt;
...
&lt;/session&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC paragraph raw XML-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->raw XML</H5><!--SEC END --><P>
You can send raw XML data to the server using the <TT>raw</TT> type:
</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&lt;jabber type="raw" ack="no_ack" data="&amp;lt;stream&amp;gt;foo&amp;lt;/stream&amp;gt;"&gt;&lt;/jabber&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>Beware: you must encode XML characters like <FONT COLOR=purple>&lt;</FONT>
,<FONT COLOR=purple>&gt;</FONT>, <FONT COLOR=purple>&amp;</FONT>, etc.</P><!--TOC paragraph resource-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->resource</H5><!--SEC END --><P>By default, the XMPP resource is set to <FONT COLOR=purple>tsung</FONT>. Since
version 1.5.0, you can override this (in all <TT>auth_*</TT> and
<TT>register</TT> requests) using the <TT>resource</TT> attribute.</P><!--TOC subsubsection PostgreSQL-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc60">6.6.4</A>  PostgreSQL</H4><!--SEC END --><P>For PostgreSQL, 4 types of requests are available:
</P><OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">
connect (to a given database with a given username
</LI><LI CLASS="li-enumerate">authenticate (with password or not)
</LI><LI CLASS="li-enumerate">sql (basic protocol)
</LI><LI CLASS="li-enumerate">close
</LI></OL><P>In addition, the following parts of the extended protocol is supported:
</P><OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">
copy, copydone and copyfail
</LI><LI CLASS="li-enumerate">parse, bind, execute, describe
</LI><LI CLASS="li-enumerate">sync, flush
</LI></OL><P>This example shows most of the features of a PostgreSQL session:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;session probability="100" name="pgsql-example" type="ts_pgsql"&gt;
&lt;transaction name="connection"&gt;
&lt;request&gt;
&lt;pgsql type="connect" database="bench" username="bench" /&gt;
&lt;/request&gt;
&lt;/transaction&gt;
&lt;request&gt;&lt;pgsql type="authenticate" password="sesame"/&gt;&lt;/request&gt;
&lt;thinktime value="12"/&gt;
&lt;request&gt;&lt;pgsql type="sql"&gt;SELECT * from accounts;&lt;/pgsql&gt;&lt;/request&gt;
&lt;thinktime value="20"/&gt;
&lt;request&gt;&lt;pgsql type="sql"&gt;SELECT * from users;&lt;/pgsql&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='sql'&gt;&lt;![CDATA[SELECT n.nspname as "Schema",
c.relname as "Name",
CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'i'
THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN '%_toto_% END as "Type",
u.usename as "Owner"
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind IN ('r','v','S','')
AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
AND pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 1,2;]]&gt;&lt;/pgsql&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type="close"&gt;&lt;/pgsql&gt;&lt;/request&gt;
&lt;/session&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>Example with the extended protocol:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&lt;request&gt;&lt;pgsql type='parse' name_prepared='P0_7'&gt;&lt;![CDATA[BEGIN;]]&gt;&lt;/pgsql&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='sync'/&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='parse' name_prepared='P0_8'&gt;&lt;![CDATA[UPDATE pgbench_accounts
SET abalance = abalance + $1 WHERE aid = $2;]]&gt;&lt;/pgsql&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='sync'/&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='parse' name_prepared='P0_9'&gt;&lt;![CDATA[SELECT
abalance FROM pgbench_accounts
WHERE aid = $1;]]&gt;&lt;/pgsql&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='sync'/&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='parse' name_prepared='P0_10'&gt;&lt;![CDATA[UPDATE pgbench_tellers
SET tbalance = tbalance + $1 WHERE tid = $2;]]&gt;&lt;/pgsql&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='sync'/&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='parse' name_prepared='P0_11'&gt;&lt;![CDATA[UPDATE pgbench_branches
SET bbalance = bbalance + $1 WHERE bid = $2;]]&gt;&lt;/pgsql&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='sync'/&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='parse' name_prepared='P0_12'&gt;&lt;![CDATA[INSERT
INTO pgbench_history (tid, bid, aid, delta, mtime)
VALUES ($1, $2, $3, $4, CURRENT_TIMESTAMP);]]&gt;&lt;/pgsql&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='sync'/&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='parse' name_prepared='P0_13'&gt;&lt;![CDATA[END;]]&gt;&lt;/pgsql&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='sync'/&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='bind' name_prepared='P0_7' formats='none' formats_results='text' /&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='describe' name_portal=''/&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='execute'/&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='sync'/&gt;&lt;/request&gt;
&lt;request&gt;&lt;pgsql type='bind' name_portal='' name_prepared='P0_8'
formats='none' formats_results='text'
parameters='2924,37801'/&gt;&lt;/request&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC subsubsection MySQL-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc61">6.6.5</A>  MySQL</H4><!--SEC END --><P>
<A NAME="sec:session:mysql"></A>
For MySQL, 4 types of requests are available (same as PostgreSQL):
</P><OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">
connect (to a given database with a given username
</LI><LI CLASS="li-enumerate">authenticate (with password or not)
</LI><LI CLASS="li-enumerate">sql
</LI><LI CLASS="li-enumerate">close
</LI></OL><P>This example shows most of the features of a MySQL session:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&lt;session probability="100" name="mysql-example" type="ts_mysql"&gt;
&lt;request&gt;
&lt;mysql type="connect" /&gt;
&lt;/request&gt;
&lt;request&gt;
&lt;mysql type="authenticate" database="test" username="test" password="test" /&gt;
&lt;/request&gt;
&lt;request&gt;
&lt;mysql type="sql"&gt;SHOW TABLES&lt;/mysql&gt;
&lt;/request&gt;
&lt;request&gt;
&lt;mysql type="sql"&gt;SELECT * FROM mytable&lt;/mysql&gt;
&lt;/request&gt;
&lt;request&gt;
&lt;mysql type="close" /&gt;
&lt;/request&gt;
&lt;/session&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC subsubsection Websocket-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc62">6.6.6</A>  Websocket</H4><!--SEC END --><P>
<A NAME="sec:session:websocket"></A>
For Websocket, 3 types of requests are available:
</P><OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">
connect (to a given path)
</LI><LI CLASS="li-enumerate">message (send message to server)
</LI><LI CLASS="li-enumerate">close
</LI></OL><P>Example with Websocket as a session type:</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&lt;session probability="100" name="mysql-example" type="ts_websocket"&gt;
&lt;request&gt;
&lt;websocket type="connect" path="/path/to/ws"&gt;&lt;/websocket&gt;
&lt;/request&gt;
&lt;request&gt;
&lt;websocket type="message"&gt;Hello world!&lt;/websocket&gt;
&lt;/request&gt;
&lt;request&gt;
&lt;websocket type="close"&gt;&lt;/websocket&gt;
&lt;/request&gt;
&lt;/session&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><!--TOC subsubsection LDAP-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc63">6.6.7</A>  LDAP</H4><!--SEC END --><P>
<A NAME="sec:session:ldap"></A></P><!--TOC paragraph Authentication-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->Authentication</H5><!--SEC END --><P>
The recommended mechanism used to authenticate users against a LDAP
repository requires two steps to follow. Given an username and
password, we:</P><OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">
Search the user in the repository tree, using the username (so users can reside in different subtrees of the organization)
</LI><LI CLASS="li-enumerate">Try to bind as the user, with the distinguished name found in the first step and the user’s password
</LI></OL><P>If the bind is successful, the user is authenticated (this is the
scheme used, among others, by the LDAP authentication module for
Apache <A HREF="http://httpd.apache.org/docs/2.0/mod/mod_auth_ldap.html"><TT>http://httpd.apache.org/docs/2.0/mod/mod_auth_ldap.html</TT></A>)</P><!--TOC paragraph LDAP Setup-->
<H5 CLASS="paragraph"><!--SEC ANCHOR -->LDAP Setup</H5><!--SEC END --><P>
For this example we are going to use a simple repository with the following hierarchy:</P><BLOCKQUOTE CLASS="figure"><DIV CLASS="center"><HR WIDTH="80%" SIZE=2></DIV>
<DIV CLASS="center">
<IMG SRC="images/ldap-hierarchy.png" ALT="images/ldap-hierarchy.png">
</DIV>
<DIV CLASS="caption"><TABLE CELLSPACING=6 CELLPADDING=0><TR><TD VALIGN=top ALIGN=left>Figure 1: LDAP Hierarchy</TD></TR>
</TABLE></DIV>
<A NAME="fig:ldap:hierarchy"></A>
<DIV CLASS="center"><HR WIDTH="80%" SIZE=2></DIV></BLOCKQUOTE><P>the repository has users in two organizational units
</P><OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">
users (with four members)
</LI><LI CLASS="li-enumerate">users2 (with tree members)
</LI></OL><P>For simplicity we set the password of each user to be the same as its common name (cn).
Tsung Setup
We will use a CSV file as input, containing the user:password pairs
for our test. So we start by writing it, in this case we name the file <TT>users.csv</TT></P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">user1;user1
user2;user2
user3;user3
user4;user4
jane;jane
mary;mary
paul;pablo
paul;paul
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>(the pair paul:pablo should fail to authenticate, we will note that in the Tsung report)
Then, in our Tsung scenario, we let Tsung know about this file</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;options&gt;
&lt;option name="file_server" id="users" value="users.csv"/&gt;
&lt;/options&gt;
We use two dynamic variables to hold the username and password
&lt;setdynvars sourcetype="file" fileid="users" delimiter=";" order="iter"&gt;
&lt;var name="username" /&gt;
&lt;var name="password" /&gt;
&lt;/setdynvars&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE><P>To start the authentication process we instruct Tsung to perform a search, to find the distinguished name of the user we are trying to authenticate</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim"> &lt;ldap type="search" base="dc=pablo-desktop" filter="(cn=%%_username%%)"
result_var="search_result" scope="wholeSubtree"&gt;&lt;/ldap&gt;
</PRE></TD></TR>
</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
</TD></TR>
</TABLE></TD></TR>
<TR><TD BGCOLOR=black COLSPAN=