[p2p-hackers] About detecting the transfer speed

coderman coderman at gmail.com
Mon Nov 21 09:40:30 UTC 2005


On 11/20/05, Yifei Zeng <mac.ibook at gmail.com> wrote:
> ... could anyone give a hit for how to detect the transfer
> speed? I am using NIO (non-blocking I/O) in java. As every message is
> sent behind the scene, how can I know the
> actual transfer speed of each message / file?

a weighted average or rolling weighted average works nicely (tweaking
the specifics is a black art / varies widely :)

at a socket level tuning send and recv buffer sizes in addition to
socket options (like nagle, large windows, etc) can have a significant
effect on the accuracy/precision of your estimate and overall
throughput.

as for java specifically you may need to provide your own derived
implementation of java.nio.Buffer which keeps track of transfer stats.

* http://java.sun.com/j2se/1.4.2/docs/api/java/nio/Buffer.html

best regards,



More information about the P2p-hackers mailing list