使用 TSUNG 的每台机器的 TCP 连接数限制是多少?

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

我想使用 TSUNG 生成大量请求。

我的配置文件是

<?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>

根据 TSUNG 的文档,我可以使用多个客户端 ips(一台机器)访问服务器 http://tsung.erlang-projects.org/user_manual/conf-client-server.html

几个虚拟IP可以用来模拟更多的机器。当负载平衡器使用客户端的 IP 在服务器集群之间分配流量时,这非常有用。

<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>

我想知道我可以使用 TSUNG 在每台机器上生成多少个连接。

我有一台 32 GB 的 8 核机器。

这取决于两个因素:

  1. 同时打开Erlang端口的最大数量。
  2. 您的操作系统中打开文件的最大数量描述。

有关第一个的信息,请参阅 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).

对于第二个信息,只需在 shell 中 ulimit -n。如何更改此值取决于操作系统,但这是一个热门话题,因此您可以轻松搜索说明。