Measuring actual connection speeds

I2P shows you a grand total of network traffic, but we think it is important to see actual sustained speeds of individual peer connections because that is the limiting factor for how fast tunnels can be (usually multiple tunnels will share one connection). So we came up with the following simple bash script (pktstat and sudo enabled account needed) that totals network traffic per connection for 100 seconds and sorts by speed.

#!/bin/bash
rm /tmp/i2traf.*
topfile=/tmp/i2traf.top.$RANDOM
tempfile=/tmp/i2traf.temp.$RANDOM
port=12345
sudo pktstat -1 -w 1 -n -t -B | grep $port | head -20 | tee $topfile
echo "Please stand by for the real thing"
while true
do
    echo
    sudo pktstat -1 -w 100 -n -t -B | grep $port | head -20 | sort -rn $topfile - | sort -k 4,6 -s | uniq -f 2 | sort -rn | head -20 | tee $tempfile
    mv $tempfile $topfile
done


Results over 24 hours show that I2Speed can go 600 KBps (in/out) sustained for UDP and TCP (use our latest update parallizing inbound TCP).

63030713 56146 udp localmachine:12345 <-> 95.216.143.241:13363
62541506 46042 tcp localmachine:12345 <-> 95.216.2.172:57164
59951342 44176 tcp6 localmachine,12345 <-> 2a01:c22:760f:3c48:468a:5bff:fe28:9938,37570
54493114 33744 tcp localmachine:12345 <-> 95.143.219.173:49420
53009808 47017 udp 144.76.42.143:13798 <-> localmachine:12345
51140558 53588 tcp localmachine:12345 <-> 193.30.35.196:44150
50755321 35356 tcp localmachine:12345 <-> 54.37.233.223:46998
48330914 40229 tcp localmachine:12345 <-> 62.201.18.205:49934
46624882 35883 tcp localmachine:12345 <-> 193.150.121.23:27806
43668476 32564 tcp6 localmachine,12345 <-> 2a02:180:2:92:feed:beef:32ad:affe,59734
40399573 35263 udp localmachine:12345 <-> 81.170.143.75:19941
37682101 25663 tcp 116.203.44.237:32848 <-> localmachine:12345
36732278 32719 tcp6 localmachine,12345 <-> 2a00:23c4:2bad:2901:8518:33f1:e1cb:b74f,59077
36534359 27408 tcp localmachine:12345 <-> 77.246.157.17:40896
35805256 32005 udp localmachine:12345 <-> 96.253.48.18:15789
35673899 24731 tcp localmachine:12345 <-> 91.122.52.237:59954
34929242 28904 tcp6 localmachine,12345 <-> 2a01:c22:7242:7d80:468a:5bff:fe28:9938,58262
32557569 29101 udp localmachine:12345 <-> 47.214.232.238:12634
31062217 27772 udp localmachine:12345 <-> 35.242.161.184:9323
30871617 28134 tcp localmachine:12345 <-> 94.2.40.148:12755

Questions welcome.

Updated 200324

<-- Back