[Tsung] Generating over 32k clients from a single machine

Nicolas Niclausse nicolas at niclux.org
Mon Mar 3 10:26:23 CET 2008

Vinod Panicker ecrivait le 28.02.2008 12:28:

>> Thanks, will try this out.  The interfaces are configured such just so
>>  we can get around the 65k limit per ip for the test.
> This configuration allows tsung to use a single beam.smp process and
> utilize all 4 ip addresses, but there's another weird problem
> occurring now. Tsung is not reusing the port numbers between the ip
> address.  Eg - port number 4444 will be used only once instead of 4
> times. Eventually, it runs out of available ports at around 65k.
> Verified this using the netstat output.

tsung has no control on the client port (for tcp).

Maybe reuseaddr must be set to true, even if the IP is different ?

If this is the case, this patch should fix your problem:

--- ts_client.erl	(revision 808)
+++ ts_client.erl	(working copy)
@@ -518,14 +518,15 @@
  %% Purpose: set connection's options for the given protocol
  protocol_options(ssl,#proto_opts{ssl_ciphers=negociate}) ->
-    [binary, {active, once} ];
+    [binary, {active, once} , {reuseaddr, true}];
  protocol_options(ssl,#proto_opts{ssl_ciphers=Ciphers}) ->
      ?DebugF("cipher is ~p~n",[Ciphers]),
-    [binary, {active, once}, {ciphers, Ciphers} ];
+    [binary, {active, once}, {reuseaddr, true}, {ciphers, Ciphers} ];

  protocol_options(gen_tcp,#proto_opts{tcp_rcv_size=Rcv, tcp_snd_size=Snd}) ->
       {active, once},
+     {reuseaddr, true},
       {recbuf, Rcv},
       {sndbuf, Snd},
       {keepalive, true} %% FIXME: should be an option
@@ -533,6 +534,7 @@
  protocol_options(gen_udp,#proto_opts{udp_rcv_size=Rcv, udp_snd_size=Snd}) ->
       {active, once},
+     {reuseaddr, true},
       {recbuf, Rcv},
       {sndbuf, Snd}

More information about the Tsung-users mailing list