Search code examples
tcperlangejabberdtsung

What is the limit of TCP connections per machine using TSUNG?


I want to generate a lot of requests using TSUNG.

My configuration file is

<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/local/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" dumptraffic="false" version="1.0">
  <clients>
    <client host="localhost" maxusers="70000" use_controller_vm="true"/>
  </clients>

<servers>
   <server host="myhost" port="5222" type="tcp"/>
</servers>

<load>
  <arrivalphase phase="1" duration="70000" unit="second">
    <users arrivalrate="10" unit="second"/>
  </arrivalphase>
  </load>

<options>
  <option type="ts_jabber" name="global_number" value="70000"/>
<option type="ts_jabber" name="domain" value="my-domain"/>
  <option name="file_server" id="userdb" value="/root/userdata.csv"/>
</options>

<sessions>
<session probability="100" name="xmpp-connection" type="ts_jabber" bidi="true" $

  <setdynvars sourcetype="file" fileid="userdb" delimiter=";" order="iter">
         <var name="userid"/>
   </setdynvars>
          <transaction name="initial_stream">
        <request subst="true">
           <jabber type="connect" ack="local">
                 <xmpp_authenticate username="tsung%%_userid%%" passwd="tsung%%_userid%%"/>
          </jabber>
         </request>
   </transaction>

   <thinktime value="2"/>

   <transaction name="authenticate">
       <request> <jabber type="auth_sasl" ack="local"/> </request>
       <request> <jabber type="connect" ack="local"/> </request>
       <request> <jabber type="auth_sasl_bind" ack="local"/> </request>
       <request> <jabber type="auth_sasl_session" ack="local"/> </request>
   </transaction>
    <transaction name="roster_get">
       <request>  <jabber type="iq:roster:get" ack="local"/> </request>
   </transaction>


   <request> <jabber type="presence:initial" ack="no_ack"/> </request>
    <for from="1" to="28" incr="1" var="counter">
       <request> <jabber type="raw" ack="no_ack" data="
"/></request>
       <thinktime value="60" random="false"/>
   </for>

   <for from="1" to="30" incr="1" var="counter">
       <request> <jabber type="raw" ack="no_ack" data="
"/></request>
      <thinktime value="60" random="false"/>
   </for>

  <transaction name="close">
     <request> <jabber type="close" ack="no_ack"/> </request>
   </transaction>

 </session>
</sessions>
</tsung>

As per the documentation of TSUNG, I can hit the server using multiple client ips (one machine) http://tsung.erlang-projects.org/user_manual/conf-client-server.html

Several virtual IP can be used to simulate more machines. This is very useful when a load-balancer use the client’s IP to distribute the traffic among a cluster of servers.

<clients>
  <client host="louxor" weight="1" maxusers="800">
    <ip value="10.9.195.12"></ip>
    <ip value="10.9.195.13"></ip>
  </client>
  <client host="memphis" weight="3" maxusers="600" cpu="2"/>
</clients>

I want to find out how many connections per one machine I can generate using TSUNG.

I have a 32 GB, 8 core machine.


Solution

  • This will depend on two factors:

    1. The maximum number of simultaneously open Erlang ports.
    2. The maximum amount of open file description in your operating system.

    For information about the first one see open ports in the 10.2 System Limits section of the Advanced Erlang document. It can be changed using the +Q option when starting the Erlang VM. The default is 16384. And the current limit can be checked using erlang:system_info/1:

    erlang:system_info(port_limit).
    

    For second information simply ulimit -n in the shell. How to change this value depends on the operating system but it's a popular topic so you will easily be able to search for instructions.