observing / thor

The WebSocket god of thunder
MIT License
1.29k stars 154 forks source link

Losing a considerable portion of connections due to EADDRNOTAVAIL #22

Open ziadloo opened 8 years ago

ziadloo commented 8 years ago

I'm trying to stress test a WebSocket server using your software and when I turn the number of connections high, a considerable portion of connections are lost to EADDRNOTAVAIL (10% to 50%).

But this behavior is not consistent. And it seems like once your software hits some condition, it just quits without trying for the rest. For instance, one time I started the test for 20k connections and it took few seconds (10 or 15) to get around 10k connections before it hits the problem (EADDRNOTAVAIL) and once it did, it gave up the rest of test in matter of seconds (one or two) prompting that ~9k connections had the EADDRNOTAVAIL error!

The next time I ran the exact same test (without even restarting the server), it completed without any errors, not even a single one! Even though the mentioned problem is not consistent but it happens often enough.

I'm using thor v1.0.0 and node v0.10.25 in Ubuntu 14.04 with ulimit -n set to 200k. And here's how I run your software:

./thor --masked --amount 50000 --message 8096 --generator ../../../gen.js ws://localhost:8585

And here's its output:

  Opened 42100 connections

Online               116927 milliseconds
Time taken           116927 milliseconds
Connected            42177
Disconnected         0
Failed               7823
Total transferred    9.65MB
Total received       8.02MB

Durations (ms):

                     min     mean     stddev  median max    
Handshaking          278     41268     18709   44746 64915  
Latency              0       71          282      11 2237   

Percentile (ms):

                      50%     66%     75%     80%     90%     95%     98%     98%    100%   
Handshaking          44746   55088   58286   59500   61681   62050   62977   63639   64915  
Latency              11      22      30      35      67      121     1463    1888    2237   

Received errors:

7823x                connect EADDRNOTAVAIL

BTW, since I'm not sure if it's important or not, my WebSocket server gives back a response to the given request from your software.