Raulmsm / RUDP

A reliable UDP Javascript implementation for node.js
13 stars 6 forks source link

When RUDP.send is called inside the callback of RUDP.send performance drops dramatically #11

Open Raulmsm opened 11 years ago

Raulmsm commented 11 years ago

Sending as fast as possible performs as expected:

function agressiveSend() { var req = rudp.send('127.0.01', BENCHMARK_PORT, 'test'); setImmediate(agressiveSend); }

Waiting for the sent message to be ACKed results in huge performance drop after around 15000 requests:

function agressiveSend() { var req = rudp.send('127.0.01', BENCHMARK_PORT, 'test', function() { setImmediate(agressiveSend); }); }

sunnyboy00 commented 11 years ago

how can you distinguish different socket , each one should have its own seqNo ,isMessageWaitingAck(seqNo) works bad.

in fact ,udp may be nerver loss in local test .

Raulmsm commented 11 years ago

I am not sure I understand what you are saying. At the moment different sockets are distinguished by the port they use: Every time you send an UDP message a random port is choosen to act as the "source" port, at the moment any socket that sends a message also listens in that port, waiting for an ACK. That way the server can know where to send the ACK (the source port). Anyway, each message has its own seqno and so it doesn't matter from which socket they come as the ACK tells you which message is being ACKed.