processone / tsung

Tsung is a high-performance benchmark framework for various protocols including HTTP, XMPP, LDAP, etc.
http://www.process-one.net/en/tsung/
GNU General Public License v2.0
2.53k stars 405 forks source link

error_connect_nxdomain around 60k clients #184

Open jcperez85 opened 8 years ago

jcperez85 commented 8 years ago

Doing load tests to an XMPP server through TCP, when the number of clients connected reaches 60000, logs start showing this error error_connect_nxdomain. This is the test I'm using (XMPP server has been replaced by asterisks):

test-100000.txt

tisba commented 8 years ago

Hey. Looks like you are exhausting ephemeral ports. There is a design limit how many connections you can have per Source IP/Destination IP Port combination. You could distribute your test to multiple tsung nodes or add more source IPs (see tsung documentation).

weibomobile commented 8 years ago

Hey.

The Socket's IP and Port

One socket connection's address have the quadruple :

{SrcIP, SrcPort, DstIP, DstPort}

One socket original address combile with {SrcIP, SrcPort}:

The available ports range

You should know some details about the ports range in Linux/Unix.

The Port (short int variable) value range is 1 ~ 65535, and the 1~1024 just for the root apps.

You should check the available ports range with sysctl command :

sysctl -a | grep "ip_local_port_range"

You can set ports range:

sysctl -w net.ipv4.ip_local_port_range="1024 65535"

sysctl -p

Now you have 65535-1024 ≈ 64000 availabe ports.

The available Ip & Ports

Some details you should know

tisba commented 8 years ago

Nice writeup. One should be careful though, because on a usual system there are services running that use ports > 1024. E.g. one of them is the epmd launched by Erlang. This is usually not a problem, but will generate some errors.

weibomobile commented 8 years ago

Maybe you should have a look at Tsung 1.6.1 with IP_TRANSPARENT support when you just only running test in lan-nextwork.

Some one who master the Chinese Language, should visit the post:

http://www.blogjava.net/yongboy/archive/2016/08/16/431601.html