1

i did setup this NodeJs TCP Server and tested it with a message flooder. Just to see how the performance of the server is.

While the message throughput is great if i run the server and the message flooder on the same computer (ubuntu), the throughput dramaticaly decreases if i start the server on computer1(ubuntu1) and the message flooder on computer2(also ubuntu). Both PC are on the same network. In fact, they are directly connected to each other.

I started searching the internet for reasons and i suppose i need to tune TCP on both Ubuntu-pcs but until now i haven't been successfull at all.

Has anyone experienced such problems, or could someone help me out?

Thanks

Here the flooding code:

var net=require('net')
var client = net.createConnection(5000, "10.0.0.2")

client.addListener("connect", function(){
    for(var i = 0; i < 1000; i++) {
        client.write("message ");
    }
})
4
  • What do you mean by "the throughput dramatically decreases"? Do you mean for other users trying to use the service while it's being flooded? Mar 19, 2012 at 21:29
  • I mean, that the server wasnt able to process the incoming messages from the flooder as fast as before. Flooder and Server on same machine achieved around 60.000 messages/s with the server process at allmost 100% CPU; Server on machine1 and Flooder on machine2 achieved around 500 messages/s with Server process at ~ 7-10% CPU Mar 19, 2012 at 21:36
  • So the question is -- what was the limiting factor. It could be that the flooder's CPU was maxed. It could be that the network bandwidth was maxed. It could be that the flooding code is very latency sensitive and so the increase in latency compromised its throughput. But this begs the question -- why optimize flooding? Was your server still responsive while it was being flooded? Mar 19, 2012 at 21:58
  • flooders CPU cannot be the limiter, since the CPUs on machine 1 and 2 are identical. Network bandwith wasnt maxed out too. The flooding did only take a few Kbits (~200 kbits) and i am on a gbit lan. No, the server was not very responsive while beeing flooded by an external machine. I added the flooding code to the Question. Mar 19, 2012 at 22:16

1 Answer 1

-1

The reason the flooding worked great when both ran on the same computer is because you do not have to send any data through ethernet. It's all done through localhost, at the loopback interface.

I believe the thing that slows you down most in this case is the performance overhead of the ethernet interfaces on both computers. Sending data through ethernet does require resources. I can easily max out my CPU on a small 64 bits 1.3 gHz computer where the network is only at 100mbits/s, not 1 gbits/s (though the ethernet can be at 1 gbits/s it will never able to reach it even closely).

Of course a lot depends also on the quality of the ethernet hardware and the linux driver.

Have you considered using bonding to bond 2 ethernet interfaces together? Depending on the bonding mode you can load balance the traffic between the 2 interfaces. That should help performance.

http://www.linuxhorizon.ro/bonding.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .